Skip to main content

A CF-compliant earth science data analysis library

Project description

CF Python

The Python cf package is an Earth science data analysis library that is built on a complete implementation of the CF data model





The cf package implements the CF data model ( for its internal data structures and so is able to process any CF-compliant dataset. It is not strict about CF-compliance, however, so that partially conformant datasets may be ingested from existing datasets and written to new datasets. This is so that datasets which are partially conformant may nonetheless be modified in memory.

The cf package can:

  • read field constructs and domain constructs from netCDF, CDL, PP and UM datasets,

  • create new field and domain constructs in memory,

  • inspect field and domain constructs,

  • test whether two constructs are the same,

  • modify field and domain construct metadata and data,

  • create subspaces of field and domain constructs,

  • write and append field constructs to netCDF datasets on disk,

  • incorporate, and create, metadata stored in external files (new in version 3.0.0),

  • read, write, and create data that have been compressed by convention (i.e. ragged or gathered arrays), whilst presenting a view of the data in its uncompressed form,

  • read, write, and create coordinates defined by geometry cells,

  • read netCDF and CDL datasets containing hierarchical groups,

  • combine field constructs arithmetically,

  • manipulate field construct data by arithmetical and trigonometrical operations,

  • perform statistical collapses on field constructs,

  • perform histogram, percentile and binning operations on field constructs,

  • regrid field constructs with (multi-)linear, nearest neighbour, first- and second-order conservative and higher order patch recovery methods,

  • apply convolution filters to field constructs,

  • calculate derivatives of field constructs,

  • create field constructs to create derived quantities (such as vorticity).

All of the above use LAMA functionality, which allows multiple fields larger than the available memory to exist and be manipulated. (Note: work is underway to replace this functionality with a dask implementation.)


Powerful, flexible, and very simple to produce visualizations of field constructs are available with the cfplot package (, that needs to be installed seprately to the cf package.

See the cfplot gallery ( for the full range range plotting possibilities with example code.

Command line utilities

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.


Tests are run from within the cf/test directory:


Project details

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cf-python-3.13.0.tar.gz (1.6 MB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page