cfdm

Fully implements the CF data model for its internal data structures and so is able to process any CF-compliant dataset.
https://github.com/ncas-cms/cfdm

Category: Climate Change
Sub Category: Climate Data Standards

Keywords

aggregation atmosphere cf climate dask data data-compression forecasting metadata netcdf ocean python ugrid zarr

Keywords from Contributors

cfdm cfunits earth-science pp um atmospheric-science archival udunits2 units earth-system-model

Last synced: about 3 hours ago
JSON representation

Repository metadata

A Python reference implementation of the CF data model

README.md

cfdm

A Python reference implementation of the CF data model.

GitHub tag (latest by date)
PyPI
Conda

Conda
Website
GitHub

Codecov
GitHub Workflow Status

fair-software.eu

References

Website
Website
Website

Documentation

https://ncas-cms.github.io/cfdm

Dask

From version 1.11.2.0 the cfdm package uses
Dask for all of its data manipulations.

Installation

https://ncas-cms.github.io/cfdm/installation

Tutorial

https://ncas-cms.github.io/cfdm/tutorial

Functionality

The cfdm package fully 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 central elements defined by the CF data model are the field
construct
, which corresponds to CF-netCDF data variable with all of
its metadata; and the domain contruct, which may be the domain of
a field construct or corresponds to a CF-netCDF domain variable with
all of its metadata.

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

>>> import cfdm
>>> f = cfdm.read('file.nc')
>>> 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 and domain constructs from netCDF, CDL, and Zarr datasets
    with a choice of netCDF backends, and in local, http, and s3 locations,
  • be fully flexible with respect to HDF5 chunking,
  • create new field and domain constructs in memory,
  • write and append field and domain constructs to netCDF datasets on disk,
  • read, write, and manipulate UGRID mesh topologies,
  • read, write, and create coordinates defined by geometry cells,
  • read and write netCDF4 string data-type variables,
  • read, write, and create netCDF and CDL datasets containing
    hierarchical groups,
  • 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, from indices or
    metadata values,
  • incorporate, and create, metadata stored in external files, and
  • read, write, and create data that have been compressed by convention
    (i.e. ragged or gathered arrays, or coordinate arrays compressed by
    subsampling), whilst presenting a view of the data in its
    uncompressed form,
  • read and write that data that are quantized to eliminate false
    precision.

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:

$ cfdump file.nc
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

Tests

Tests are run from within the cfdm/test directory:

$ python run_tests.py

Citation

If you use cfdm, either as a stand-alone application or to provide a CF
data model implementation to another software library, please consider
including the reference:

Hassell et al., (2020). cfdm: A Python reference implementation of the
CF data model. Journal of Open Source Software, 5(54), 2717,
https://doi.org/10.21105/joss.02717

@article{Hassell2020,
  doi = {10.21105/joss.02717},
  url = {https://doi.org/10.21105/joss.02717},
  year = {2020},
  publisher = {The Open Journal},
  volume = {5},
  number = {54},
  pages = {2717},
  author = {David Hassell and Sadie L. Bartholomew},
  title = {cfdm: A Python reference implementation of the CF data model},
  journal = {Journal of Open Source Software}
}

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 3,128
Total Committers: 4
Avg Commits per committer: 782.0
Development Distribution Score (DDS): 0.175

Commits in past year: 196
Committers in past year: 2
Avg Commits per committer in past year: 98.0
Development Distribution Score (DDS) in past year: 0.148

Name Email Commits
David Hassell d****l@n****k 2580
Sadie Louise Bartholomew s****w@n****k 541
Ankit Bhandekar 8****t 6
William McGinty 3****S 1

Committer domains:


Issue and Pull Request metadata

Last synced: 3 days ago

Total issues: 109
Total pull requests: 165
Average time to close issues: about 1 month
Average time to close pull requests: 12 days
Total issue authors: 4
Total pull request authors: 3
Average comments per issue: 0.96
Average comments per pull request: 1.42
Merged pull request: 146
Bot issues: 0
Bot pull requests: 0

Past year issues: 30
Past year pull requests: 39
Past year average time to close issues: 15 days
Past year average time to close pull requests: 9 days
Past year issue authors: 2
Past year pull request authors: 2
Past year average comments per issue: 0.87
Past year average comments per pull request: 0.38
Past year merged pull request: 27
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/ncas-cms/cfdm

Top Issue Authors

  • davidhassell (82)
  • sadielbartholomew (24)
  • martinjuckes (2)
  • JonathanGregory (1)

Top Pull Request Authors

  • davidhassell (144)
  • sadielbartholomew (19)
  • bewithankit (2)

Top Issue Labels

  • enhancement (55)
  • bug (38)
  • netCDF read (30)
  • netCDF write (30)
  • code tidy/refactor (8)
  • performance (7)
  • dataset read (6)
  • question (6)
  • dask (5)
  • documentation (4)
  • dataset write (4)
  • compression (3)
  • UGRID (3)
  • testing (1)
  • data model (1)
  • CFA (1)
  • aggregation (1)
  • dependency (1)

Top Pull Request Labels

  • enhancement (31)
  • netCDF write (24)
  • netCDF read (21)
  • bug (13)
  • documentation (12)
  • dataset read (8)
  • code tidy/refactor (7)
  • performance (7)
  • dask (6)
  • dataset write (6)
  • testing (6)
  • compression (5)
  • GitHub actions (5)
  • UGRID (2)
  • linting (2)
  • dependency (2)
  • release (1)
  • CFA (1)
  • aggregation (1)

Package metadata

pypi.org: cfdm

A Python reference implementation of the CF data model

  • Homepage: https://ncas-cms.github.io/cfdm
  • Documentation: https://cfdm.readthedocs.io/
  • Licenses: MIT
  • Latest release: 1.8.5 (published over 5 years ago)
  • Last Synced: 2025-12-22T03:03:57.548Z (3 days ago)
  • Versions: 56
  • Dependent Packages: 0
  • Dependent Repositories: 4
  • Downloads: 7,580 Last month
  • Docker Downloads: 0
  • Rankings:
    • Docker downloads count: 3.658%
    • Dependent repos count: 7.481%
    • Average: 9.175%
    • Dependent packages count: 10.126%
    • Forks count: 10.896%
    • Downloads: 10.974%
    • Stargazers count: 11.915%
  • Maintainers (2)
conda-forge.org: cfdm

  • Homepage: https://ncas-cms.github.io/cfdm
  • Licenses: MIT
  • Latest release: 1.8.5 (published over 5 years ago)
  • Last Synced: 2025-12-22T03:04:03.458Z (3 days ago)
  • Versions: 14
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 28.82%
    • Average: 31.423%
    • Dependent repos count: 34.025%

Dependencies

.github/workflows/linting.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pre-commit/action v2.0.0 composite
.github/workflows/run-test-suite.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v1 composite
  • codecov/codecov-action v1 composite
  • conda-incubator/setup-miniconda v2 composite
requirements.txt pypi
  • cftime >=1.6.0
  • netCDF4 >=1.5.4
  • netcdf-flattener >=1.2.0
  • numpy >=1.15
  • packaging >=20.0
pyproject.toml pypi
setup.py pypi

Score: 14.651219236744296