cfdm.Domain


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

Bases: cfdm.mixin.fielddomain.FieldDomain, 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.properties.Properties, cfdm.mixin.files.Files, cfdm.core.domain.Domain

A domain construct of the CF data model.

The domain represents a set of discrete “locations” in what generally would be a multi-dimensional space, either in the real world or in a model’s simulated world. The data array elements of a field construct correspond to individual location of a domain.

The domain construct 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; as well as properties to describe the domain.

NetCDF interface

The netCDF variable name may be accessed with the nc_set_variable, nc_get_variable, nc_del_variable, and nc_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, and nc_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, and nc_set_global_attribute methods.

The netCDF group attributes may be accessed with the nc_group_attributes, nc_clear_group_attributes, nc_set_group_attribute, and nc_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, and nc_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, and nc_clear_component_sample_dimension_groups methods.

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={'long_name': 'Domain for model'}

source: optional

Initialise the metadata constructs from those of source.

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

A new domain may also be instantiated with the fromconstructs class method.

copy: bool, optional

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

Methods

Inspection

Methods

dump

A full description of the domain construct.

identity

Return the canonical identity.

identities

Return all possible identities.

Attributes

construct_type

Return a description of the construct type.

Metadata constructs

Methods

construct

Return a metadata construct.

construct_key

Return the identifier of a metadata construct.

construct_item

Return a metadata construct and its identifier.

del_construct

Remove a metadata construct.

get_construct

Return a metadata construct.

has_construct

Whether a unique 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 domain axis constructs spanned by the construct data.

domain_axis_key

Returns the domain axis key spanned by 1-d coordinates.

auxiliary_coordinate

Select an auxiliary coordinate construct.

auxiliary_coordinates

Return auxiliary coordinate constructs.

cell_measure

Select a cell measure construct.

cell_measures

Return cell measure constructs.

coordinate

Select a dimension or auxiliary coordinate construct.

coordinates

Return dimension and auxiliary coordinate constructs.

coordinate_reference

Return a coordinate reference construct, or its key.

coordinate_references

Return coordinate reference constructs.

dimension_coordinate

Select a dimension coordinate construct.

dimension_coordinates

Return dimension coordinate constructs.

domain_ancillary

Select a domain ancillary construct.

domain_ancillaries

Return domain ancillary constructs.

domain_axis

Select a domain axis construct.

domain_axes

Return domain axis constructs.

climatological_time_axes

Return all axes which are climatological time axes.

Attributes

constructs

Return the metadata constructs.

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.

Miscellaneous

Methods

apply_masking

Apply masking as defined by the CF conventions.

climatological_time_axes

Return all axes which are climatological time axes.

copy

Return a deep copy.

creation_commands

Return the commands that would create the domain construct.

equals

Whether two constructs are the same.

fromconstructs

Return a new domain containing the given metadata constructs.

get_filenames

Return the file names containing the metadata construct data.

has_bounds

Whether or not there are cell bounds.

has_data

Whether or not the construct has data.

has_geometry

Return whether or not any coordinates have cell geometries.

apply_masking

Apply masking as defined by the CF conventions.

cfdm.Domain.original_filenames

uncompress

Uncompress the domain 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

Returns properties to write as netCDF global attributes.

nc_clear_global_attributes

Removes properties to write 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.

Groups

Methods

nc_variable_groups

Return the netCDF variable group hierarchy.

nc_set_variable_groups

Set the netCDF variable group hierarchy.

nc_clear_variable_groups

Remove the netCDF variable group hierarchy.

nc_group_attributes

Returns properties to write as netCDF group attributes.

nc_clear_group_attributes

Removes properties to write as netCDF group attributes.

nc_set_group_attribute

Select a property to be written as a netCDF group attribute.

nc_set_group_attributes

Set properties to be written as netCDF group attributes.

Geometries

Methods

nc_del_geometry_variable

Remove the netCDF geometry container variable name.

nc_get_geometry_variable

Return the netCDF geometry container variable name.

nc_has_geometry_variable

Whether a netCDF geometry container variable has a name.

nc_set_geometry_variable

Set the netCDF geometry container variable name.

nc_geometry_variable_groups

Return the netCDF geometry variable group hierarchy.

nc_set_geometry_variable_groups

Set the netCDF geometry variable group hierarchy.

nc_clear_geometry_variable_groups

Remove the netCDF geometry variable group hierarchy.

Components

Methods

nc_del_component_variable

Remove the netCDF variable name of components.

nc_set_component_variable

Set the netCDF variable name for components.

nc_set_component_variable_groups

Set the netCDF variable groups of components.

nc_clear_component_variable_groups

Remove the netCDF variable groups of components.

nc_del_component_dimension

Remove the netCDF dimension name of components.

nc_set_component_dimension

Set the netCDF dimension name of components.

nc_set_component_dimension_groups

Set the netCDF dimension groups of components.

nc_clear_component_dimension_groups

Remove the netCDF dimension groups of components.

nc_del_component_sample_dimension

Remove the netCDF sample dimension name of components.

nc_set_component_sample_dimension

Set the netCDF sample dimension name of components.

nc_set_component_sample_dimension_groups

Set the netCDF sample dimension groups of components.

nc_clear_component_sample_dimension_groups

Remove the netCDF sample dimension groups of components.

Dataset compliance

Methods

dataset_compliance

Return the dataset compliance report.

Special

Methods

__deepcopy__

Called by the copy.deepcopy function.

__repr__

Called by the repr built-in function.

__str__

Called by the str built-in 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.