cfdm.Field¶
-
class
cfdm.
Field
(properties=None, source=None, copy=True, _use_data=True)[source]¶ Bases:
cfdm.mixin.netcdf.NetCDFVariable
,cfdm.mixin.netcdf.NetCDFGeometry
,cfdm.mixin.netcdf.NetCDFGlobalAttributes
,cfdm.mixin.netcdf.NetCDFGroupAttributes
,cfdm.mixin.netcdf.NetCDFComponents
,cfdm.mixin.netcdf.NetCDFUnreferenced
,cfdm.mixin.fielddomain.FieldDomain
,cfdm.mixin.propertiesdata.PropertiesData
,cfdm.mixin.files.Files
,cfdm.core.field.Field
A field construct of the CF data model.
The field construct is central to the CF data model, and includes all the other constructs. A field corresponds to a CF-netCDF data variable with all of its metadata. All CF-netCDF elements are mapped to a field construct or some element of the CF field construct. The field construct contains all the data and metadata which can be extracted from the file using the CF conventions.
The field construct consists of a data array and the definition of its domain (that describes the locations of each cell of the data array), field ancillary constructs containing metadata defined over the same domain, and cell method constructs to describe how the cell values represent the variation of the physical quantity within the cells of the domain. The domain is defined collectively by the following constructs of the CF data model: domain axis, dimension coordinate, auxiliary coordinate, cell measure, coordinate reference and domain ancillary constructs.
The field construct also has optional properties to describe aspects of the data that are independent of the domain. These correspond to some netCDF attributes of variables (e.g. units, long_name and standard_name), and some netCDF global file attributes (e.g. history and institution).
NetCDF interface
The netCDF variable name may be accessed with the
nc_set_variable
,nc_get_variable
,nc_del_variable
, andnc_has_variable
methods.The netCDF variable group structure may be accessed with the
nc_set_variable
,nc_get_variable
,nc_variable_groups
,nc_clear_variable_groups
, andnc_set_variable_groups
methods.The selection of properties to be written as netCDF global attributes may be accessed with the
nc_global_attributes
,nc_clear_global_attributes
, andnc_set_global_attribute
methods.The netCDF group attributes may be accessed with the
nc_group_attributes
,nc_clear_group_attributes
,nc_set_group_attribute
, andnc_set_group_attributes
methods.The netCDF geometry variable name and group structure may be accessed with the
nc_set_geometry_variable
,nc_get_geometry_variable
,nc_geometry_variable_groups
,nc_clear_variable_groups
, andnc_set_geometry_variable_groups
methods.Some components exist within multiple constructs, but when written to a netCDF dataset the netCDF names associated with such components will be arbitrarily taken from one of them. The netCDF variable, dimension and sample dimension names and group structures for such components may be set or removed consistently across all such components with the
nc_del_component_variable
,nc_set_component_variable
,nc_set_component_variable_groups
,nc_clear_component_variable_groups
,nc_del_component_dimension
,nc_set_component_dimension
,nc_set_component_dimension_groups
,nc_clear_component_dimension_groups
,nc_del_component_sample_dimension
,nc_set_component_sample_dimension
,nc_set_component_sample_dimension_groups
,nc_clear_component_sample_dimension_groups
methods.CF-compliance issues for field constructs read from a netCDF dataset may be accessed with the
dataset_compliance
method.New in version (cfdm): 1.7.0
Initialisation
- Parameters
- properties:
dict
, optional Set descriptive properties. The dictionary keys are property names, with corresponding values.
Properties may also be set after initialisation with the
set_properties
andset_property
methods.- Parameter example:
properties={'standard_name': 'air_temperature'}
- source: optional
Convert source, which can be any type of object, to a
Field
instance.All other parameters, apart from copy, are ignored and their values are instead inferred from source by assuming that it has the
Field
API. Any parameters that can not be retrieved from source in this way are assumed to have their default value.Note that if
x
is also aField
instance thencfdm.Field(source=x)
is equivalent tox.copy()
.- copy:
bool
, optional If True (the default) then deep copy the input parameters prior to initialisation. By default the parameters are not deep copied.
- properties:
Inspection¶
Methods
A full description of the field construct. |
|
Return the canonical identity. |
|
Return all possible identities. |
Attributes
Return a description of the construct type. |
Properties¶
Methods
Remove a property. |
|
Return a property. |
|
Whether a property has been set. |
|
Set a property. |
|
Return all properties. |
|
Remove all properties. |
|
Remove properties. |
|
Set properties. |
Data¶
Methods
Apply masking as defined by the CF conventions. |
|
Remove the data. |
|
Return the data. |
|
Whether or not the construct has data. |
|
Set the data of the field construct. |
|
Removes the keys of the axes spanned by the construct data. |
|
Gets the keys of the axes spanned by the construct data. |
|
Whether the axes spanned by the construct data have been set. |
|
Sets the axes spanned by the construct data. |
|
Expand the shape of the data array. |
|
Remove size one axes from the data. |
|
Permute the axes of the data array. |
Attributes
A numpy array deep copy of the data. |
|
Return the data. |
|
An independent numpy array of date-time objects. |
|
Data-type of the data elements. |
|
The number of data dimensions. |
|
A tuple of the data array’s dimension sizes. |
|
The number elements in the data. |
Metadata constructs¶
Methods
Return a metadata construct. |
|
Return the identifier of a metadata construct. |
|
Return a metadata construct and its identifier. |
|
Remove a metadata construct. |
|
Return a metadata construct. |
|
Whether a unique metadata construct exists. |
|
Set a metadata construct. |
|
Returns the domain axis key spanned by 1-d coordinates. |
|
Select an auxiliary coordinate construct. |
|
Return auxiliary coordinate constructs. |
|
Select a cell connectivity construct. |
|
Select cell connectivity constructs. |
|
Select a cell measure construct. |
|
Return cell measure constructs. |
|
Select a cell method construct. |
|
Return cell method constructs. |
|
Select a dimension or auxiliary coordinate construct. |
|
Return dimension and auxiliary coordinate constructs. |
|
Return a coordinate reference construct, or its key. |
|
Return coordinate reference constructs. |
|
Select a dimension coordinate construct. |
|
Return dimension coordinate constructs. |
|
Select a domain ancillary construct. |
|
Return domain ancillary constructs. |
|
Select a domain axis construct. |
|
Return domain axis constructs. |
|
Select a domain topology construct. |
|
Return domain topology constructs. |
|
Select a field ancillary construct. |
|
Return field ancillary constructs. |
|
Return all axes which are climatological time axes. |
Attributes
Return the metadata constructs. |
Domain¶
Methods
Return the domain. |
Attributes
Return the domain. |
Miscellaneous¶
Methods
Compress the field construct. |
|
Return a deep copy. |
|
Return the commands that would create the field construct. |
|
Whether two constructs are the same. |
|
Convert a metadata construct into a new field construct. |
|
Whether or not there are cell bounds. |
|
Return whether or not any coordinates have cell geometries. |
|
Create indices that define a subspace of the field construct. |
|
Uncompress the field construct. |
|
Return the names of the files containing the data. |
|
The names of files containing the original data and metadata. |
|
Bring data on disk into memory. |
NetCDF¶
Methods
Remove the netCDF variable name. |
|
Return the netCDF variable name. |
|
Whether the netCDF variable name has been set. |
|
Set the netCDF variable name. |
|
Returns properties to write as netCDF global attributes. |
|
Removes properties to write as netCDF global attributes. |
|
Select a property to be written as a netCDF global attribute. |
|
Set properties to be written as netCDF global attributes. |
Groups¶
Methods
Return the netCDF variable group hierarchy. |
|
Set the netCDF variable group hierarchy. |
|
Remove the netCDF variable group hierarchy. |
|
Returns properties to write as netCDF group attributes. |
|
Removes properties to write as netCDF group attributes. |
|
Select a property to be written as a netCDF group attribute. |
|
Set properties to be written as netCDF group attributes. |
Geometries¶
Methods
Remove the netCDF geometry container variable name. |
|
Return the netCDF geometry container variable name. |
|
Whether a netCDF geometry container variable has a name. |
|
Set the netCDF geometry container variable name. |
|
Return the netCDF geometry variable group hierarchy. |
|
Set the netCDF geometry variable group hierarchy. |
|
Remove the netCDF geometry variable group hierarchy. |
Components¶
Methods
Remove the netCDF variable name of components. |
|
Set the netCDF variable name for components. |
|
Set the netCDF variable groups of components. |
|
Remove the netCDF variable groups of components. |
|
Remove the netCDF dimension name of components. |
|
Set the netCDF dimension name of components. |
|
Set the netCDF dimension groups of components. |
|
Remove the netCDF dimension groups of components. |
|
Remove the netCDF sample dimension name of components. |
|
Set the netCDF sample dimension name of components. |
|
Set the netCDF sample dimension groups of components. |
|
Remove the netCDF sample dimension groups of components. |
Dataset compliance¶
Methods
Return the dataset compliance report. |
Special¶
Methods
Called by the |
|
Return a subspace of the field defined by indices. |
|
Called by the |
|
Called by the |
Docstring substitutions¶
Methods
Return the special docstring substitutions. |
|
Returns the substitutions that apply to methods of the class. |
|
Returns the class {{package}} substitutions package depth. |
|
Returns method names excluded in the class substitutions. |