API#

Top-level API#

bounds_to_vertices(bounds, bounds_dim[, ...])

Convert bounds variable to vertices.

vertices_to_bounds(vertices[, out_dims])

Convert vertices to CF-compliant bounds.

shapely_to_cf(geometries[, grid_mapping])

Convert a DataArray with shapely geometry objects into a CF-compliant dataset.

cf_to_shapely(ds)

Convert geometries stored in a CF-compliant way to shapely objects stored in a single variable.

set_options(**kwargs)

Set options for cf-xarray in a controlled context.

encode_multi_index_as_compress(ds[, idxnames])

Encode a MultiIndexed dimension using the "compression by gathering" CF convention.

decode_compress_to_multi_index(encoded[, ...])

Decode a compressed variable to a pandas MultiIndex.

DataArray#

Attributes#

DataArray.cf.axes

Mapping valid Axis standard names for .cf[] to variable names.

DataArray.cf.cell_measures

Mapping valid cell measure standard names for .cf[] to variable names.

DataArray.cf.cf_roles

Mapping cf_role names to variable names.

DataArray.cf.coordinates

Mapping valid Coordinate standard names for .cf[] to variable names.

DataArray.cf.formula_terms

Mapping the parametric coordinate's name to a dictionary that maps "standard term names" to actual variable names.

DataArray.cf.grid_mapping_name

CF grid mapping name associated with this variable.

DataArray.cf.is_flag_variable

Returns True if the DataArray satisfies CF conventions for flag variables.

DataArray.cf.standard_names

Mapping standard names to variable names.

DataArray.cf.plot

Extended version of regular .plot.

Methods#

DataArray.cf.__getitem__(key)

Index into a DataArray making use of CF attributes.

DataArray.cf.__repr__()

Return repr(self).

DataArray.cf.add_canonical_attributes([...])

Add canonical CF attributes to variables with standard names.

DataArray.cf.differentiate(coord, *xr_args)

Differentiate an xarray object.

DataArray.cf.guess_coord_axis([verbose])

Automagically guesses X, Y, Z, T, latitude, longitude, and adds appropriate attributes.

DataArray.cf.keys()

Utility function that returns valid keys for .cf[].

DataArray.cf.rename_like(other[, skip])

Rename variables in object to match names of like-variables in other.

Flag Variables#

cf_xarray supports rich comparisons for CF flag variables. Flag masks are not yet supported.

DataArray.cf.__lt__(other)

Compare flag values against other.

DataArray.cf.__le__(other)

Compare flag values against other.

DataArray.cf.__eq__(other)

Compare flag values against other.

DataArray.cf.__ne__(other)

Compare flag values against other.

DataArray.cf.__ge__(other)

Compare flag values against other.

DataArray.cf.__gt__(other)

Compare flag values against other.

DataArray.cf.isin(test_elements)

Test each value in the array for whether it is in test_elements.

Dataset#

Attributes#

Dataset.cf.axes

Mapping valid Axis standard names for .cf[] to variable names.

Dataset.cf.bounds

Mapping keys to the variable names of their bounds.

Dataset.cf.cell_measures

Mapping valid cell measure standard names for .cf[] to variable names.

Dataset.cf.cf_roles

Mapping cf_role names to variable names.

Dataset.cf.coordinates

Mapping valid Coordinate standard names for .cf[] to variable names.

Dataset.cf.formula_terms

Mapping the parametric coordinate's name to a dictionary that maps "standard term names" to actual variable names.

Dataset.cf.grid_mapping_names

Mapping the CF grid mapping name to the grid mapping variable name.

Dataset.cf.standard_names

Mapping standard names to variable names.

Methods#

Dataset.cf.__getitem__(key)

Index into a Dataset making use of CF attributes.

Dataset.cf.__repr__()

Return repr(self).

Dataset.cf.add_bounds(keys, *[, dim, output_dim])

Create a new object with bounds variables.

Dataset.cf.add_canonical_attributes([...])

Add canonical CF attributes to variables with standard names.

Dataset.cf.bounds_to_vertices([keys, order])

Convert bounds variable to vertices.

Dataset.cf.decode_vertical_coords(*[, ...])

Decode parameterized vertical coordinates in place.

Dataset.cf.differentiate(coord, *xr_args[, ...])

Differentiate an xarray object.

Dataset.cf.get_bounds(key)

Get bounds variable corresponding to key.

Dataset.cf.get_bounds_dim_name(key)

Get bounds dim name for variable corresponding to key.

Dataset.cf.guess_coord_axis([verbose])

Automagically guesses X, Y, Z, T, latitude, longitude, and adds appropriate attributes.

Dataset.cf.keys()

Utility function that returns valid keys for .cf[].

Dataset.cf.rename_like(other[, skip])

Rename variables in object to match names of like-variables in other.