Installation¶
Version 3.0.0 for version 1.7 of the CF conventions.
Python versions¶
cf works only for Python 3.5 or later. (Versions 2.x of cf work only for Python 2.7.)
conda¶
cf-python is in the ncas
conda channel. To install cf with all of
its required and optional
dependencies, and the cf-plot visualisation package, run
conda install -c ncas -c conda-forge cf-python cf-plot udunits2
conda install -c conda-forge mpich esmpy
The second of the two conda
commands is required for
regridding to work.
pip¶
cf-python is in the Python package index: https://pypi.org/project/cf-python
To install cf and all of its required dependencies run, for example:
pip install cf-python
pip install cf-python --user
To install cf without any of its dependencies then run, for example:
pip install cf-python --no-deps
See the documentation for pip install for further options.
The optional dependencies are not automatically
installed via pip
.
Source¶
To install from source:
Download the cf-python package from https://pypi.org/project/cf-python
Unpack the library (replacing
<version>
with the version that you want to install, e.g.3.0.0
):tar zxvf cf-python-<version>.tar.gz cd cf-python-<version>
Install the package:
To install the cf-python package to a central location:
python setup.py installTo install the cf-python package locally to the user in the default location:
python setup.py install --userTo install the cf-python package in the <directory> of your choice:
python setup.py install --home=<directory>
cfa utility¶
During installation the cfa
command line utility is also
installed, which
- generates text descriptions of field constructs contained in files, and
- creates new datasets aggregated from existing files.
Dependencies¶
Required¶
Python, version 3 or newer.
numpy, version 1.15 or newer.
netCDF4, version 1.4.0 or newer.
cftime, version 1.0.2 or newer. (Note that this package is installed with netCDF4.)
cfdm, version 1.7.7 or newer.
cfunits, version 3.2.2 or newer.
psutil, version 0.6.0 or newer.
UNIDATA UDUNITS-2 library, version 2.2.20 or newer.
This is a C library which 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 path should be added to theLD_LIBRARY_PATH
environment variable. It may also be necessary to specify the location of theudunits2.xml
file in theUDUNITS2_XML_PATH
environment variable (although the default location is usually correct).
Optional¶
Some further dependencies that, enable further functionality, are optional. This to faciliate cf-python being installed in restricted environments:
Regridding
ESMF, version 7.1.0r or newer. This is easily installed via conda with
conda install -c conda-forge mpich esmpy
or may be installed from source.
Convolution filters, derivatives and relative vorticity
- scipy, version 1.3.0 or newer.
Subspacing based on N-d construct cells (N > 1) containing a given value
- matplotlib, version 3.0.0 or newer.
Parallel processing
Code repository¶
The complete source code is available at https://github.com/NCAS-CMS/cf-python