HTTPS SSH

CF Python

The cf python package implements the CF data model for the reading, writing and processing of data and metadata.


Home page

cf-python


Documentation


Dependencies

  • Required: A GNU/Linux or Mac OS operating system.

  • Required: A python version 2.7.

  • Required: The python psutil package at version 0.6.0 or newer (the latest version is recommended).

  • Required: The python numpy package at version 1.7 or newer.

  • Required: The python matplotlib package at version 1.4.2 or newer.

  • Required: The python scipy package at version 0.14.0 or newer.

  • Required: The python netCDF4 package at version 1.2.1 or newer. This package requires the netCDF, HDF5 and zlib libraries.

  • Required: The UNIDATA Udunits-2 library. 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 or libudunits2.0.dylibfile on Mac OS) is in a non-standard location then its path should be added to the LD_LIBRARY_PATH environment variable. It may also be necessary to specify the location of the udunits2.xml file in the UDUNITS2_XML_PATH environment variable (although the default location is usually correct).

  • Optional: For regridding to work, the ESMF package at version 7.0.0 or newer is required. If this package is not installed then regridding will not work, but all other cf-python functionality will be unaffected. ESMF may be installed via conda (see below) or from source (see the file ESMF.md for instructions).

  • Optional: The cf-plot package does not currently work for versions 2.x of cf. This will be resolved soon.


Installation

  • To install version 1.2.1 by conda:

    conda install -c ncas -c scitools cf-python cf-plot  
    conda install -c nesii esmpy
    

    These two commands will install cf-python, all of its required dependencies and the two optional packages cf-plot (for visualisation) and ESMF (for regridding). To install cf-python and all of its required dependencies alone:

    conda install -c ncas -c scitools cf-python
    

    To update cf-python, cf-plot and ESMF to the latest versions::

    conda update -c ncas -c scitools cf-python cf-plot 
    conda update -c nesii esmpy
    
  • To install the latest version from PyPI:

    pip install cf-python
    
  • To install from source:

    1. Download the cf package from cf-python downloads.

    2. Unpack the library:

      tar zxvf cf-python-1.3.2.tar.gz
      cd cf-python-1.3.2
      
    3. Install the package:

    • To install the cf package to a central location:

        python setup.py install
      
    • To install the cf package locally to the user in a default location:

        python setup.py install --user
      
    • To install the cf package in the <directory> of your choice:

        python setup.py install --home=<directory>
      

Tests

The test scripts are in the test directory. To run all tests:

python test/run_tests.py

Command line utilities

The cfdump tool generates text representations on standard output of the CF fields contained in the input files.

The cfa tool creates and writes to disk the CF fields contained in the input files.

During the installation described above, these scripts will be copied automatically to a location given by the PATH environment variable.

For usage instructions, use the -h option to display the manual pages:

cfdump -h
cfa -h

Code license

MIT License

  • Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

  • The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

  • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.