As of 1st October 2019, the v3.0.0 (Python 3 only) cf-python home page has moved to https://ncas-cms.github.io/cf-python.
Python 2 versions of cf-python will remain here and in PyPi, but are no longer supported.
The python cf package implements the CF data model for the reading,
writing and processing of data and metadata.
CF is a netCDF convention which is in wide and growing use for the
storage of model-generated and observational data relating to the
atmosphere, ocean and Earth system.
With this package you can:
- Read CF-netCDF files,
CFA-netCDF
files and UK Met Office fields files and PP files.
- Create CF fields.
- Write fields to CF-netCDF and CFA-netCDF files on disk.
- Aggregate collections of fields into as few multidimensional
fields as possible using the CF aggregation rules.
- Create, delete and modify a field's data and metadata.
- Select and subspace fields according to their metadata.
- Perform broadcastable, metadata-aware arithmetic, comparison
and trigonometric operation with fields.
- Collapse fields by statistical operations.
- Sensibly deal with date-time data.
- Allow for cyclic axes.
- Regrid fields (which uses the ESMF library)
- Apply convolution filters to fields
- Visualize fields
with cf-plot.
All of the above use Large Amounts of Massive Arrays (LAMA)
functionality, which allows multiple fields larger than the available
memory to exist and be manipulated.
The package provides command line utilities for viewing CF fields
(cfdump
) and aggregating datasets
(cfa
).
New in version 2.3.4 (27 March 2019)
- Fixed bug
in
cf.Field.collapse
which occured when creating a new cell method when the axis is defined
by a long_name.
New in version 2.3.3 (05 March 2019)
- Allow failure to compile to go through with a warning, rather
than failing to install. if this happens, reading a PP/UM file
will result in, e.g., "Exception: Can't determine format of file
test.pp"
- Fixed bug in Field.convolution_filter giving false error over
units.
New in version 2.3.2 (10 December 2018)
cf.Field.regridc
now compares the units of the source and destination
grids and converts between them if possible or raises an error
if they are not equivalent.
New in version 2.3.1 (07 November 2018)
- Fixed bug
in
cf.Field.regridc
that caused it to fail when regridding a multidimensional field
along only one dimension.
- Fixed bug which in which the default logarithm base 10, rather
than base e
New in v Version 2.3.0 (22 October 2018)
- The collapse method can now be parallelised by running any
cf-python script with mpirun if mpi4py is installed. This is an
experimental feature and is not recommended for operational
use. None of the parallel code is executed when a script is run in
serial.
New in version 2.2.8 (28 August 2018)
- Bug fix: better handle subspacing by multiple multidimensional
items
New in version 2.2.7 (25 July 2018)
- Bug fix: correctly set units of bounds when the Data object
inserted with insert_bounds has units of ''. In this case the
bounds of the parent coordinate are now inherited.
New in version 2.2.6 - 24 July 2018
- Improved error messages
- Changed behaviour when printing reference times with a calendar
of "none" - no longer attemps a to create a date-time
representation
New in version 2.2.5 (02 July 2018)
- Fixed bug with HDF chunk sizes that prevented the writing of large files
New in version 2.2.4 (29 June 2018)
- Interim fix for with HDF chunk sizes that prevented the writing of large files
New in verson 2.2.3 (21 June 2018)
- During writing, disallow the creation of netCDF variable names
that contain characters other than letters, digits, and
underscores.
New in version 2.2.2 (06 June 2018)
- Fix for removing duplicated netCDF dimensions when writing data
on (e.g.) tripolar grids.
New in version 2.2.1 (05 June 2018)
- Fix for calculating are weights from projection coordinates
New in version 2.2.0 (04 June 2018)
- Updated for netCDF4 v1.4 cftime API changes
New in version 2.1.9 (31 May 2018)
- Allowed invalid units through. Can test with cf.Units.isvalid
New in version 2.1.8 (08 March 2018)
New in version 2.1.7 (13 February 2018)
- Fixed bug
in
cf.Field.collapse
when doing climatological time collapse with only one period per
year/day
New in version 2.1.6 (09 February 2018)
- Fixed bug in Variable.mask
New in version 2.1.4 (09 February 2018)
- Added override_calendar method to coordinates and domain
ancillaries that changes the calendar of the bounds, too
- Fixed bug in cf.Data.where when the condition is a
cf.Query
object
- Fixed bug in Variable.mask
New in version 2.1.3 (07 February 2018)
- Allowed scipy and matplotlib imports to be optional
New in version 2.1.2 (28 November 2017)
New in version 2.1.1 (10 November 2017)
- Dissallowed raising offset units to a power (e.g. taking the
square of data in units of K @ 273.15).
- Removed len() of Field (previously always, and misleadingly,
returned 1)
- Fixed setting of cell methods after climatological time collapses
- Added printing of ncvar
in
Field.__str__
and Field.dump.
- Added user stash table option to
cfa
script
New in version 2.1 (30 October 2017)
- Removed error when cf.read finds no fields - an empty field list is now returned
- Fix for memory leak when reading UM PP and fields files
- Added submodel property for PP files
- API change for cf.Field.axis: now returns a cf.DomainAxis object by default
- Changed default ouptut format to NETCDF4 (from NETCDF3_CLASSIC)
- Miscellaneous bug fixes
New in version 2.0 (07 July 2017)
- API and internal changes for the latest version of the CF data model.
- Subspace fields by providing conditions on multidimensional
coordinates and cell measures.
New in version 1.5 (24 February 2017)
- Changed weights
in
cf.Field.collapse
in calculation of variance and standard deviation to reliability
weights (from frequency weights).
- See
the change
log for further details.
New in version 1.4 (22 February 2017)
- Rounded datetime to time-since conversions to the nearest
microsecond, to reflect the accuracy of netCDF4.netcdftime
- Removed import tests from setup.py
- New parameter um to cf.read and option --um to cfa, cfdump
- See
the change
log for further details.
New in version 1.3.2 (21 September 2016)
- Changes to help with packaging the cf library
- See
the change
log for further details.
New in version 1.3.2 (21 September 2016)
- Changes to help with packaging the cf library
- See
the change
log for further details.
New in version 1.3.1 (09 September 2016)
New in version 1.3 (05 September 2016)
- New
method
convert_reference_time
for converting reference time data values to have new units,
particular useful when months are encoded but calendar months are
intended.
- Removed
asreftime
, asdatetime
and
dtvarray
methods.
- See
the change
log for further details.
New in version 1.2.3 (23 August 2016)
New in version 1.2 (5 July 2016)
- New
method
cf.Field.HDF_chunks
which allows HDF chunk sizes to be set. This functionality can also
be set via the HDF_chunks
parameter
to cf.write
.
- See
the change
log for further details.
New in version 1.1.11 (1 July 2016)
New in version 1.1.10 (23 June 2016)
- New parameter
reference_datetime
to cf.write
.
- Fixed bug which incorrectly ordered vertical coordinates when
reading UM files.
- See
the change
log for further details.
New in version 1.1.9 (17 June 2016)
- New
method
cf.Field.files
which report which files are referenced by the data array.
- Fix to determining cyclicity of regridded fields.
- Functionality to recursively read directories
in
cf.read
and the cfa
and cfdump
commands.
- Miscellaneous bug fixes.
- See
the change
log for further details.
New in version 1.1.8 (18 May 2016)
-
Added
--single
, --double
, --compress
, --no_shuffle
, --fletcher32
and --least_sig_digit
options to
the cfa
command line function.
- Changed the compression API to
cf.write
.
- Added functionality to
cf.write
to convert
data types when writing to disk.
- Removed annoying debug print statements.
- See
the change
log for further details.
New in version 1.1.7 (04 May 2016)
- Added function to load a user-defined STASH code to standard
name conversion table
(
cf.um.read.load_stash2standard_name
).
- Added fix for change in numpy behaviour
(
numpy.number
types do not support assignment).
- See
the change
log for further details.
New in version 1.1.6 (27 April 2016)
- Added the
--reference_datetime
option to
the cfa
command line function.
- Bug fix
to
cf.Field.collapse
when
providing cf.Query
objects via the group
parameter.
- See
the change
log for further details.
New in version 1.1.5 (03 March 2016)
conda
installation (with thanks to Andy Heaps)
- Nearest neighbour regridding in
cf.Field.regrids
- Bug fix
in
cf.Field.where
when
using cf.masked
- Bug fix for type casting
in
cf.Field.collapse
- Dispay long_name (instead of an internal id) if it exists and
there is no standard_name
- Fix for compiling the UM C code on certiain OSs (with thanks to
Simon Wilson)
- Fixed incorrect assignment of cyclicity
in
cf.Field.regrids
- See
the change
log for further details.
New in version 1.1.4 (09 February 2016)
- Bug fix
to
cf.Field.autocyclic
- Bug fix
to
cf.Field.clip
- now works when limit units are supplied
- New
methods:
cf.Data.round
, cf.Field.round
- Added lbtim as a Field property when reading UM files
- Fixed coordinate creation for UM atmosphere_hybrid_height_coordinate
- Bug fix to handling of cyclic fields by
cf.Field.regrids
.
- See
the change
log for further details.
New in version 1.1.3 (10 December 2015)
New in version 1.1 (28 October 2015)
New in version 1.0.3 (23 June 2015)
- Added the option for default missing data values.
- Minor bug fixes.
- See
the change
log for further details.
New in version 1.0.2 (05 June 2015)
- Install via PyPI:
pip
install cf-python
- See
the change
log for further details.
New in version 1.0 (27 May 2015):
- Mac OS support (ish)
- Limited multidimensional funtionality
to
Field.indices
- Correct treatment of add_offset and scale_factor
- Replaced
-a
with -x
in cfa
and cfdump
scripts
(which changes the default behaviour)
- Added ncvar_identities parameter
to
cf.aggregate
- Performance improvements to field subspacing
- Improved API
to
cf.Field.match
, cf.Field.select
, cf.Field.items
, cf.Field.axes
,
etc.
- Documentation updates
- Reads UM fields files
- Optimised reading of PP and UM fields files
cf.collapse
replaced
by cf.Field.collapse
cf.Field.collapse
includes CF climatological
time statistics
- See
the change
log for further details.
New in version 0.9.9.1 (09 January 2015):
- Added support for netCDF4-python versions after 1.1.1.
- Added
__mod__
, __imod__
, __rmod__
, ceil
, floor
, trunc
, rint
methods to cf.Data
and cf.Variable
- Added
ceil
, floor
, trunc
, rint
to cf.Data
and cf.Variable
- Fixed bug in which array
cf.Data.array
sometimes behaved like
cf.Data.varray
- Fixed bug in
cf.netcdf.read.read
which
affected reading fields with formula_terms
.
- Refactored the test suite to use the unittest package
- Cyclic axes functionality
- Documentation updates
- See
the change
log for further details.
New in version 0.9.8.3 (14 July 2014):
- Improved field aggregation performance and functionality.
- An even better treatment of CF "transforms"
(i.e.
grid_mapping
and formula_terms
),
including functionality for multiple grid_mappings.
- Bug fixes.
- See
the change
log for further details.
New in version 0.9.8 (06 December 2013) and 0.9.8.1 (20 December 2013):
- Improved API.
- Lots of speed and memory optimizations.
- A proper treatment of date-times.
- Some bug fixes and code restructuring.
- WGDOS-packed PP fields are unpacked on demand.
- A much better treatment of CF transforms (i.e.
grid_mapping
and
formula_terms
)
- Bug fixes
- See
the change
log for further details.
David Hassell. Hosted by Bitbucket.