cf-python
A CF-compliant Earth Science data analysis library.
https://github.com/ncas-cms/cf-python
Category: Climate Change
Sub Category: Climate Data Standards
Keywords
cf cfdm cfunits data-analysis earth-science metadata netcdf pp python um
Keywords from Contributors
climate earth-system-model atmospheric-science data-compression hydrology ocean aggregation ugrid zarr archival
Last synced: about 12 hours ago
JSON representation
Repository metadata
A CF-compliant Earth Science data analysis library
- Host: GitHub
- URL: https://github.com/ncas-cms/cf-python
- Owner: NCAS-CMS
- License: mit
- Created: 2019-09-13T08:57:37.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2026-08-03T16:01:13.000Z (11 days ago)
- Last Synced: 2026-08-12T14:30:40.754Z (3 days ago)
- Topics: cf, cfdm, cfunits, data-analysis, earth-science, metadata, netcdf, pp, python, um
- Language: Python
- Homepage: http://ncas-cms.github.io/cf-python
- Size: 159 MB
- Stars: 151
- Watchers: 3
- Forks: 23
- Open Issues: 130
- Releases: 25
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.rst
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
README.md
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.
References
Dask
From version 3.14.0 the cf package uses
Dask for all of its data manipulations.
Documentation
http://ncas-cms.github.io/cf-python
Installation
http://ncas-cms.github.io/cf-python/installation.html
Cheat Sheet
https://ncas-cms.github.io/cf-python/cheat_sheet.html
Recipes
https://ncas-cms.github.io/cf-python/recipes
Tutorial
https://ncas-cms.github.io/cf-python/tutorial.html
Functionality
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.
A simple example of reading a field construct from a file and
inspecting it:
>>> import cf
>>> f = cf.read('file.nc')
>>> 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) = [1991-11-16 00:00:00, ..., 1991-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 cf package uses
Dask for all
of its array manipulation and can:
- read field constructs from netCDF, CDL, Zarr, Kerchunk, PP and UM
datasets with a choice of netCDF backends, and in local, http, and
s3 locations, - create new field constructs in memory,
- write and append field and domain constructs to netCDF and Zarr v3
datasets on disk, with control over HDF5 internal file metadata, - read, create, and manipulate UGRID mesh topologies,
- read, write, and manipulate HEALPix grids,
- read, write, and create coordinates defined by geometry cells,
- 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, or coordinate arrays compressed by
subsampling), whilst presenting a view of the data in its
uncompressed form, - combine field constructs arithmetically,
- manipulate field construct data by arithmetical and trigonometrical
operations, - perform weighted statistical collapses on field constructs,
including those with geometry cells, UGRID mesh topologies, and
HEALPix grids, - perform histogram, percentile and binning operations on field
constructs, - regrid structured grid, UGRID, HEALPix, and DSG field constructs
with (multi-)linear, nearest neighbour, first- and second-order
conservative and higher order patch recovery methods, including 3-d
regridding, and large-grid support, - apply convolution filters to field constructs,
- create running means from field constructs,
- apply differential operators to field constructs,
- create derived quantities (such as relative vorticity),
- read and write data that are quantized to eliminate false
precision.
Visualization
Powerful and flexible visualizations of cf field constructs,
designed to be produced and configured in as few lines of code as
possible, are available with the cf-plot
package, which needs to be
installed separately to the cf package.

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
Tests are run from within the cf/test directory:
python run_tests.py
Training
Training material on cf-python and cf-plot i.e. the CF Data Tools,
in the form of Jupyter Notebooks, is openly-accessible and available
(with instructions for set-up provided) at:
https://github.com/NCAS-CMS/cf-tools-training.
Owner metadata
- Name: NCAS CMS
- Login: NCAS-CMS
- Email:
- Kind: organization
- Description: Useful tools to support NERC weather and climate research
- Website: http://cms.ncas.ac.uk/
- Location: UK
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/31280705?v=4
- Repositories: 10
- Last ynced at: 2023-03-02T02:05:18.504Z
- Profile URL: https://github.com/NCAS-CMS
GitHub Events
Total
- Release event: 2
- Delete event: 1
- Pull request event: 68
- Fork event: 2
- Issues event: 66
- Watch event: 16
- Issue comment event: 106
- Push event: 66
- Pull request review comment event: 99
- Pull request review event: 109
- Create event: 3
Last Year
- Delete event: 1
- Pull request event: 24
- Issues event: 27
- Watch event: 2
- Issue comment event: 29
- Push event: 26
- Pull request review event: 9
- Pull request review comment event: 13
Committers metadata
Last synced: 5 days ago
Total Commits: 4,638
Total Committers: 15
Avg Commits per committer: 309.2
Development Distribution Score (DDS): 0.323
Commits in past year: 287
Committers in past year: 4
Avg Commits per committer in past year: 71.75
Development Distribution Score (DDS) in past year: 0.481
| Name | Commits | |
|---|---|---|
| David Hassell | d****l@n****k | 3141 |
| Sadie Louise Bartholomew | s****w@n****k | 1211 |
| Ankit Bhandekar | 8****t | 219 |
| Thibault Hallouin | t****n@u****e | 13 |
| Oliver Kotla | 5****t | 11 |
| Bruno P. Kinoshita | k****w | 11 |
| Charles Roberts | c****s@r****k | 10 |
| Matt | m****3@g****m | 9 |
| Natalia Hunt | 5 | |
| copilot-swe-agent[bot] | 1****t | 2 |
| Tyge Løvset | t****o@n****o | 2 |
| William McGinty | 3****S | 1 |
| Sharar-A | s****i@n****k | 1 |
| Alexander James Phillips | a****l@g****m | 1 |
| Alan Iwi | a****i@s****k | 1 |
Committer domains:
- ncas.ac.uk: 3
- stfc.ac.uk: 1
- norceresearch.no: 1
- reading.ac.uk: 1
- ucdconnect.ie: 1
Issue and Pull Request metadata
Last synced: 4 days ago
Total issues: 383
Total pull requests: 575
Average time to close issues: 3 months
Average time to close pull requests: 12 days
Total issue authors: 45
Total pull request authors: 11
Average comments per issue: 1.91
Average comments per pull request: 1.39
Merged pull request: 523
Bot issues: 0
Bot pull requests: 0
Past year issues: 22
Past year pull requests: 16
Past year average time to close issues: 29 days
Past year average time to close pull requests: 20 days
Past year issue authors: 10
Past year pull request authors: 3
Past year average comments per issue: 1.82
Past year average comments per pull request: 1.88
Past year merged pull request: 13
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- davidhassell (145)
- sadielbartholomew (130)
- bnlawrence (23)
- JonathanGregory (15)
- dlrhodson (8)
- bewithankit (6)
- ThibHlln (6)
- lguo-uk (3)
- ThatDesert (3)
- AJamesPhillips (3)
- matthew-shin (2)
- kinow (2)
- m-couldrey (2)
- ellgil82 (2)
- dwest77a (2)
Top Pull Request Authors
- davidhassell (405)
- sadielbartholomew (112)
- bewithankit (36)
- kinow (6)
- mattjbr123 (5)
- alaniwi (3)
- ThibHlln (2)
- tylov (2)
- ThatDesert (2)
- Sharar-A (1)
- AJamesPhillips (1)
Top Issue Labels
- enhancement (143)
- bug (116)
- question (37)
- documentation (31)
- aggregation (23)
- dask (22)
- testing (16)
- performance (16)
- um/pp (13)
- netCDF read (11)
- API review (4.0.0) (11)
- regridding (10)
- CFA (9)
- netCDF write (8)
- code tidy (8)
- installation (8)
- dataset write (6)
- GitHub Actions (6)
- bug? (6)
- release (4)
- dataset read (4)
- UGRID (3)
- CI (3)
- xarray (2)
- low priority (2)
- high priority (2)
- zarr (2)
- active storage (2)
- good first issue (1)
- dependency (1)
Top Pull Request Labels
- dask (196)
- enhancement (65)
- documentation (53)
- bug (48)
- low priority (28)
- code tidy (23)
- aggregation (17)
- regridding (15)
- performance (13)
- testing (11)
- high priority (9)
- CFA (8)
- dataset write (7)
- netCDF read (7)
- CI (6)
- installation (6)
- dataset read (6)
- netCDF write (6)
- release (4)
- um/pp (3)
- active storage (3)
- question (3)
- GitHub Actions (3)
- UGRID (3)
- linting (2)
- top priority (1)
- dependency (1)
- xarray (1)
- compression (1)
Package metadata
- Total packages: 1
-
Total downloads:
- pypi: 2,456 last-month
- Total dependent packages: 1
- Total dependent repositories: 9
- Total versions: 118
- Total maintainers: 2
pypi.org: cf-python
A CF-compliant earth science data analysis library
- Homepage: https://ncas-cms.github.io/cf-python
- Documentation: https://cf-python.readthedocs.io/
- Licenses: MIT
- Latest release: 3.20.1 (published about 1 month ago)
- Last Synced: 2026-08-13T14:05:01.532Z (1 day ago)
- Versions: 118
- Dependent Packages: 1
- Dependent Repositories: 9
- Downloads: 2,456 Last month
-
Rankings:
- Dependent packages count: 4.787%
- Dependent repos count: 4.847%
- Average: 7.042%
- Stargazers count: 7.771%
- Forks count: 8.544%
- Downloads: 9.262%
- Maintainers (2)
Dependencies
- cfdm >=1.9.0.2,<1.9.1.0
- cftime >=1.5.0
- cfunits >=3.3.4
- netCDF4 >=1.5.4
- numpy >=1.15
- packaging >=20.0
- psutil >=0.6.0
- ESMF >=8.0
- cfdm >=1.8.5,
- cftime >=1.1.3
- cfunits >=3.2.7
- matplotlib >=3.0.0
- mpi4py >=3.0.0
- netCDF4 >=1.5.3
- numpy >=1.15
- psutil >=0.6.0
- scipy >=1.1.0
- udunits2 ==2.2.25
- actions/checkout v3 composite
- actions/setup-python v4 composite
- pre-commit/action v3.0.0 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- codecov/codecov-action v3 composite
- conda-incubator/setup-miniconda v2 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- conda-incubator/setup-miniconda v2 composite
- continuumio/miniconda3 latest build
Score: 16.157568255461236