Logo Iris 1.12

Previous topic

iris.fileformats.abf

Next topic

iris.fileformats.dot

This Page

iris.fileformats.cf

Provides the capability to load netCDF files and interprete them according to the ‘NetCDF Climate and Forecast (CF) Metadata Conventions’.

References:

[CF] NetCDF Climate and Forecast (CF) Metadata conventions, Version 1.5, October, 2010. [NUG] NetCDF User’s Guide, http://www.unidata.ucar.edu/software/netcdf/docs/netcdf.html

In this module:

A CF-netCDF ancillary data variable is a variable that provides metadata about the individual values of another data variable.

Identified by the CF-netCDF variable attribute ‘ancillary_variables’.

Ref: [CF] Section 3.4. Ancillary Data.

class iris.fileformats.cf.CFAncillaryDataVariable(name, data)

Bases: iris.fileformats.cf.CFVariable

A CF-netCDF ancillary data variable is a variable that provides metadata about the individual values of another data variable.

Identified by the CF-netCDF variable attribute ‘ancillary_variables’.

Ref: [CF] Section 3.4. Ancillary Data.

add_formula_term(root, term)

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Args:

  • root (string):

    The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (string):

    The associated term name of this variable in the formula_terms definition.

Returns:
None.
cf_attrs()

Return a list of all attribute name and value pairs of the CF-netCDF variable.

cf_attrs_ignored()

Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.

cf_attrs_reset()

Reset the history of accessed attribute names of the CF-netCDF variable.

cf_attrs_unused()

Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.

cf_attrs_used()

Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.

has_formula_terms()

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Returns:
Boolean.
classmethod identify(variables, ignore=None, target=None, warn=True)
spans(cf_variable)

Determine whether the dimensionality of this variable is a subset of the specified target variable.

Note that, by default scalar variables always span the dimensionality of the target variable.

Args:

  • cf_variable:

    Compare dimensionality with the CFVariable.

Returns:
Boolean.
cf_identity = 'ancillary_variables'

↑ top ↑

A CF-netCDF auxiliary coordinate variable is any netCDF variable that contains coordinate data, but is not a CF-netCDF coordinate variable by definition.

There is no relationship between the name of a CF-netCDF auxiliary coordinate variable and the name(s) of its dimension(s).

Identified by the CF-netCDF variable attribute ‘coordinates’. Also see iris.fileformats.cf.CFLabelVariable.

Ref: [CF] Chapter 5. Coordinate Systems.
[CF] Section 6.2. Alternative Coordinates.
class iris.fileformats.cf.CFAuxiliaryCoordinateVariable(name, data)

Bases: iris.fileformats.cf.CFVariable

A CF-netCDF auxiliary coordinate variable is any netCDF variable that contains coordinate data, but is not a CF-netCDF coordinate variable by definition.

There is no relationship between the name of a CF-netCDF auxiliary coordinate variable and the name(s) of its dimension(s).

Identified by the CF-netCDF variable attribute ‘coordinates’. Also see iris.fileformats.cf.CFLabelVariable.

Ref: [CF] Chapter 5. Coordinate Systems.
[CF] Section 6.2. Alternative Coordinates.
add_formula_term(root, term)

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Args:

  • root (string):

    The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (string):

    The associated term name of this variable in the formula_terms definition.

Returns:
None.
cf_attrs()

Return a list of all attribute name and value pairs of the CF-netCDF variable.

cf_attrs_ignored()

Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.

cf_attrs_reset()

Reset the history of accessed attribute names of the CF-netCDF variable.

cf_attrs_unused()

Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.

cf_attrs_used()

Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.

has_formula_terms()

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Returns:
Boolean.
classmethod identify(variables, ignore=None, target=None, warn=True)
spans(cf_variable)

Determine whether the dimensionality of this variable is a subset of the specified target variable.

Note that, by default scalar variables always span the dimensionality of the target variable.

Args:

  • cf_variable:

    Compare dimensionality with the CFVariable.

Returns:
Boolean.
cf_identity = 'coordinates'

↑ top ↑

A CF-netCDF boundary variable is associated with a CF-netCDF variable that contains coordinate data. When a data value provides information about conditions in a cell occupying a region of space/time or some other dimension, the boundary variable provides a description of cell extent.

A CF-netCDF boundary variable will have one more dimension than its associated CF-netCDF coordinate variable or CF-netCDF auxiliary coordinate variable.

Identified by the CF-netCDF variable attribute ‘bounds’.

Ref: [CF] Section 7.1. Cell Boundaries.

class iris.fileformats.cf.CFBoundaryVariable(name, data)

Bases: iris.fileformats.cf.CFVariable

A CF-netCDF boundary variable is associated with a CF-netCDF variable that contains coordinate data. When a data value provides information about conditions in a cell occupying a region of space/time or some other dimension, the boundary variable provides a description of cell extent.

A CF-netCDF boundary variable will have one more dimension than its associated CF-netCDF coordinate variable or CF-netCDF auxiliary coordinate variable.

Identified by the CF-netCDF variable attribute ‘bounds’.

Ref: [CF] Section 7.1. Cell Boundaries.

add_formula_term(root, term)

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Args:

  • root (string):

    The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (string):

    The associated term name of this variable in the formula_terms definition.

Returns:
None.
cf_attrs()

Return a list of all attribute name and value pairs of the CF-netCDF variable.

cf_attrs_ignored()

Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.

cf_attrs_reset()

Reset the history of accessed attribute names of the CF-netCDF variable.

cf_attrs_unused()

Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.

cf_attrs_used()

Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.

has_formula_terms()

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Returns:
Boolean.
classmethod identify(variables, ignore=None, target=None, warn=True)
spans(cf_variable)

Determine whether the dimensionality of this variable is a subset of the specified target variable.

Note that, by default scalar variables always span the dimensionality of the target variable.

Args:

  • cf_variable:

    Compare dimensionality with the CFVariable.

Returns:
Boolean.
cf_identity = 'bounds'

↑ top ↑

A CF-netCDF climatology variable is associated with a CF-netCDF variable that contains coordinate data. When a data value provides information about conditions in a cell occupying a region of space/time or some other dimension, the climatology variable provides a climatological description of cell extent.

A CF-netCDF climatology variable will have one more dimension than its associated CF-netCDF coordinate variable.

Identified by the CF-netCDF variable attribute ‘climatology’.

Ref: [CF] Section 7.4. Climatological Statistics

class iris.fileformats.cf.CFClimatologyVariable(name, data)

Bases: iris.fileformats.cf.CFVariable

A CF-netCDF climatology variable is associated with a CF-netCDF variable that contains coordinate data. When a data value provides information about conditions in a cell occupying a region of space/time or some other dimension, the climatology variable provides a climatological description of cell extent.

A CF-netCDF climatology variable will have one more dimension than its associated CF-netCDF coordinate variable.

Identified by the CF-netCDF variable attribute ‘climatology’.

Ref: [CF] Section 7.4. Climatological Statistics

add_formula_term(root, term)

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Args:

  • root (string):

    The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (string):

    The associated term name of this variable in the formula_terms definition.

Returns:
None.
cf_attrs()

Return a list of all attribute name and value pairs of the CF-netCDF variable.

cf_attrs_ignored()

Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.

cf_attrs_reset()

Reset the history of accessed attribute names of the CF-netCDF variable.

cf_attrs_unused()

Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.

cf_attrs_used()

Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.

has_formula_terms()

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Returns:
Boolean.
classmethod identify(variables, ignore=None, target=None, warn=True)
spans(cf_variable)

Determine whether the dimensionality of this variable is a subset of the specified target variable.

Note that, by default scalar variables always span the dimensionality of the target variable.

Args:

  • cf_variable:

    Compare dimensionality with the CFVariable.

Returns:
Boolean.
cf_identity = 'climatology'

↑ top ↑

A CF-netCDF coordinate variable is a one-dimensional variable with the same name as its dimension, and it is defined as a numeric data type with values that are ordered monotonically. Missing values are not allowed in CF-netCDF coordinate variables. Also see [NUG] Section 2.3.1.

Identified by the above criterion, there is no associated CF-netCDF variable attribute.

Ref: [CF] 1.2. Terminology.

class iris.fileformats.cf.CFCoordinateVariable(name, data)

Bases: iris.fileformats.cf.CFVariable

A CF-netCDF coordinate variable is a one-dimensional variable with the same name as its dimension, and it is defined as a numeric data type with values that are ordered monotonically. Missing values are not allowed in CF-netCDF coordinate variables. Also see [NUG] Section 2.3.1.

Identified by the above criterion, there is no associated CF-netCDF variable attribute.

Ref: [CF] 1.2. Terminology.

add_formula_term(root, term)

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Args:

  • root (string):

    The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (string):

    The associated term name of this variable in the formula_terms definition.

Returns:
None.
cf_attrs()

Return a list of all attribute name and value pairs of the CF-netCDF variable.

cf_attrs_ignored()

Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.

cf_attrs_reset()

Reset the history of accessed attribute names of the CF-netCDF variable.

cf_attrs_unused()

Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.

cf_attrs_used()

Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.

has_formula_terms()

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Returns:
Boolean.
classmethod identify(variables, ignore=None, target=None, warn=True, monotonic=False)
spans(cf_variable)

Determine whether the dimensionality of this variable is a subset of the specified target variable.

Note that, by default scalar variables always span the dimensionality of the target variable.

Args:

  • cf_variable:

    Compare dimensionality with the CFVariable.

Returns:
Boolean.
cf_identity = None

↑ top ↑

A CF-netCDF variable containing data pay-load that maps to an Iris iris.cube.Cube.

class iris.fileformats.cf.CFDataVariable(name, data)

Bases: iris.fileformats.cf.CFVariable

A CF-netCDF variable containing data pay-load that maps to an Iris iris.cube.Cube.

add_formula_term(root, term)

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Args:

  • root (string):

    The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (string):

    The associated term name of this variable in the formula_terms definition.

Returns:
None.
cf_attrs()

Return a list of all attribute name and value pairs of the CF-netCDF variable.

cf_attrs_ignored()

Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.

cf_attrs_reset()

Reset the history of accessed attribute names of the CF-netCDF variable.

cf_attrs_unused()

Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.

cf_attrs_used()

Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.

has_formula_terms()

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Returns:
Boolean.
classmethod identify(variables, ignore=None, target=None, warn=True)
spans(cf_variable)

Determine whether the dimensionality of this variable is a subset of the specified target variable.

Note that, by default scalar variables always span the dimensionality of the target variable.

Args:

  • cf_variable:

    Compare dimensionality with the CFVariable.

Returns:
Boolean.
cf_identity = None

↑ top ↑

A CF-netCDF grid mapping variable contains a list of specific attributes that define a particular grid mapping. A CF-netCDF grid mapping variable must contain the attribute ‘grid_mapping_name’.

Based on the value of the ‘grid_mapping_name’ attribute, there are associated standard names of CF-netCDF coordinate variables that contain the mapping’s independent variables.

Identified by the CF-netCDF variable attribute ‘grid_mapping’.

Ref: [CF] Section 5.6. Horizontal Coordinate Reference Systems, Grid Mappings, and Projections.
[CF] Appendix F. Grid Mappings.
class iris.fileformats.cf.CFGridMappingVariable(name, data)

Bases: iris.fileformats.cf.CFVariable

A CF-netCDF grid mapping variable contains a list of specific attributes that define a particular grid mapping. A CF-netCDF grid mapping variable must contain the attribute ‘grid_mapping_name’.

Based on the value of the ‘grid_mapping_name’ attribute, there are associated standard names of CF-netCDF coordinate variables that contain the mapping’s independent variables.

Identified by the CF-netCDF variable attribute ‘grid_mapping’.

Ref: [CF] Section 5.6. Horizontal Coordinate Reference Systems, Grid Mappings, and Projections.
[CF] Appendix F. Grid Mappings.
add_formula_term(root, term)

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Args:

  • root (string):

    The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (string):

    The associated term name of this variable in the formula_terms definition.

Returns:
None.
cf_attrs()

Return a list of all attribute name and value pairs of the CF-netCDF variable.

cf_attrs_ignored()

Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.

cf_attrs_reset()

Reset the history of accessed attribute names of the CF-netCDF variable.

cf_attrs_unused()

Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.

cf_attrs_used()

Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.

has_formula_terms()

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Returns:
Boolean.
classmethod identify(variables, ignore=None, target=None, warn=True)
spans(cf_variable)

Determine whether the dimensionality of this variable is a subset of the specified target variable.

Note that, by default scalar variables always span the dimensionality of the target variable.

Args:

  • cf_variable:

    Compare dimensionality with the CFVariable.

Returns:
Boolean.
cf_identity = 'grid_mapping'

↑ top ↑

Represents a collection of ‘NetCDF Climate and Forecast (CF) Metadata Conventions’ variables and netCDF global attributes.

class iris.fileformats.cf.CFGroup

Bases: _abcoll.MutableMapping, object

Represents a collection of ‘NetCDF Climate and Forecast (CF) Metadata Conventions’ variables and netCDF global attributes.

clear() → None. Remove all items from D.
get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → list of D's (key, value) pairs, as 2-tuples
iteritems() → an iterator over the (key, value) items of D
iterkeys() → an iterator over the keys of D
itervalues() → an iterator over the values of D
keys()

Return the names of all the CF-netCDF variables in the group.

pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() → (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) → None. Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() → list of D's values
ancillary_variables

Collection of CF-netCDF ancillary variables.

auxiliary_coordinates

Collection of CF-netCDF auxiliary coordinate variables.

bounds

Collection of CF-netCDF boundary variables.

cell_measures

Collection of CF-netCDF measure variables.

climatology

Collection of CF-netCDF climatology variables.

coordinates

Collection of CF-netCDF coordinate variables.

data_variables

Collection of CF-netCDF data pay-load variables.

formula_terms

Collection of CF-netCDF variables that participate in a CF-netCDF formula term.

global_attributes = None

Collection of netCDF global attributes

grid_mappings

Collection of CF-netCDF grid mapping variables.

labels

Collection of CF-netCDF label variables.

promoted = None

Collection of CF-netCDF variables promoted to a CFDataVariable.

↑ top ↑

A CF-netCDF CF label variable is any netCDF variable that contain string textual information, or labels.

Identified by the CF-netCDF variable attribute ‘coordinates’. Also see iris.fileformats.cf.CFAuxiliaryCoordinateVariable.

Ref: [CF] Section 6.1. Labels.

class iris.fileformats.cf.CFLabelVariable(name, data)

Bases: iris.fileformats.cf.CFVariable

A CF-netCDF CF label variable is any netCDF variable that contain string textual information, or labels.

Identified by the CF-netCDF variable attribute ‘coordinates’. Also see iris.fileformats.cf.CFAuxiliaryCoordinateVariable.

Ref: [CF] Section 6.1. Labels.

add_formula_term(root, term)

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Args:

  • root (string):

    The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (string):

    The associated term name of this variable in the formula_terms definition.

Returns:
None.
cf_attrs()

Return a list of all attribute name and value pairs of the CF-netCDF variable.

cf_attrs_ignored()

Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.

cf_attrs_reset()

Reset the history of accessed attribute names of the CF-netCDF variable.

cf_attrs_unused()

Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.

cf_attrs_used()

Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.

cf_label_data(cf_data_var)

Return the associated CF-netCDF label variable strings.

Args:

Returns:
String labels.
cf_label_dimensions(cf_data_var)

Return the name of the associated CF-netCDF label variable data dimensions.

Args:

Returns:
Tuple of label data dimension names.
has_formula_terms()

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Returns:
Boolean.
classmethod identify(variables, ignore=None, target=None, warn=True)
spans(cf_variable)

Determine whether the dimensionality of this variable is a subset of the specified target variable.

Note that, by default scalar variables always span the dimensionality of the target variable.

Args:

  • cf_variable:

    Compare dimensionality with the CFVariable.

Returns:
Boolean.
cf_identity = 'coordinates'

↑ top ↑

A CF-netCDF measure variable is a variable that contains cell areas or volumes.

Identified by the CF-netCDF variable attribute ‘cell_measures’.

Ref: [CF] Section 7.2. Cell Measures.

class iris.fileformats.cf.CFMeasureVariable(name, data, measure)

Bases: iris.fileformats.cf.CFVariable

A CF-netCDF measure variable is a variable that contains cell areas or volumes.

Identified by the CF-netCDF variable attribute ‘cell_measures’.

Ref: [CF] Section 7.2. Cell Measures.

add_formula_term(root, term)

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Args:

  • root (string):

    The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (string):

    The associated term name of this variable in the formula_terms definition.

Returns:
None.
cf_attrs()

Return a list of all attribute name and value pairs of the CF-netCDF variable.

cf_attrs_ignored()

Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.

cf_attrs_reset()

Reset the history of accessed attribute names of the CF-netCDF variable.

cf_attrs_unused()

Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.

cf_attrs_used()

Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.

has_formula_terms()

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Returns:
Boolean.
classmethod identify(variables, ignore=None, target=None, warn=True)
spans(cf_variable)

Determine whether the dimensionality of this variable is a subset of the specified target variable.

Note that, by default scalar variables always span the dimensionality of the target variable.

Args:

  • cf_variable:

    Compare dimensionality with the CFVariable.

Returns:
Boolean.
cf_identity = 'cell_measures'
cf_measure = None

Associated cell measure of the cell variable

↑ top ↑

This class allows the contents of a netCDF file to be interpreted according to the ‘NetCDF Climate and Forecast (CF) Metadata Conventions’.

class iris.fileformats.cf.CFReader(filename, warn=False, monotonic=False)

Bases: object

This class allows the contents of a netCDF file to be interpreted according to the ‘NetCDF Climate and Forecast (CF) Metadata Conventions’.

cf_group = None

Collection of CF-netCDF variables associated with this netCDF file

↑ top ↑

Abstract base class wrapper for a CF-netCDF variable.

class iris.fileformats.cf.CFVariable(name, data)

Bases: object

Abstract base class wrapper for a CF-netCDF variable.

add_formula_term(root, term)

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Args:

  • root (string):

    The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (string):

    The associated term name of this variable in the formula_terms definition.

Returns:
None.
cf_attrs()

Return a list of all attribute name and value pairs of the CF-netCDF variable.

cf_attrs_ignored()

Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.

cf_attrs_reset()

Reset the history of accessed attribute names of the CF-netCDF variable.

cf_attrs_unused()

Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.

cf_attrs_used()

Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.

has_formula_terms()

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Returns:
Boolean.
identify(variables, ignore=None, target=None, warn=True)

Identify all variables that match the criterion for this CF-netCDF variable class.

Args:

  • variables:

    Dictionary of netCDF4.Variable instance by variable name.

Kwargs:

  • ignore:

    List of variable names to ignore.

  • target:

    Name of a single variable to check.

  • warn:

    Issue a warning if a missing variable is referenced.

Returns:
Dictionary of CFVariable instance by variable name.
spans(cf_variable)

Determine whether the dimensionality of this variable is a subset of the specified target variable.

Note that, by default scalar variables always span the dimensionality of the target variable.

Args:

  • cf_variable:

    Compare dimensionality with the CFVariable.

Returns:
Boolean.
cf_data = None

NetCDF4 Variable data instance.

cf_group = None

Collection of CF-netCDF variables associated with this variable.

cf_identity = None

Name of the netCDF variable attribute that identifies this CF-netCDF variable.

cf_name = None

NetCDF variable name.

cf_terms_by_root = None

CF-netCDF formula terms that his variable participates in.