ClimoAccessor¶
- class ClimoAccessor(data, registry=<climopy.cfvariable.CFVariableRegistry object>)[source]¶
Bases:
objectAccessor with properties and methods shared by
xarray.DataArrays andxarray.Datasets. Registered under the nameclimo(i.e, usage isdata_array.climoanddataset.climo).- Parameters
data (xarray.DataArray or xarray.Dataset) – The data.
registry (cfvariable.CFVariableRegistry) – The variable registry.
Notes
This adds
pint.Quantitysupport for the operationsloc,sel,interp, andgroupby. Otherwise,weightedandcoarsenalready work, butresampleandrollingare broken and may be quite tricky to fix.Attributes Summary
Wrapper of
CFAccessorthat supports automatic cacheing for speed boosts.Wrapper of
coordsthat returns always-quantified coordinate variables or variables transformed from the native coordinates usingClimoDataArrayAccessor.to_variable(e.g.Redirect to the underlying
xarray.Datasetorxarray.DataArray.Call
locwith support forpint.Quantityindexers and assignments and coordinate name aliases.The coordinate
DataArrayfor the “parameter sweep” axis.The active
CFVariableRegistryused to look up variables withcfvariable.Methods Summary
add_cell_measures([measures, dataset, …])Add cell measures to the
coordsand update thecell_measuresattribute(s).add_scalar_coords([verbose])Add dummy scalar coordinates for missing longitude, latitude, and vertical dimensions and update the
cell_methodsattribute(s) to indicate the missing coordinates were reduced by averaging.enforce_global([longitude, latitude, …])Add a circularly overlapping longitude coordinate, latitude coordinates for the north and south poles, and pressure coordinates for the mean sea-level and “zero” pressure levels.
groupby(group, *args, **kwargs)A unit-friendly
groupbyindexer.interp([indexers, method, assume_sorted, …])Call
interpwith support for units and indexer aliases.isel([indexers, drop, drop_cell_measures])Call
iselwith support for units and indexer aliases.mean([dim, skipna, weight])Return the mean along dimension(s), preserving attributes and coordinates.
replace_coords([indexers])Return a copy with coordinate values added or replaced (if they already exist).
sel([indexers, method, tolerance, drop, …])Call
selwith support for units and indexer aliases.sel_hemisphere(which[, invert])Select a hemisphere or average of hemispheres.
sel_pair(key)Return selection from a pseudo “parameter” axis.
sel_time([date])Return an
DataArrayorDatasetwith the time coordinate filtered to times matching some datetime component.standardize_coords([verbose])Infer and standardize coordinates to satisfy CF conventions with the help of
guess_coord_axisandcf_xarray.CFAccessor.rename_like.sum([dim, skipna, weight])Return the sum along dimension(s), preserving attributes and coordinates.
truncate([bounds, ignore_extra, dataset])Restrict the coordinate range using
ClimoAccessor.interp.update_cell_attrs(other)Update
cell_methodsandcell_measuresattributes from another object onto thexarray.DataArrayor every array in thexarray.Dataset.update_cell_methods([methods])Update the
cell_methodsattribute on thexarray.DataArrayor on every array in thexarray.Datasetwith the input methods.