Skip to main content

A Python reference implementation of the CF data model

Project description

The cfdm Python package is a reference implementation of the CF data model, that identifies the fundamental elements of the CF conventions and shows how they relate to each other, independently of the netCDF encoding.

The central element defined by the CF data model is the field construct, which corresponds to a CF-netCDF data variable with all of its metadata.

A simple example of reading a field construct from a file and inspecting it:

>>> import cfdm
>>> f ='')
>>> f
[<Field: air_temperature(time(12), latitude(64), longitude(128)) K>]
>>> print(f[0])
Field: air_temperature (ncvar%tas)
Data            : air_temperature(time(12), latitude(64), longitude(128)) K
Cell methods    : time(12): mean (interval: 1.0 month)
Dimension coords: time(12) = [0450-11-16 00:00:00, ..., 0451-10-16 12:00:00] noleap
                : latitude(64) = [-87.8638, ..., 87.8638] degrees_north
                : longitude(128) = [0.0, ..., 357.1875] degrees_east
                : height(1) = [2.0] m

The cfdm package can

  • read field constructs from netCDF datasets,
  • create new field constructs in memory,
  • write field constructs to netCDF datasets on disk,
  • read netCDF and CDL datasets containing hierarchical groups,
  • inspect field constructs,
  • test whether two field constructs are the same,
  • modify field construct metadata and data,
  • create subspaces of field constructs,
  • incorporate, and create, metadata stored in external files,
  • 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, and
  • read, write, and create coordinates defined by geometry cells.

Command line utility

During installation the cfdump command line tool is also installed, which generates text descriptions of the field constructs contained in a netCDF dataset.

Source code

This project is hosted in a GitHub repository where you can access the most up-to-date source.

Project details

Download files

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

Files for cfdm, version
Filename, size File type Python version Upload date Hashes
Filename, size cfdm- (292.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page