sdkagent

xarray API reference

335 public APIs from xarray (pydata/xarray) — 84 classes, 82 functions, 169 methods. Signatures extracted by static analysis of the actual source.

Repository: pydata/xarray

KindCount
Classes84
Functions82
Methods169

API list

classxarray.backends.common.BytesIOProxy
Proxy object for a write that a memoryview.
methodxarray.backends.common.BytesIOProxy.getbuffer() -> memoryview
Get the value of this write as bytes or memory.
funcxarray.backends.common.collect_ancestor_dimensions(group) -> dict[str, int]
Returns dimensions defined in parent groups.
funcxarray.backends.common.datatree_from_dict_with_io_cleanup(groups_dict:Mapping[str, Dataset]) -> DataTree
DataTree.from_dict with file clean-up.
methodxarray.backends.file_manager.CachingFileManager.acquire(needs_lock:bool=True) -> T_File
Acquire a file object from the manager.
methodxarray.backends.file_manager.CachingFileManager.acquire_context(needs_lock:bool=True) -> Iterator[T_File]
Context manager for acquiring a file.
methodxarray.backends.file_manager.CachingFileManager.close(needs_lock:bool=True) -> None
Explicitly close any associated file object (if necessary).
classxarray.backends.file_manager.FileManager
Manager for acquiring and closing a file object.
methodxarray.backends.file_manager.FileManager.acquire(needs_lock:bool=True) -> T_File
Acquire the file object from this manager.
methodxarray.backends.file_manager.FileManager.acquire_context(needs_lock:bool=True) -> AbstractContextManager[T_File]
Context manager for acquiring a file.
methodxarray.backends.file_manager.FileManager.close(needs_lock:bool=True) -> None
Close the file object associated with this manager, if needed.
classxarray.backends.h5netcdf_.H5NetCDFStore
Store for reading and writing data via h5netcdf
classxarray.backends.h5netcdf_.H5netcdfBackendEntrypoint
Backend for netCDF files based on the h5netcdf package.
classxarray.backends.locks.CombinedLock
A combination of multiple locks.
classxarray.backends.locks.DummyLock
DummyLock provides the lock API without any actual locking.
funcxarray.backends.locks.combine_locks(locks:Sequence[Lock]) -> Lock
Combine a sequence of locks into a single lock.
funcxarray.backends.locks.ensure_lock(lock:Lock | None | Literal[False]) -> Lock
Ensure that the given object is a lock.
funcxarray.backends.locks.get_dask_scheduler(get=None, collection=None) -> str | None
Determine the dask scheduler that is being used.
funcxarray.backends.locks.get_write_lock(key:str) -> Lock
Get a scheduler appropriate lock for writing to the given resource.
classxarray.backends.lru_cache.LRUCache
Thread-safe LRUCache based on an OrderedDict.
methodxarray.backends.lru_cache.LRUCache.maxsize() -> int
Maximum number of items can be held in the cache.
classxarray.backends.netCDF4_.NetCDF4BackendEntrypoint
Backend for netCDF files based on the netCDF4 package.
funcxarray.backends.plugins.get_backend(engine:str | type[BackendEntrypoint]) -> BackendEntrypoint
Select open_dataset method based on current engine.
funcxarray.backends.plugins.refresh_engines() -> None
Refreshes the backend engines based on installed packages.
funcxarray.backends.pydap_.PydapBackendEntrypoint.group_fqn(store, path=None, g_fqn=None) -> dict[str, str]
To be removed for pydap > 3.5.0.
classxarray.backends.pydap_.PydapDataStore
Store for accessing OpenDAP datasets with pydap.
classxarray.backends.scipy_.ScipyBackendEntrypoint
Backend for netCDF files based on the scipy package.
classxarray.backends.scipy_.ScipyDataStore
Store for reading and writing data via scipy.io.netcdf_file.
classxarray.backends.zarr.ZarrBackendEntrypoint
Backend for ".zarr" files based on the zarr package.
classxarray.backends.zarr.ZarrStore
Store for reading and writing data via zarr
funcxarray.coding.cftime_offsets.cftime_range(start=None, end=None, periods=None, freq=None, normalize=False, name=None, inclusive:InclusiveOptions='both', calendar='standard') -> CFTimeIndex
Return a fixed frequency CFTimeIndex.
funcxarray.coding.cftime_offsets.delta_to_tick(delta:timedelta | pd.Timedelta) -> Tick
Adapted from pandas.tslib.delta_to_tick
funcxarray.coding.cftime_offsets.normalize_date(date)
Round datetime down to midnight.
classxarray.coding.common.SerializationWarning
Warnings about encoding/decoding issues in serialization.
classxarray.coding.common.VariableCoder
Base class for encoding and decoding transformations on variables.
methodxarray.coding.common.VariableCoder.decode(variable:Variable, name:T_Name=None) -> Variable
Convert a decoded variable to an encoded variable
methodxarray.coding.common.VariableCoder.encode(variable:Variable, name:T_Name=None) -> Variable
Convert an encoded variable to a decoded variable
funcxarray.coding.common.pop_to(source:MutableMapping, dest:MutableMapping, key:Hashable, name:T_Name=None) -> Any
A convenience function which pops a key k from source to dest.
funcxarray.coding.frequencies.month_anchor_check(dates)
Return the monthly offset string.
classxarray.coding.times.CFDatetimeCoder
Coder for CF Datetime coding.
classxarray.coding.times.CFTimedeltaCoder
Coder for CF Timedelta coding.
funcxarray.coding.times.infer_calendar_name(dates) -> CFCalendar
Given an array of datetimes, infer the CF calendar name
classxarray.coding.variables.BooleanCoder
Code boolean values.
classxarray.coding.variables.CFMaskCoder
Mask or unmask fill values according to CF conventions.
classxarray.coding.variables.CFScaleOffsetCoder
Scale and offset variables according to CF conventions.
classxarray.coding.variables.DefaultFillvalueCoder
Encode default _FillValue if needed.
classxarray.coding.variables.EndianCoder
Decode Endianness to native.
classxarray.coding.variables.NativeEnumCoder
Encode Enum into variable dtype metadata.
classxarray.coding.variables.NonStringCoder
Encode NonString variables if dtypes differ.
funcxarray.compat.dask_array_ops.push(array, n, axis, method='blelloch')
Dask-aware bottleneck.push
funcxarray.compat.pdcompat.count_not_none(*args) -> int
Compute the number of non-None arguments.
classxarray.computation.arithmetic.SupportsArithmetic
Base class for xarray types that support arithmetic.
funcxarray.computation.computation.cross(a:DataArray | Variable, b:DataArray | Variable, *dim:Hashable) -> DataArray | Variable
Compute the cross product of two (arrays of) vectors.
funcxarray.computation.computation.dot(*dim:Dims=None, *arrays, **kwargs:Any)
Generalized dot product for xarray objects.
classxarray.computation.rolling.Coarsen
A object that implements the coarsen.
classxarray.computation.rolling.Rolling
A object that implements the moving window pattern.
classxarray.computation.rolling_exp.RollingExp
Exponentially-weighted moving window object.
methodxarray.computation.rolling_exp.RollingExp.corr(other:T_DataWithCoords) -> T_DataWithCoords
Exponentially weighted moving correlation.
methodxarray.computation.rolling_exp.RollingExp.cov(other:T_DataWithCoords) -> T_DataWithCoords
Exponentially weighted moving covariance.
methodxarray.computation.rolling_exp.RollingExp.mean(keep_attrs:bool | None=None) -> T_DataWithCoords
Exponentially weighted moving average.
methodxarray.computation.rolling_exp.RollingExp.std() -> T_DataWithCoords
Exponentially weighted moving standard deviation.
methodxarray.computation.rolling_exp.RollingExp.sum(keep_attrs:bool | None=None) -> T_DataWithCoords
Exponentially weighted moving sum.
methodxarray.computation.rolling_exp.RollingExp.var() -> T_DataWithCoords
Exponentially weighted moving variance.
classxarray.computation.weighted.Weighted
An object that implements weighted operations.
funcxarray.convert.from_iris(cube)
Convert an Iris cube into a DataArray
funcxarray.convert.to_iris(dataarray)
Convert a DataArray into an Iris Cube
classxarray.core.accessor_str.StringAccessor
Vectorized string functions for string-like arrays.
methodxarray.core.accessor_str.StringAccessor.capitalize() -> T_DataArray
Convert strings in the array to be capitalized.
methodxarray.core.accessor_str.StringAccessor.casefold() -> T_DataArray
Convert strings in the array to be casefolded.
methodxarray.core.accessor_str.StringAccessor.cat(*sep:str | bytes | Any='', *others) -> T_DataArray
Concatenate strings elementwise in the DataArray with other strings.
methodxarray.core.accessor_str.StringAccessor.center(width:int | Any, fillchar:str | bytes | Any=' ') -> T_DataArray
Pad left and right side of each string in the array.
methodxarray.core.accessor_str.StringAccessor.endswith(pat:str | bytes | Any) -> T_DataArray
Test if the end of each string in the array matches a pattern.
methodxarray.core.accessor_str.StringAccessor.get(i:int | Any, default:str | bytes='') -> T_DataArray
Extract character number `i` from each string in the array.
methodxarray.core.accessor_str.StringAccessor.get_dummies(dim:Hashable, sep:str | bytes | Any='|') -> DataArray
Return DataArray of dummy/indicator variables.
methodxarray.core.accessor_str.StringAccessor.join(dim:Hashable=None, sep:str | bytes | Any='') -> T_DataArray
Concatenate strings in a DataArray along a particular dimension.
methodxarray.core.accessor_str.StringAccessor.len() -> T_DataArray
Compute the length of each string in the array.
methodxarray.core.accessor_str.StringAccessor.ljust(width:int | Any, fillchar:str | bytes | Any=' ') -> T_DataArray
Pad right side of each string in the array.
methodxarray.core.accessor_str.StringAccessor.lower() -> T_DataArray
Convert strings in the array to lowercase.
methodxarray.core.accessor_str.StringAccessor.lstrip(to_strip:str | bytes | Any=None) -> T_DataArray
Remove leading characters.
methodxarray.core.accessor_str.StringAccessor.normalize(form:str) -> T_DataArray
Return the Unicode normal form for the strings in the datarray.
methodxarray.core.accessor_str.StringAccessor.pad(width:int | Any, side:str='left', fillchar:str | bytes | Any=' ') -> T_DataArray
Pad strings in the array up to width.
methodxarray.core.accessor_str.StringAccessor.repeat(repeats:int | Any) -> T_DataArray
Repeat each string in the array.
methodxarray.core.accessor_str.StringAccessor.rjust(width:int | Any, fillchar:str | bytes | Any=' ') -> T_DataArray
Pad left side of each string in the array.
methodxarray.core.accessor_str.StringAccessor.rstrip(to_strip:str | bytes | Any=None) -> T_DataArray
Remove trailing characters.
methodxarray.core.accessor_str.StringAccessor.slice(start:int | Any | None=None, stop:int | Any | None=None, step:int | Any | None=None) -> T_DataArray
Slice substrings from each string in the array.
methodxarray.core.accessor_str.StringAccessor.startswith(pat:str | bytes | Any) -> T_DataArray
Test if the start of each string in the array matches a pattern.
methodxarray.core.accessor_str.StringAccessor.strip(to_strip:str | bytes | Any=None, side:str='both') -> T_DataArray
Remove leading and trailing characters.
methodxarray.core.accessor_str.StringAccessor.swapcase() -> T_DataArray
Convert strings in the array to be swapcased.
methodxarray.core.accessor_str.StringAccessor.title() -> T_DataArray
Convert strings in the array to titlecase.
methodxarray.core.accessor_str.StringAccessor.upper() -> T_DataArray
Convert strings in the array to uppercase.
methodxarray.core.accessor_str.StringAccessor.zfill(width:int | Any) -> T_DataArray
Pad each string in the array by prepending '0' characters.
classxarray.core.common.AbstractArray
Shared base class for DataArray and Variable.
methodxarray.core.common.AbstractArray.sizes() -> Mapping[Hashable, int]
Ordered mapping from dimension names to lengths.
classxarray.core.common.AttrAccessMixin
Mixin class that allows getting keys with attribute access
classxarray.core.common.DataWithCoords
Shared base class for Dataset and DataArray.
methodxarray.core.common.DataWithCoords.assign_attrs(*args:Any, **kwargs:Any) -> Self
Assign new attrs to this object.
methodxarray.core.common.DataWithCoords.assign_coords(coords:Mapping | None=None, **coords_kwargs:Any) -> Self
Assign new coordinates to this object.
methodxarray.core.common.DataWithCoords.close() -> None
Release any resources linked to this object.
methodxarray.core.common.DataWithCoords.isin(test_elements:Any) -> Self
Tests each value in the array for whether it is in test elements.
methodxarray.core.common.DataWithCoords.isnull(keep_attrs:bool | None=None) -> Self
Test each value in the array for whether it is a missing value.
methodxarray.core.common.DataWithCoords.rolling_exp(window:Mapping[Any, int] | None=None, window_type:str='span', **window_kwargs) -> RollingExp[T_DataWithCoords]
Exponentially-weighted moving window.
methodxarray.core.common.DataWithCoords.squeeze(dim:Hashable | Iterable[Hashable] | None=None, drop:bool=False, axis:int | Iterable[int] | None=None) -> Self
Return a new object with squeezed data.
methodxarray.core.common.DataWithCoords.where(cond:Any, other:Any=dtypes.NA, drop:bool=False) -> Self
Filter elements from this object according to a condition.
classxarray.core.common.TreeAttrAccessMixin
Mixin class that allows getting keys with attribute access
funcxarray.core.common.contains_cftime_datetimes(var:T_Variable) -> bool
Check if an xarray.Variable contains cftime.datetime objects
funcxarray.core.common.get_squeeze_dims(xarray_obj, dim:Hashable | Iterable[Hashable] | None=None, axis:int | Iterable[int] | None=None) -> list[Hashable]
Get a list of dimensions to squeeze out.
funcxarray.core.common.is_np_datetime_like(dtype:DTypeLike | None) -> bool
Check if a dtype is a subclass of the numpy datetime types
funcxarray.core.common.is_np_timedelta_like(dtype:DTypeLike | None) -> bool
Check whether dtype is of the timedelta64 dtype.
classxarray.core.coordinates.CoordinateValidationError
Error class for Xarray coordinate validation failures.
classxarray.core.dataarray.DataArray
N-dimensional array with labeled coordinates and dimensions.
methodxarray.core.dataarray.DataArray.attrs() -> dict[Any, Any]
Dictionary storing arbitrary metadata with this array.
methodxarray.core.dataarray.DataArray.combine_first(other:Self) -> Self
Combine two DataArray objects, with union of coordinates.
methodxarray.core.dataarray.DataArray.convert_calendar(calendar:str, dim:str='time', align_on:str | None=None, missing:Any | None=None, use_cftime:bool | None=None) -> Self
Convert the DataArray to another calendar.
methodxarray.core.dataarray.DataArray.copy(deep:bool=True, data:Any=None) -> Self
Returns a copy of this array.
methodxarray.core.dataarray.DataArray.cumulative(dim:str | Iterable[Hashable], min_periods:int=1) -> DataArrayRolling
Accumulating object for DataArrays.
methodxarray.core.dataarray.DataArray.data() -> Any
The DataArray's data as an array.
methodxarray.core.dataarray.DataArray.dims() -> tuple[Hashable, ...]
Tuple of dimension names associated with this array.
methodxarray.core.dataarray.DataArray.dot(other:T_Xarray, dim:Dims=None) -> T_Xarray
Perform dot product of two DataArrays along their shared dims.
methodxarray.core.dataarray.DataArray.drop_attrs(*deep:bool=True) -> Self
Removes all attributes from the DataArray.
methodxarray.core.dataarray.DataArray.drop_indexes(coord_names:Hashable | Iterable[Hashable], *errors:ErrorOptions='raise') -> Self
Drop the indexes assigned to the given coordinates.
methodxarray.core.dataarray.DataArray.drop_isel(indexers:Mapping[Any, Any] | None=None, **indexers_kwargs) -> Self
Drop index positions from this DataArray.
methodxarray.core.dataarray.DataArray.drop_sel(labels:Mapping[Any, Any] | None=None, *errors:ErrorOptions='raise', **labels_kwargs) -> Self
Drop index labels from this DataArray.
methodxarray.core.dataarray.DataArray.drop_vars(names:str | Iterable[Hashable] | Callable[[Self], str | Iterable[Hashable]], *errors:ErrorOptions='raise') -> Self
Returns an array with dropped variables.
methodxarray.core.dataarray.DataArray.dtype() -> np.dtype
Data-type of the array’s elements.
methodxarray.core.dataarray.DataArray.fillna(value:Any) -> Self
Fill missing values in this object.
methodxarray.core.dataarray.DataArray.from_iris(cube:iris_Cube) -> Self
Convert an iris.cube.Cube into an xarray.DataArray
methodxarray.core.dataarray.DataArray.from_series(series:pd.Series, sparse:bool=False) -> DataArray
Convert a pandas.Series into an xarray.DataArray.
methodxarray.core.dataarray.DataArray.imag() -> Self
The imaginary part of the array.
methodxarray.core.dataarray.DataArray.load(**kwargs) -> Self
Trigger loading data into memory and return this dataarray.
methodxarray.core.dataarray.DataArray.loc() -> _LocIndexer
Attribute for location based indexing like pandas.
methodxarray.core.dataarray.DataArray.name() -> Hashable | None
The name of this array.
methodxarray.core.dataarray.DataArray.ndim() -> int
Number of array dimensions.
methodxarray.core.dataarray.DataArray.polyfit(dim:Hashable, deg:int, skipna:bool | None=None, rcond:float | None=None, w:Hashable | Any | None=None, full:bool=False, cov:bool | Literal['unscaled']=False) -> Dataset
Least squares polynomial fit.
methodxarray.core.dataarray.DataArray.rank(dim:Hashable, *pct:bool=False, *keep_attrs:bool | None=None) -> Self
Ranks the data.
methodxarray.core.dataarray.DataArray.real() -> Self
The real part of the array.
methodxarray.core.dataarray.DataArray.reorder_levels(dim_order:Mapping[Any, Sequence[int | Hashable]] | None=None, **dim_order_kwargs:Sequence[int | Hashable]) -> Self
Rearrange index levels using input order.
methodxarray.core.dataarray.DataArray.reset_index(dims_or_levels:Hashable | Sequence[Hashable], drop:bool=False) -> Self
Reset the specified index(es) or multi-index level(s).
methodxarray.core.dataarray.DataArray.rolling(dim:Mapping[Any, int] | None=None, min_periods:int | None=None, center:bool | Mapping[Any, bool]=False, **window_kwargs:int) -> DataArrayRolling
Rolling window object for DataArrays.
methodxarray.core.dataarray.DataArray.shape() -> tuple[int, ...]
Tuple of array dimensions.
methodxarray.core.dataarray.DataArray.size() -> int
Number of elements in the array.
methodxarray.core.dataarray.DataArray.swap_dims(dims_dict:Mapping[Any, Hashable] | None=None, **dims_kwargs) -> Self
Returns a new DataArray with swapped dimensions.
methodxarray.core.dataarray.DataArray.to_dask_dataframe(dim_order:Sequence[Hashable] | None=None, set_index:bool=False) -> DaskDataFrame
Convert this array into a dask.dataframe.DataFrame.
methodxarray.core.dataarray.DataArray.to_dataset(dim:Hashable=None, *name:Hashable=None, *promote_attrs:bool=False) -> Dataset
Convert a DataArray to a Dataset.
methodxarray.core.dataarray.DataArray.to_index() -> pd.Index
Convert this variable to a pandas.Index.
methodxarray.core.dataarray.DataArray.to_iris() -> iris_Cube
Convert this array into an iris.cube.Cube
methodxarray.core.dataarray.DataArray.to_numpy() -> np.ndarray
Coerces wrapped data to numpy and returns a numpy.ndarray.
methodxarray.core.dataarray.DataArray.to_series() -> pd.Series
Convert this array into a pandas.Series.
methodxarray.core.dataarray.DataArray.transpose(*transpose_coords:bool=True, *missing_dims:ErrorOptionsWithWarn='raise', *dim:Hashable) -> Self
Return a new DataArray object with transposed dimensions.
methodxarray.core.dataarray.DataArray.values() -> np.ndarray
The array's data converted to numpy.ndarray.
methodxarray.core.dataarray.DataArray.weighted(weights:DataArray) -> DataArrayWeighted
Weighted DataArray operations.
funcxarray.core.dataset_utils.as_dataset(obj:Any) -> Dataset
Cast the given object to a Dataset.
classxarray.core.datatree.DataTree
A tree-like hierarchical collection of xarray objects.
methodxarray.core.datatree.DataTree.attrs() -> dict[Hashable, Any]
Dictionary of global attributes on this node object.
methodxarray.core.datatree.DataTree.close() -> None
Close any files associated with this tree.
methodxarray.core.datatree.DataTree.dims() -> Mapping[Hashable, int]
Mapping from dimension names to lengths.
methodxarray.core.datatree.DataTree.drop_nodes(names:str | Iterable[str], *errors:ErrorOptions='raise') -> DataTree
Drop child nodes from this node.
methodxarray.core.datatree.DataTree.filter(filterfunc:Callable[[DataTree], bool]) -> DataTree
Filter nodes according to a specified condition.
methodxarray.core.datatree.DataTree.filter_like(other:DataTree) -> DataTree
Filter a datatree like another datatree.
methodxarray.core.datatree.DataTree.has_data() -> bool
Whether or not there are any variables in this node.
methodxarray.core.datatree.DataTree.is_empty() -> bool
False if node contains any data or attrs.
methodxarray.core.datatree.DataTree.is_hollow() -> bool
True if only leaf nodes contain data.
methodxarray.core.datatree.DataTree.match(pattern:str) -> DataTree
Return nodes with paths matching pattern.
methodxarray.core.datatree.DataTree.persist(**kwargs) -> Self
Trigger computation, keeping data as chunked arrays.
methodxarray.core.datatree.DataTree.prune(drop_size_zero_vars:bool=False) -> DataTree
Remove empty nodes from the tree.
methodxarray.core.datatree.DataTree.set_close(close:Callable[[], None] | None) -> None
Set the closer for this node.
methodxarray.core.datatree.DataTree.sizes() -> Mapping[Hashable, int]
Mapping from dimension names to lengths.
funcxarray.core.datatree_mapping.add_path_context_to_errors(path:str)
Add path context to any errors.
funcxarray.core.dtypes.is_datetime_like(dtype) -> bool
Check if a dtype is a subclass of the numpy datetime types
funcxarray.core.dtypes.is_object(dtype) -> bool
Check if a dtype is object
funcxarray.core.dtypes.is_string(dtype) -> bool
Check if a dtype is a string dtype
funcxarray.core.dtypes.isdtype(dtype, kind:str | tuple[str, ...], xp=None) -> bool
Compatibility wrapper for isdtype() from the array API standard.
funcxarray.core.duck_array_ops.cumprod(array, axis=None, **kwargs)
N-dimensional version of cumprod.
funcxarray.core.duck_array_ops.cumsum(array, axis=None, **kwargs)
N-dimensional version of cumsum.
funcxarray.core.duck_array_ops.isna(data:Any) -> bool
Checks if data is literally np.nan or pd.NA.
classxarray.core.eval.LogicalOperatorTransformer
Transform operators for consistency with query().
funcxarray.core.eval.validate_expression(tree:ast.AST) -> None
Validate that an AST doesn't contain patterns we don't support.
classxarray.core.extension_array.PandasExtensionArray
NEP-18 compliant wrapper for pandas extension arrays.
funcxarray.core.extension_array.implements(numpy_function_or_name:Callable | str) -> Callable
Register an __array_function__ implementation.
classxarray.core.extensions.AccessorRegistrationWarning
Warning for conflicts in accessor registration.
funcxarray.core.formatting.calc_max_rows_first(max_rows:int) -> int
Calculate the first rows to maintain the max number of rows.
funcxarray.core.formatting.calc_max_rows_last(max_rows:int) -> int
Calculate the last rows to maintain the max number of rows.
funcxarray.core.formatting.datatree_repr(dt:DataTree) -> str
A printable representation of the structure of this entire tree.
funcxarray.core.formatting.diff_indexes_repr(a_indexes, b_indexes, col_width:int=20) -> str
Generate diff representation for indexes.
funcxarray.core.formatting.diff_treestructure(a:DataTree, b:DataTree) -> str | None
Return a summary of why two trees are not isomorphic.
funcxarray.core.formatting.last_item(array)
Returns the last item of an array.
funcxarray.core.formatting.short_data_repr(array)
Format "data" for DataArray and Variable.
funcxarray.core.formatting_html.short_data_repr_html(array) -> str
Format "data" for DataArray and Variable.
classxarray.core.groupby.ComposedGrouper
Helper class for multi-variable GroupBy.
classxarray.core.groupby.DataArrayGroupByBase
GroupBy object specialized to grouping DataArray objects
classxarray.core.groupby.GroupBy
A object that implements the split-apply-combine pattern.
methodxarray.core.groupby.GroupBy.assign_coords(coords=None, **coords_kwargs)
Assign coordinates by group.
methodxarray.core.groupby.GroupBy.fillna(value:Any) -> T_Xarray
Fill missing values in this object by group.
methodxarray.core.groupby.GroupBy.groups() -> dict[GroupKey, GroupIndex]
Mapping from group labels to indices.
methodxarray.core.groupby.GroupBy.shuffle_to_chunks(chunks:T_Chunks=None) -> T_Xarray
Sort or "shuffle" the underlying object.
methodxarray.core.groupby.GroupBy.sizes() -> Mapping[Hashable, int]
Ordered mapping from dimension names to lengths.
classxarray.core.groupby.ResolvedGrouper
Wrapper around a Grouper object.
methodxarray.core.groupby.ResolvedGrouper.name() -> Hashable
Name for the grouped coordinate after reduction.
methodxarray.core.groupby.ResolvedGrouper.size() -> int
Number of groups.
classxarray.core.indexes.Index
Base class inherited by all xarray-compatible indexes.
methodxarray.core.indexes.Index.copy(deep:bool=True) -> Self
Return a (deep) copy of this index.
methodxarray.core.indexes.Index.create_variables(variables:Mapping[Any, Variable] | None=None) -> IndexVars
Maybe create new coordinate variables from this index.
methodxarray.core.indexes.Index.reindex_like(other:Self) -> dict[Hashable, Any]
Query the index with another index of the same type.
methodxarray.core.indexes.Index.roll(shifts:Mapping[Any, int]) -> Self | None
Roll this index by an offset along one or more dimensions.
methodxarray.core.indexes.Index.sel(labels:dict[Any, Any]) -> IndexSelResult
Query the index with arbitrary coordinate label indexers.
classxarray.core.indexes.Indexes
Immutable proxy for Dataset or DataArray indexes.
methodxarray.core.indexes.Indexes.get_all_coords(key:Hashable, errors:ErrorOptions='raise') -> dict[Hashable, Variable]
Return all coordinates having the same index.
methodxarray.core.indexes.Indexes.get_all_dims(key:Hashable, errors:ErrorOptions='raise') -> Mapping[Hashable, int]
Return all dimensions shared by an index.
methodxarray.core.indexes.Indexes.get_unique() -> list[T_PandasOrXarrayIndex]
Return a list of unique indexes, preserving order.
classxarray.core.indexes.PandasIndex
Wrap a pandas.Index as an xarray compatible index.
classxarray.core.indexes.PandasMultiIndex
Wrap a pandas.MultiIndex as an xarray compatible index.
funcxarray.core.indexes.default_indexes(coords:Mapping[Any, Variable], dims:Iterable) -> dict[Hashable, Index]
Default indexes for a Dataset/DataArray.
funcxarray.core.indexes.indexes_all_equal(elements:Sequence[tuple[Index, dict[Hashable, Variable]]], exclude_dims:frozenset[Hashable]) -> bool
Check if indexes are all equal.
funcxarray.core.indexes.indexes_identical(a_indexes:Indexes[Index], b_indexes:Indexes[Index]) -> bool
Check if two Indexes objects are identical.
funcxarray.core.indexes.safe_cast_to_index(array:Any) -> pd.Index
Given an array, safely cast it to a pandas.Index.
classxarray.core.indexing.ArrayApiIndexingAdapter
Wrap an array API array to use explicit indexing.
classxarray.core.indexing.BasicIndexer
Tuple for basic indexing.
classxarray.core.indexing.CoordinateTransformIndexingAdapter
Wrap a CoordinateTransform as a lazy coordinate array.
classxarray.core.indexing.DaskIndexingAdapter
Wrap a dask array to support explicit indexing.
classxarray.core.indexing.ExplicitIndexer
Base class for explicit indexer objects.
classxarray.core.indexing.ExplicitlyIndexed
Mixin to mark support for Indexer subclasses in indexing.
classxarray.core.indexing.IndexCallable
Provide getitem and setitem syntax for callable objects.
classxarray.core.indexing.IndexSelResult
Index query results.
classxarray.core.indexing.IndexingAdapter
Marker class for indexing adapters.
classxarray.core.indexing.LazilyIndexedArray
Wrap an array to make basic and outer indexing lazy.
classxarray.core.indexing.LazilyVectorizedIndexedArray
Wrap an array to make vectorized indexing lazy.
classxarray.core.indexing.NumpyIndexingAdapter
Wrap a NumPy array to use explicit indexing.
classxarray.core.indexing.OuterIndexer
Tuple for outer/orthogonal indexing.
classxarray.core.indexing.PandasMultiIndexingAdapter
Handles explicit indexing for a pandas.MultiIndex.
classxarray.core.indexing.VectorizedIndexer
Tuple for vectorized indexing.
funcxarray.core.indexing.apply_indexer(indexable, indexer:ExplicitIndexer)
Apply an indexer to an indexable object.
funcxarray.core.indexing.set_with_indexer(indexable, indexer:ExplicitIndexer, value:Any) -> None
Set values in an indexable object using an indexer.
classxarray.core.missing.NumpyInterpolator
One-dimensional linear interpolation.
funcxarray.core.missing.bfill(arr, dim=None, limit=None)
backfill missing values
funcxarray.core.missing.ffill(arr, dim=None, limit=None)
forward fill missing values
classxarray.core.nputils.NumpyVIndexAdapter
Object that implements indexing like vindex on an np.ndarray.
funcxarray.core.nputils.inverse_permutation(indices:np.ndarray, N:int | None=None) -> np.ndarray
Return indices for an inverse permutation.
funcxarray.core.options.get_options()
Get options for xarray.
classxarray.core.options.set_options
Set options for xarray in a controlled context.
classxarray.core.treenode.NamedNode
A TreeNode which knows its own name.
methodxarray.core.treenode.NamedNode.find_common_ancestor(other:Self) -> Self
Find the first common ancestor of two nodes in the same tree.
methodxarray.core.treenode.NamedNode.name() -> str | None
The name of this node.
methodxarray.core.treenode.NamedNode.path() -> str
Return the file-like path from the root to this node.
methodxarray.core.treenode.NamedNode.relative_to(other:Self) -> str
Compute the relative path from this node to node `other`.
classxarray.core.treenode.NodePath
Represents a path from one node to another within a tree.
methodxarray.core.treenode.NodePath.absolute() -> Self
Convert into an absolute path.
methodxarray.core.treenode.TreeNode.copy(*inherit:bool=True, *deep:bool=False) -> Self
Returns a copy of this subtree.
methodxarray.core.treenode.TreeNode.depth() -> int
Maximum level of this tree.
methodxarray.core.treenode.TreeNode.descendants() -> tuple[Self, ...]
Child nodes and all their child nodes.
methodxarray.core.treenode.TreeNode.get(key:str, default:Self | None=None) -> Self | None
Return the child node with the specified key.
methodxarray.core.treenode.TreeNode.is_leaf() -> bool
Whether this node is a leaf node.
methodxarray.core.treenode.TreeNode.is_root() -> bool
Whether this node is the tree root.
methodxarray.core.treenode.TreeNode.iter_lineage() -> tuple[Self, ...]
Iterate up the tree, starting from the current node.
methodxarray.core.treenode.TreeNode.leaves() -> tuple[Self, ...]
All leaf nodes.
methodxarray.core.treenode.TreeNode.level() -> int
Level of this node.
methodxarray.core.treenode.TreeNode.orphan() -> None
Detach this node from its parent.
methodxarray.core.treenode.TreeNode.parent() -> Self | None
Parent of this node.
methodxarray.core.treenode.TreeNode.root() -> Self
Root node of the tree
methodxarray.core.treenode.TreeNode.same_tree(other:Self) -> bool
True if other node is in the same tree as this node.
methodxarray.core.treenode.TreeNode.siblings() -> dict[str, Self]
Nodes with the same parent as this node.
methodxarray.core.treenode.TreeNode.width() -> int
Number of nodes at this level in the tree.
funcxarray.core.treenode.zip_subtrees(*trees:AnyNamedNode) -> Iterator[tuple[AnyNamedNode, ...]]
Zip together subtrees aligned by relative path.
classxarray.core.types.Alignable
Represents any Xarray type that supports alignment.
classxarray.core.utils.FilteredMapping
Implements the Mapping interface.
classxarray.core.utils.HiddenKeyDict
Acts like a normal dictionary, but hides certain keys.
classxarray.core.utils.OrderedSet
A simple ordered set.
funcxarray.core.utils.dict_equiv(first:Mapping[K, V], second:Mapping[K, V], compat:Callable[[V, V], bool]=equivalent) -> bool
Test equivalence of two dict-like objects.
funcxarray.core.utils.hashable(v:Any) -> TypeGuard[Hashable]
Determine whether `v` can be hashed.
funcxarray.core.utils.is_scalar(value:Any, include_0d:bool=True) -> TypeGuard[Hashable]
Whether to treat a value as a scalar.
funcxarray.core.utils.iterable(v:Any) -> TypeGuard[Iterable[Any]]
Determine whether `v` is iterable.
funcxarray.core.utils.iterable_of_hashable(v:Any) -> TypeGuard[Iterable[Hashable]]
Determine whether `v` is an Iterable of Hashables.
funcxarray.core.utils.strip_uri_params(uri:str) -> str
Strip query parameters and fragments from a URI.
funcxarray.core.utils.to_0d_array(value:Any) -> np.ndarray
Given a value, wrap it in a 0-D numpy.ndarray.
classxarray.core.variable.IndexVariable
Wrapper for accommodating a pandas.Index in an xarray.Variable.
methodxarray.core.variable.IndexVariable.copy(deep:bool=True, data:T_DuckArray | np.typing.ArrayLike | None=None)
Returns a copy of this object.
methodxarray.core.variable.IndexVariable.to_index() -> pd.Index
Convert this variable to a pandas.Index
methodxarray.core.variable.IndexVariable.to_index_variable() -> IndexVariable
Return this variable as an xarray.IndexVariable
methodxarray.core.variable.Variable.coarsen(windows, func, boundary='exact', side='left', keep_attrs=None, **kwargs)
Apply reduction function.
methodxarray.core.variable.Variable.data()
The Variable's data as an array.
methodxarray.core.variable.Variable.drop_encoding() -> Self
Return a new Variable without encoding.
methodxarray.core.variable.Variable.encoding() -> dict[Any, Any]
Dictionary of encodings on this variable.
methodxarray.core.variable.Variable.imag() -> Variable
The imaginary part of the variable.
methodxarray.core.variable.Variable.load(**kwargs) -> Self
Trigger loading data into memory and return this variable.
methodxarray.core.variable.Variable.rank(dim, pct=False)
Ranks the data.
methodxarray.core.variable.Variable.real() -> Variable
The real part of the variable.
methodxarray.core.variable.Variable.to_base_variable() -> Variable
Return this variable as a base xarray.Variable
methodxarray.core.variable.Variable.to_dict(data:bool | Literal['list', 'array']='list', encoding:bool=False) -> dict[str, Any]
Dictionary representation of variable.
methodxarray.core.variable.Variable.to_index() -> pd.Index
Convert this variable to a pandas.Index
methodxarray.core.variable.Variable.to_index_variable() -> IndexVariable
Return this variable as an xarray.IndexVariable
methodxarray.core.variable.Variable.transpose(*missing_dims:ErrorOptionsWithWarn='raise', *dim:Hashable | EllipsisType) -> Self
Return a new Variable object with transposed dimensions.
methodxarray.core.variable.Variable.values() -> np.ndarray
The variable's data as a numpy.ndarray
funcxarray.core.variable.as_compatible_data(data:T_DuckArray | np.typing.ArrayLike, fastpath:bool=False) -> T_DuckArray
Prepare and wrap data to put in a Variable.
funcxarray.core.variable.as_variable(obj:T_DuckArray | Any, name=None, auto_convert:bool=True) -> Variable | IndexVariable
Convert an object into a Variable.
funcxarray.core.variable.calculate_dimensions(variables:Mapping[Any, Variable]) -> dict[Hashable, int]
Calculate the dimensions corresponding to a set of variables.
classxarray.groupers.BinGrouper
Grouper object for binning numeric data.
classxarray.groupers.EncodedGroups
Dataclass for storing intermediate values for GroupBy operation.
methodxarray.groupers.Grouper.factorize(group:T_Group) -> EncodedGroups
Creates intermediates necessary for GroupBy.
methodxarray.groupers.Grouper.reset() -> Self
Creates a new version of this Grouper clearing any caches.
classxarray.groupers.SeasonGrouper
Allows grouping using a custom definition of seasons.
classxarray.groupers.SeasonResampler
Allows grouping using a custom definition of seasons.
methodxarray.groupers.SeasonResampler.compute_chunks(variable:Variable, *dim:Hashable) -> tuple[int, ...]
Compute chunk sizes for this season resampler.
classxarray.groupers.TimeResampler
Grouper object specialized to resampling the time coordinate.
methodxarray.groupers.TimeResampler.compute_chunks(variable:Variable, *dim:Hashable) -> tuple[int, ...]
Compute chunk sizes for this time resampler.
classxarray.groupers.UniqueGrouper
Grouper object for grouping by a categorical variable.
methodxarray.groupers.UniqueGrouper.group_as_index() -> pd.Index
Caches the group DataArray as a pandas Index.
funcxarray.groupers.find_independent_seasons(seasons:Sequence[str]) -> Sequence[SeasonsGroup]
Iterates though a list of seasons e.g.
funcxarray.groupers.unique_value_groups(ar, sort:bool=True) -> tuple[np.ndarray | pd.Index, np.ndarray]
Group an array by its unique values.
classxarray.indexes.nd_point_index.NDPointIndex
Xarray index for irregular, n-dimensional data.
methodxarray.indexes.range_index.RangeIndex.equals(other:'Index', *exclude:frozenset[Hashable] | None=None, *exact:bool=False) -> bool
Check equality with another RangeIndex.
methodxarray.indexes.range_index.RangeIndex.step() -> float
Returns the spacing between values.
funcxarray.namedarray._array_api.permute_dims(x:NamedArray[Any, _DType], axes:_Axes) -> NamedArray[Any, _DType]
Permutes the dimensions of an array.
funcxarray.namedarray.dtypes.get_fill_value(dtype:np.dtype[np.generic]) -> Any
Return an appropriate fill value for this dtype.
classxarray.namedarray.pycompat.DuckArrayModule
Solely for internal isinstance and version checks.
funcxarray.namedarray.pycompat.array_type(mod:ModType) -> DuckArrayTypes
Quick wrapper to get the array class of the module.
funcxarray.namedarray.pycompat.mod_version(mod:ModType) -> Version
Quick wrapper to get the version of the module.
funcxarray.namedarray.utils.module_available(module:str, minversion:str | None=None) -> bool
Checks whether a module is installed without importing it.
funcxarray.namedarray.utils.to_0d_object_array(value:object) -> NDArray[np.object_]
Given a value, wrap it in a 0-D numpy.ndarray with dtype=object.
classxarray.plot.facetgrid.FacetGrid
Initialize the Matplotlib figure and FacetGrid object.
methodxarray.plot.facetgrid.FacetGrid.add_colorbar(**kwargs:Any) -> None
Draw a colorbar.
methodxarray.plot.facetgrid.FacetGrid.map(func:Callable, *args:Hashable, **kwargs:Any) -> T_FacetGrid
Apply a plotting function to each facet's subset of the data.
methodxarray.plot.facetgrid.FacetGrid.set_axis_labels(*axlabels:Hashable) -> None
Set axis labels on the left column and bottom row of the grid.
methodxarray.plot.facetgrid.FacetGrid.set_ticks(max_xticks:int=_NTICKS, max_yticks:int=_NTICKS, fontsize:str | int=_FONTSIZE) -> None
Set and control tick behavior.
methodxarray.plot.facetgrid.FacetGrid.set_xlabels(label:str | None=None, **kwargs:Any) -> None
Label the x axis on the bottom row of the grid.
methodxarray.plot.facetgrid.FacetGrid.set_ylabels(label:str | None=None, **kwargs:Any) -> None
Label the y axis on the left column of the grid.
methodxarray.plot.facetgrid.FacetGrid.set_zlabels(label:str | None=None, **kwargs:Any) -> None
Label the z axis.
funcxarray.structure.combine.groupby_defaultdict(iter:list[T], key:Callable[[T], K]) -> Iterator[tuple[K, Iterator[T]]]
replacement for itertools.groupby
classxarray.structure.merge.Context
object carrying the information of a call
classxarray.structure.merge.MergeError
Error class for merge failures due to incompatible arguments.
funcxarray.structure.merge.broadcast_dimension_size(variables:list[Variable]) -> dict[Hashable, int]
Extract dimension sizes from a dictionary of variables.
funcxarray.structure.merge.coerce_pandas_values(objects:Iterable[CoercibleMapping]) -> list[DatasetLike]
Convert pandas values found in a list of labeled objects.
funcxarray.structure.merge.dataset_update_method(dataset:Dataset, other:CoercibleMapping) -> _MergeResult
Guts of the Dataset.update method.
funcxarray.structure.merge.equivalent_attrs(a:Any, b:Any) -> bool
Check if two attribute values are equivalent.
funcxarray.structure.merge.merge_data_and_coords(data_vars:DataVars, coords) -> _MergeResult
Used in Dataset.__init__.
funcxarray.tutorial.scatter_example_dataset(*seed:int | None=None) -> Dataset
Create an example dataset.
funcxarray.util.generate_ops.render(ops_info:dict[str, list[OpsType]]) -> Iterator[str]
Render the module or stub file.
funcxarray.util.print_versions.get_sys_info()
Returns system information as a dict

About this data

These signatures were extracted from the public source of pydata/xarray using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries