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.constructaccess.ConstructAccess
,cfdm.mixin.propertiesdata.PropertiesData
,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 of the construct may be accessed with the
nc_set_variable
,nc_get_variable
,nc_del_variable
andnc_has_variable
methods.New in version 1.7.0.
Initialization
Parameters: - properties:
dict
, optional Set descriptive properties. The dictionary keys are property names, with corresponding values. Ignored if the source parameter is set.
- Parameter example:
properties={'standard_name': 'air_temperature'}
Properties may also be set after initialisation with the
set_properties
andset_property
methods.- source: optional
Initialize the properties, data and metadata constructs from those of source.
- copy:
bool
, optional If False then do not deep copy input parameters prior to initialization. By default arguments are deep copied.
- properties:
Inspection¶
Methods
dump |
A full description of the field construct. |
identity |
Return the canonical identity. |
identities |
Return all possible identities. |
Attributes
construct_type |
Return a description of the construct type. |
Properties¶
Methods
del_property |
Remove a property. |
get_property |
Return a property. |
has_property |
Whether a property has been set. |
set_property |
Set a property. |
properties |
Return all properties. |
clear_properties |
Remove all properties. |
set_properties |
Set properties. |
Data¶
Methods
del_data |
Remove the data. |
get_data |
Return the data.o |
has_data |
Whether a data has been set. |
set_data |
Set the data of the field construct. |
del_data_axes |
Remove the keys of the domain axis constructs spanned by the data of the field or of a metadata construct. |
get_data_axes |
Return the keys of the domain axis constructs spanned by the data of the field or of a metadata construct. |
has_data_axes |
Whether the domain axis constructs spanned by the data of the field or of a metadata construct have been set. |
set_data_axes |
Set the domain axis constructs spanned by the data of the field or of a metadata construct. |
insert_dimension |
Expand the shape of the data array. |
squeeze |
Remove size one axes from the data array. |
transpose |
Permute the axes of the data array. |
Attributes
data |
Return the data. |
Metadata constructs¶
Methods
construct |
Select a metadata construct by its identity. |
construct_key |
Select the key of a metadata construct by its identity. |
del_construct |
Remove a metadata construct. |
get_construct |
Return a metadata construct. |
has_construct |
Whather a metadata construct exisits. |
set_construct |
Set a metadata construct. |
del_data_axes |
Remove the keys of the domain axis constructs spanned by the data of the field or of a metadata construct. |
get_data_axes |
Return the keys of the domain axis constructs spanned by the data of the field or of a metadata construct. |
has_data_axes |
Whether the domain axis constructs spanned by the data of the field or of a metadata construct have been set. |
set_data_axes |
Set the domain axis constructs spanned by the data of the field or of a metadata construct. |
domain_axis_key |
Return the key of the domain axis construct that is spanned by 1-d coordinate constructs. |
Attributes
constructs |
Return the metdata constructs. |
auxiliary_coordinates |
Return auxiliary coordinate constructs. |
cell_measures |
Return cell measure constructs. |
cell_methods |
Return cell method constructs. |
coordinates |
Return dimension and auxiliary coordinate constructs. |
coordinate_references |
Return coordinate reference constructs. |
dimension_coordinates |
Return dimension coordinate constructs. |
domain_ancillaries |
Return domain ancillary constructs. |
domain_axes |
Return domain axis constructs. |
field_ancillaries |
Return field ancillary constructs. |
Miscellaneous¶
Methods
copy |
Return a deep copy of the field construct. |
equals |
Whether two field constructs are the same. |
convert |
Convert a metadata construct into a new field construct. |
NetCDF¶
Methods
nc_del_variable |
Remove the netCDF variable name. |
nc_get_variable |
Return the netCDF variable name. |
nc_has_variable |
Whether the netCDF variable name has been set. |
nc_set_variable |
Set the netCDF variable name. |
nc_global_attributes |
Return the selection of properties to be written as netCDF global attributes. |
nc_clear_global_attributes |
Remove the selection of properties to be written as netCDF global attributes. |
nc_set_global_attribute |
Select a property to be written as a netCDF global attribute. |
nc_set_global_attributes |
Set properties to be written as netCDF global attributes. |
dataset_compliance |
A report of problems encountered whilst reading the field construct from a dataset. |
Special¶
Methods
__deepcopy__ |
Called by the copy.deepcopy function. |
__getitem__ |
Return a subspace of the field defined by indices. |
__repr__ |
Called by the repr built-in function. |
__str__ |
Called by the str built-in function. |