Skip to content

Commit

Permalink
updated Units.conform and new tests for issue NCAS-CMS#9
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhassell committed Jul 2, 2020
1 parent bc3c072 commit 1ccd24a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Changelog.rst
Expand Up @@ -4,7 +4,7 @@ version 3.2.8

**2020-07-02**

* Allowed list and tuple to be input to `cfunits.Units.conform`
* Allowed `list` and `tuple` to be input to `cfunits.Units.conform`
(https://github.com/NCAS-CMS/cfunits/issues/9).

version 3.2.7
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
@@ -1,6 +1,7 @@
include MANIFEST.in
include Changelog.md
include README.md
include requirements.txt
recursive-include cfunits *
recursive-exclude * *~ *.gz *.pyc
recursive-exclude * *.o *.so .nfs*
Expand Down
2 changes: 1 addition & 1 deletion cfunits/__init__.py
Expand Up @@ -19,7 +19,7 @@
__author__ = 'David Hassell'
__author__ = 'David Hassell'
__date__ = '2020-07-02'
__version__ = '3.2.8b1'
__version__ = '3.2.8'
__cf_version__ = '1.8'

from distutils.version import LooseVersion
Expand Down
5 changes: 4 additions & 1 deletion cfunits/units.py
Expand Up @@ -1948,13 +1948,16 @@ def conform(cls, x, from_units, to_units, inplace=False):
'''
if from_units.equals(to_units):
if not isinstance(x, (int, float)):
x = numpy_asanyarray(x)

if inplace:
return x
else:
try:
return x.copy()
except AttributeError:
return deepcopy(x)
x
# --- End: if

if not from_units.equivalent(to_units):
Expand Down
5 changes: 5 additions & 0 deletions docs/source/installation.rst
Expand Up @@ -35,6 +35,11 @@ example:
pip install cfunits
.. code-block:: shell
:caption: *Upgrade as root, with any missing dependencies.*
pip install cfunits --upgrade
.. code-block:: shell
:caption: *Install as a user, with any missing dependencies.*
Expand Down
17 changes: 10 additions & 7 deletions docs/source/releases.rst
@@ -1,13 +1,16 @@
.. currentmodule:: cfunits
.. default-role:: obj

**Older releases**
==================
.. _Releases:

**Releases**
============

----

* `Version 3.2.7 <https://ncas-cms.github.io/cfunits/3.2.7>`_
* `Version 3.2.6 <https://ncas-cms.github.io/cfunits/3.2.6>`_
* `Version 3.2.5 <https://ncas-cms.github.io/cfunits/3.2.5>`_
* `Version 3.2.4 <https://ncas-cms.github.io/cfunits/3.2.4>`_
* `Version 3.2.3 <https://ncas-cms.github.io/cfunits/3.2.3>`_
* `Version 3.2.8 <https://ncas-cms.github.io/cfunits/3.2.8>`_ (2020-07-02)
* `Version 3.2.7 <https://ncas-cms.github.io/cfunits/3.2.7>`_ (2020-05-20)
* `Version 3.2.6 <https://ncas-cms.github.io/cfunits/3.2.6>`_ (2020-04-27)
* `Version 3.2.5 <https://ncas-cms.github.io/cfunits/3.2.5>`_ (2020-03-26)
* `Version 3.2.4 <https://ncas-cms.github.io/cfunits/3.2.4>`_ (2020-01-07)
* `Version 3.2.3 <https://ncas-cms.github.io/cfunits/3.2.3>`_ (2019-09-16)

0 comments on commit 1ccd24a

Please sign in to comment.