Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Python reference implementation of the CF data model

License

NotificationsYou must be signed in to change notification settings

NCAS-CMS/cfdm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Python reference implementation of the CF data model at CF-1.11.

GitHub tag (latest by date)PyPIConda

CondaWebsiteGitHub

CodecovGitHub Workflow Status

fair-software.eu

References

WebsiteWebsiteWebsite

Documentation

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

Dask

From version 1.11.2.0 thecfdm package usesDask for all of its data manipulations.

Installation

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

Tutorial

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

Functionality

Thecfdm package fully implements theCF datamodelfor its internal data structures and so is able to process anyCF-compliant dataset. It is not strict about CF-compliance, however,so that partially conformant datasets may be ingested from existingdatasets and written to new datasets. This is so that datasets whichare partially conformant may nonetheless be modified in memory.

The central elements defined by the CF data model are thefieldconstruct, which corresponds to CF-netCDF data variable with all ofits metadata; and thedomain contruct, which may be the domain ofa field construct or corresponds to a CF-netCDF domain variable withall of its metadata.

A simple example of reading a field construct from a file andinspecting 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)) KCell 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

Thecfdm package can:

  • read field and domain constructs from netCDF and CDL datasets with achoice 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 containinghierarchical 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 ormetadata 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 bysubsampling), whilst presenting a view of the data in itsuncompressed form.

Command line utility

During installation thecfdump command line tool is also installed,which generates text descriptions of the field constructs contained ina netCDF dataset:

$ cfdump file.ncField: air_temperature (ncvar%tas)----------------------------------Data            : air_temperature(time(12), latitude(64), longitude(128)) KCell 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 thecfdm/test directory:

$ python run_tests.py

Citation

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

Hassell et al., (2020). cfdm: A Python reference implementation of theCF 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}}

[8]ページ先頭

©2009-2025 Movatter.jp