ClimoDataArrayAccessor¶
- class ClimoDataArrayAccessor(data, registry=<climopy.cfvariable.CFVariableRegistry object>)[source]¶
Bases:
climopy.accessor.ClimoAccessor
Accessor for
xarray.DataArray
s. Includes methods for working withpint
quantities andCFVariable
variables, several stub functions for integration with free-standing climopy functions (similar to numpy design), and an interface for transforming one physical variable to another. Registered under the nameclimo
(i.e, usage isdata_array.climo
). The string representation of this accessor displays itscfvariable
information (if the data array name is found in thevariable_registry
).- Parameters
data (xarray.DataArray or xarray.Dataset) – The data.
registry (cfvariable.CFVariableRegistry) – The variable registry.
Notes
This adds
pint.Quantity
support for the operationsloc
,sel
,interp
, andgroupby
. Otherwise,weighted
andcoarsen
already work, butresample
androlling
are broken and may be quite tricky to fix.Attributes Summary
Return a
CFVariable
based on theDataArray
name, the scalar coordinates, and the coordinate reductions referenced incell_methods
.The magnitude of the data values of this
DataArray
(i.e., without units).The data values of this
DataArray
as apint.Quantity
.The units of this
DataArray
as apint.Unit
, taken from the underlyingpint.Quantity
or the'units'
attribute.The units of this
DataArray
formatted LaTeX-style.Methods Summary
__getattr__
(attr)Return a coordinate, attribute, or cfvariable property.
__getitem__
(key)Return a quantified coordinate or a selection along dimensions with translated dictionary indexing.
__setitem__
(key, value)Set values along dimensions with translated dictionary indexing.
absargmax
([dim])Return the coordinates of global maxima along the dimension.
absargmin
([dim])Return the coordinates of global minima along the dimension.
absmax
([dim])Return the global maxima along the dimension.
absmin
([dim])Return the global minima along the dimension.
anomaly
(*args, **kwargs)Anomaly with respect to mass-weighted average.
argloc
([dim, value])Return the coordinate(s) of a given value along the dimension.
argmax
([dim])Return the coordinates of local maxima along the dimension.
argmin
([dim])Return the coordinates of local minima along the dimension.
autocorr
(dim, **kwargs)Return the autocorrelation along the input dimension.
autocovar
(dim, **kwargs)Return the autocovariance along the input dimension.
average
([dim])Return the mass-weighted average.
centroid
([dataset])Return the value-weighted average wavenumber.
convergence
(*args, **kwargs)Return the spherical meridional convergence.
cumanomaly
(*args, **kwargs)Anomaly relative to cumulative mass-weighted average.
cumaverage
(dim[, reverse, weight, skipna])Return the cumulative mass-weighted average.
cumintegral
(dim[, skipna])Return the cumulative mass-weighted integral.
Return a copy of the
xarray.DataArray
with underlying data stripped of its units and units written to the'units'
attribute.derivative
([indexers, centered])Take the nth order centered finite difference for the specified dimensions.
divergence
([cos_power, centered])Return the spherical meridional divergence.
hist
(dim[, bins])Return the histogram along the given dimension.
integral
([dim])Return the mass-weighted integral.
mask
(mask[, dataset])Return a copy of the data with a mask applied according to some preset pattern.
max
([dim])Return the local maxima along the dimension.
min
([dim])Return the local mimima along the dimension.
Return a copy of the data normalized with respect to time.
quantify
()Return a copy of the
xarray.DataArray
with underlying data converted topint.Quantity
using the'units'
attribute.reduce
([indexers, dataset, centroid, …])Reduce the dimension of a
xarray.DataArray
with arbitrary method(s).runmean
([indexers])Return the running mean along different dimensions.
slope
(dim)Return the best-fit slope with respect to some dimension.
timescale
(dim[, maxlag, imaxlag])Return a best-fit estimate of the autocorrelation timescale.
to_base_units
([coords])Return a copy with the underlying data converted to base units.
to_compact_units
([coords])Return a copy with the underlying data converted to “compact” units.
to_standard_units
([coords])Return a copy with the underyling data converted to the
cfvariable
standard_units
value.to_units
(units[, context])Return a copy converted to the desired units.
to_variable
(dest[, standardize])Transform this variable to another variable using two-way transformations registered with
register_transformation
.