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

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

Convert source, which can be any type of object, to a Domain instance.

All other parameters, apart from copy, are ignored and their values are instead inferred from source by assuming that it has the Domain 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 a Domain instance then cfdm.Domain(source=x) is equivalent to x.copy().

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

copy: bool, optional

If True (the default) then deep copy the input parameters prior to initialisation. By default the parameters 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.

size

The number of locations in the domain.

rank

The number of axes in the domain.

Properties

Methods

del_property

Remove a property.

get_property

Get a CF property.

has_property

Whether a property has been set.

set_property

Set a property.

properties

Return all properties.

clear_properties

Remove all properties.

del_properties

Remove properties.

set_properties

Set properties.

Attributes

calendar

The calendar CF property.

comment

The comment CF property.

history

The history CF property.

leap_month

The leap_month CF property.

leap_year

The leap_year CF property.

long_name

The long_name CF property.

month_lengths

The month_lengths CF property.

standard_name

The standard_name CF property.

units

The units CF property.

valid_max

The valid_max CF property.

valid_min

The valid_min CF property.

valid_range

The valid_range CF property.

Selection

Methods

match_by_identity

Whether or not the construct identity satisfies conditions.

match_by_ncvar

Whether or not the netCDF variable name satisfies conditions.

match_by_property

Whether or not properties satisfy conditions.

match_by_rank

Whether or not the number of domain axis constructs satisfies conditions.

match_by_construct

Whether or not there are particular metadata constructs.

Rearranging

Methods

anchor

Roll a cyclic axis so that the given value lies in the first coordinate cell.

roll

Roll the field along a cyclic axis.

flip

Flip (reverse the direction of) domain axes.

transpose

Permute the data axes of the metadata constructs.

Metadata constructs

Methods

auxiliary_coordinates

Return auxiliary coordinate constructs.

auxiliary_coordinate

Select an auxiliary coordinate construct.

cell_connectivities

Select cell connectivity constructs.

cell_connectivity

Select a cell connectivity construct.

cell_measures

Return cell measure constructs.

cell_measure

Select a cell measure construct.

coordinates

Return dimension and auxiliary coordinate constructs.

coordinate

Select a dimension or auxiliary coordinate construct.

coordinate_references

Return coordinate reference constructs.

coordinate_reference

Return a coordinate reference construct, or its key.

dimension_coordinates

Return dimension coordinate constructs.

dimension_coordinate

Select a dimension coordinate construct.

domain_ancillaries

Return domain ancillary constructs.

domain_ancillary

Select a domain ancillary construct.

domain_axes

Return domain axis constructs.

domain_axis

Select a domain axis construct.

domain_topologies

Return domain topology constructs.

domain_topology

Select a domain topology construct.

construct

Return a metadata construct.

construct_item

Return a metadata construct and its identifier.

construct_key

Return the identifier of a metadata construct.

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.

replace_construct

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

auxiliary_to_dimension

Move auxiliary coordinates to a dimension coordinate construct.

dimension_to_auxiliary

Move dimension coordinates to an auxiliary coordinate construct.

coordinate_reference_domain_axes

Return the domain axes that apply to a coordinate reference construct.

get_coordinate_reference

Return a coordinate reference construct.

set_coordinate_reference

Set a coordinate reference construct.

del_coordinate_reference

Remove a coordinate reference construct and all of its domain ancillary constructs.

domain_axis_key

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

del_domain_axis

Remove a domain axis construct.

climatological_time_axes

Return all axes which are climatological time axes.

Attributes

constructs

Return the metadata constructs.

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.

create_regular

Create a new domain with the regular longitudes and latitudes.

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.

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.

get_original_filenames

The names of files containing the original data and metadata.

close

Close all files referenced by the domain construct.

uncompress

Uncompress the domain construct.

Domain axes

autocyclic

Set dimensions to be cyclic.

axes

Alias for domain_axes.

axis

Alias for domain_axis.

cyclic

Get or set the cyclicity of an axis.

direction

Whether or not a domain axis is increasing.

directions

Return a dictionary mapping all domain axes to their directions.

iscyclic

Returns True if the given axis is cyclic.

Subspacing

indices

Create indices that define a subspace of the domain construct.

subspace

Create a subspace of the 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

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.

CFA

Methods

add_file_location

Add a new file location in-place.

cfa_clear_file_substitutions

Remove all of the CFA-netCDF file name substitutions.

cfa_del_file_substitution

Remove a CFA-netCDF file name substitution.

cfa_file_substitutions

Return the CFA-netCDF file name substitutions.

cfa_update_file_substitutions

Set CFA-netCDF file name substitutions.

del_file_location

Remove a file location in-place.

file_locations

The locations of files containing parts of the components data.

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.

Aliases

Methods

aux

Alias for auxiliary_coordinate.

auxs

Alias for coordinates.

axis

Alias for domain_axis.

coord

Alias for coordinate.

coords

Alias for coordinates.

dim

Alias for dimension_coordinate.

dims

Alias for dimension_coordinates.

domain_anc

Alias for domain_ancillary.

domain_ancs

Alias for domain_ancillaries.

key

Alias for construct_key.

match

Alias for match_by_identity.

measure

Alias for cell_measure.

measures

Alias for cell_measures.

ref

Alias for coordinate_reference.

refs

Alias for coordinate_references.

Deprecated

Methods

delprop

Deprecated at version 3.0.0, use method del_property instead.

get_filenames

Return the file names containing the metadata construct data.

getprop

Deprecated at version 3.0.0, use method get_property instead.

hasprop

Deprecated at version 3.0.0, use method has_property instead.

setprop

Deprecated at version 3.0.0, use method set_property instead.

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.