Installation¶
Version 3.3.6 for CF-1.10
Operating systems¶
The cfunits package works for Linux, Mac and Windows operating systems.
Python versions¶
cfunits works only with Python 3.6 or newer.
pip¶
To install cfunits and most of its dependencies (i.e. all except the UDUNITS library) run, for example:
$ pip install cfunits
$ pip install cfunits --upgrade
$ pip install cfunits --user
To install cfunits without any of its dependencies then run, for example:
$ pip install cfunits --no-deps
See the documentation for pip install for further options.
Source¶
To install from source:
Download the cfunits package from https://pypi.org/project/cfunits
Unpack the library (replacing
<version>
with the version that you want to install, e.g.3.3.4
):$ tar zxvf cfunits-<version>.tar.gz $ cd cfunits-<version>
Install the package:
To install the cfunits package to a central location:
$ python setup.py installTo install the cfunits package locally to the user in the default location:
$ python setup.py install --userTo install the cfunits package in the <directory> of your choice:
$ python setup.py install --home=<directory>
Tests¶
Tests are run from within the cfunits/test
directory:
$ python run_tests.py
Dependencies¶
The cfunits package requires:
Python, version 3.6 or newer,
numpy, version 1.15 or newer,
cftime, version 1.5.0 or newer,
packaging, version 20.0 or newer, and
UNIDATA UDUNITS-2 library, version 2.2.25 or newer.
UDUNITS-2 is a C library that provides support for units of physical quantities
If the UDUNITS-2 shared library file (
libudunits2.so.0
on GNU/Linux orlibudunits2.0.dylibfile
on MacOS) is in a non-standard location then its directory path should be added to theLD_LIBRARY_PATH
environment variable. It may also be necessary to specify the location (directory path and file name) of theudunits2.xml
file in theUDUNITS2_XML_PATH
environment variable, although the default location is usually correct. For example,export UDUNITS2_XML_PATH=/home/user/anaconda3/share/udunits/udunits2.xml
.If you get an error that looks like
assert(0 == _ut_unmap_symbol_to_unit(_ut_system, _c_char_p(b'Sv'), _UT_ASCII))
then setting theUDUNITS2_XML_PATH
environment variable is the likely solution.UDUNITS is available via conda with:
$ conda install -c conda-forge udunits2>=2.2.25
Code repository¶
The complete source code is available at https://github.com/NCAS-CMS/cfunits