ClimoDatasetAccessor

class ClimoDatasetAccessor(data, registry=<climopy.cfvariable.CFVariableRegistry object>)[source]

Bases: climopy.accessor.ClimoAccessor

Accessor for xarray.Datasets. Includes methods for working with pint quantities and CFVariable variables and an interface for deriving one physical variable from other variables in the dataset. Registered under the name climo (i.e, usage is data_array.climo). The string representation of this accessor displays cfvariable information for every variable whose name is found in the variable_registry.

Parameters
  • data (xarray.DataArray or xarray.Dataset) – The data.

  • registry (cfvariable.CFVariableRegistry) – The variable registry.

Notes

This adds pint.Quantity support for the operations loc, sel, interp, and groupby. Otherwise, weighted and coarsen already work, but resample and rolling are broken and may be quite tricky to fix.

Attributes Summary

vars

Analogue to ClimoAccessor.coords for retreiving always-quantified data variables based on their actual names, standard name attributes, or CFVariableRegistry identifiers.

Methods Summary

__getattr__(attr)

Try to return a variable with __getitem__.

__getitem__(key)

Return a quantified coordinate or variable, including transformations and derivations registered with register_transformation or register_derivation, or return a selection along dimensions with translated dictionary indexing.

add_variable(*args, **kwargs)

Call get and add the result to a copy of the dataset.

dequantify()

Return a copy of the xarray.Dataset with underlying xarray.DataArray data stripped of its units and the units written to the 'units' attributes.

get(*keys[, quantify, standardize, units, …])

Call __getitem__, with optional post-processing steps and special behavior when variables are prefixed or suffixed with certain values.

quantify()

Return a copy of the xarray.Dataset with underlying xarray.DataArray data converted to pint.Quantity using the 'units' attributes.