cfdm

cfdm: A Python reference implementation of the CF data model - Published in JOSS (2020)

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

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 10 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
    2 of 4 committers (50.0%) from academic institutions
  • Institutional organization owner
    Organization ncas-cms has institutional domain (cms.ncas.ac.uk)
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

atmosphere atmospheric-science cf climate forecasting metadata netcdf ocean python

Scientific Fields

Engineering Computer Science - 40% confidence
Last synced: 4 months ago · JSON representation

Repository

A Python reference implementation of the CF data model

Basic Info
Statistics
  • Stars: 31
  • Watchers: 4
  • Forks: 12
  • Open Issues: 34
  • Releases: 22
Topics
atmosphere atmospheric-science cf climate forecasting metadata netcdf ocean python
Created about 7 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Support Codemeta

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

  • Name: NCAS CMS
  • Login: NCAS-CMS
  • Kind: organization
  • Location: UK

Useful tools to support NERC weather and climate research

JOSS Publication

cfdm: A Python reference implementation of the CF data model
Published
October 12, 2020
Volume 5, Issue 54, Page 2717
Authors
David Hassell ORCID
National Centre for Atmospheric Science, UK, University of Reading, UK
Sadie L. Bartholomew ORCID
National Centre for Atmospheric Science, UK, University of Reading, UK
Editor
Bruce E. Wilson ORCID
Tags
CF metadata climate meteorology oceanography

CodeMeta (codemeta.json)

{
  "@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld",
  "@type": "Code",
  "author": [
    {
      "@id": "https://orcid.org/0000-0001-5106-7502",
      "@type": "Person",
      "email": "david.hassell@ncas.ac.uk",
      "name": "David Hassell",
      "affiliation": "NCAS"
    },
    {
      "@id": "https://orcid.org/0000-0002-6180-3603",
      "@type": "Person",
      "email": "sadie.bartholomew@ncas.ac.uk",
      "name": "Sadie L. Bartholomew",
      "affiliation": "NCAS"
    }
  ],
  "identifier": "",
  "codeRepository": "https://github.com/NCAS-CMS/cfdm",
  "datePublished": "2025-10-15",
  "dateModified": "2025-10-15",
  "dateCreated": "2025-10-15",
  "description": "A Python reference implementation of the CF data model.",
  "keywords": "cf, metadata, netcdf, python",
  "license": "MIT",
  "title": "cfdm",
  "version": "1.12.3.1"
}

GitHub Events

Total
  • Create event: 6
  • Release event: 4
  • Issues event: 30
  • Watch event: 2
  • Issue comment event: 33
  • Push event: 26
  • Pull request review comment event: 58
  • Pull request review event: 62
  • Pull request event: 29
  • Fork event: 1
Last Year
  • Create event: 6
  • Release event: 4
  • Issues event: 30
  • Watch event: 2
  • Issue comment event: 33
  • Push event: 26
  • Pull request review comment event: 58
  • Pull request review event: 62
  • Pull request event: 29
  • Fork event: 1

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 3,078
  • Total Committers: 4
  • Avg Commits per committer: 769.5
  • Development Distribution Score (DDS): 0.173
Past Year
  • Commits: 342
  • Committers: 2
  • Avg Commits per committer: 171.0
  • Development Distribution Score (DDS): 0.035
Top Committers
Name Email Commits
David Hassell d****l@n****k 2,547
Sadie Louise Bartholomew s****w@n****k 524
Ankit Bhandekar 8****t 6
William McGinty 3****S 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 101
  • Total pull requests: 154
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 13 days
  • Total issue authors: 4
  • Total pull request authors: 3
  • Average comments per issue: 0.93
  • Average comments per pull request: 1.47
  • Merged pull requests: 140
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 22
  • Pull requests: 29
  • Average time to close issues: 16 days
  • Average time to close pull requests: 11 days
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 0.77
  • Average comments per pull request: 0.45
  • Merged pull requests: 22
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • davidhassell (75)
  • sadielbartholomew (23)
  • martinjuckes (2)
  • JonathanGregory (1)
Pull Request Authors
  • davidhassell (134)
  • sadielbartholomew (18)
  • bewithankit (2)
Top Labels
Issue Labels
enhancement (49) bug (37) netCDF read (30) netCDF write (30) code tidy/refactor (8) question (6) performance (5) dask (5) dataset read (5) documentation (4) dataset write (4) UGRID (3) compression (3) testing (1) CFA (1) aggregation (1)
Pull Request Labels
enhancement (25) netCDF write (24) netCDF read (21) documentation (12) bug (11) code tidy/refactor (7) testing (6) performance (6) dataset read (6) GitHub actions (5) compression (5) dask (5) dataset write (4) linting (2) CFA (1) UGRID (1) aggregation (1) release (1)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 1,258 last-month
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 4
    (may contain duplicates)
  • Total versions: 69
  • Total maintainers: 2
pypi.org: cfdm

A Python reference implementation of the CF data model

  • Versions: 55
  • Dependent Packages: 0
  • Dependent Repositories: 4
  • Downloads: 1,258 Last month
  • Docker Downloads: 0
Rankings
Docker downloads count: 3.7%
Dependent repos count: 7.5%
Average: 9.2%
Dependent packages count: 10.1%
Forks count: 10.9%
Downloads: 11.0%
Stargazers count: 11.9%
Last synced: 4 months ago
conda-forge.org: cfdm
  • Versions: 14
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent packages count: 28.8%
Average: 31.4%
Dependent repos count: 34.0%
Last synced: 4 months ago

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