cfdm.core.Field


class cfdm.core.Field(properties=None, source=None, copy=True, _use_data=True)[source]

Bases: cfdm.core.mixin.fielddomain.FieldDomain, cfdm.core.abstract.propertiesdata.PropertiesData

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. All of the constructs contained by the field construct are optional.

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).

New in version (cfdm): 1.7.0

Initialisation

Parameters
properties: dict, optional

Set descriptive properties. The dictionary keys are property names, with corresponding values. Ignored if the source parameter is set.

Properties may also be set after initialisation with the set_properties and set_property methods.

Parameter example:

properties={'standard_name': 'air_temperature'}

source: optional

Initialise the properties, data and metadata constructs from those of source.

Note that if source is a Field instance then cfdm.core.Field(source=source) is equivalent to source.copy().

copy: bool, optional

If True (the default) deep copy input parameters prior to initialisation. If False arguments are not deep copied.

Inspection

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.

has_data

Whether or not the construct has data.

set_data

Set the data of the field construct.

del_data_axes

Removes the keys of the axes spanned by the construct data.

get_data_axes

Gets the keys of the axes spanned by the construct data.

has_data_axes

Whether the axes spanned by the construct data have been set.

set_data_axes

Sets the axes spanned by the construct data.

Attributes

data

Return the data.

Metadata constructs

Methods

del_construct

Remove a metadata construct.

get_construct

Return a metadata construct.

has_construct

Whether a metadata construct exists.

set_construct

Set a metadata construct.

del_data_axes

Removes the keys of the axes spanned by the construct data.

get_data_axes

Gets the keys of the axes spanned by the construct data.

has_data_axes

Whether the axes spanned by the construct data have been set.

set_data_axes

Sets the axes spanned by the construct data.

Attributes

constructs

Return the metadata constructs.

Domain

Methods

get_domain

Return the domain.

Attributes

domain

Return the domain.

Miscellaneous

Methods

copy

Return a deep copy.

has_bounds

Whether or not there are cell bounds.

Special

Methods

__deepcopy__

Called by the copy.deepcopy function.

Docstring substitutions

Methods

_docstring_special_substitutions

Return the special docstring substitutions.

_docstring_substitutions

Returns the substitutions that apply to methods of the class.

_docstring_package_depth

Returns the class {{package}} substitutions package depth.

_docstring_method_exclusions

Returns method names excluded in the class substitutions.