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
| Kind | Count |
|---|---|
| Classes | 84 |
| Functions | 82 |
| Methods | 169 |
API list
class
xarray.backends.common.BytesIOProxyProxy object for a write that a memoryview.
method
xarray.backends.common.BytesIOProxy.getbuffer() -> memoryviewGet the value of this write as bytes or memory.
func
xarray.backends.common.collect_ancestor_dimensions(group) -> dict[str, int]Returns dimensions defined in parent groups.
func
xarray.backends.common.datatree_from_dict_with_io_cleanup(groups_dict:Mapping[str, Dataset]) -> DataTreeDataTree.from_dict with file clean-up.
method
xarray.backends.file_manager.CachingFileManager.acquire(needs_lock:bool=True) -> T_FileAcquire a file object from the manager.
method
xarray.backends.file_manager.CachingFileManager.acquire_context(needs_lock:bool=True) -> Iterator[T_File]Context manager for acquiring a file.
method
xarray.backends.file_manager.CachingFileManager.close(needs_lock:bool=True) -> NoneExplicitly close any associated file object (if necessary).
class
xarray.backends.file_manager.FileManagerManager for acquiring and closing a file object.
method
xarray.backends.file_manager.FileManager.acquire(needs_lock:bool=True) -> T_FileAcquire the file object from this manager.
method
xarray.backends.file_manager.FileManager.acquire_context(needs_lock:bool=True) -> AbstractContextManager[T_File]Context manager for acquiring a file.
method
xarray.backends.file_manager.FileManager.close(needs_lock:bool=True) -> NoneClose the file object associated with this manager, if needed.
class
xarray.backends.h5netcdf_.H5NetCDFStoreStore for reading and writing data via h5netcdf
class
xarray.backends.h5netcdf_.H5netcdfBackendEntrypointBackend for netCDF files based on the h5netcdf package.
class
xarray.backends.locks.CombinedLockA combination of multiple locks.
class
xarray.backends.locks.DummyLockDummyLock provides the lock API without any actual locking.
func
xarray.backends.locks.combine_locks(locks:Sequence[Lock]) -> LockCombine a sequence of locks into a single lock.
func
xarray.backends.locks.ensure_lock(lock:Lock | None | Literal[False]) -> LockEnsure that the given object is a lock.
func
xarray.backends.locks.get_dask_scheduler(get=None, collection=None) -> str | NoneDetermine the dask scheduler that is being used.
func
xarray.backends.locks.get_write_lock(key:str) -> LockGet a scheduler appropriate lock for writing to the given resource.
class
xarray.backends.lru_cache.LRUCacheThread-safe LRUCache based on an OrderedDict.
method
xarray.backends.lru_cache.LRUCache.maxsize() -> intMaximum number of items can be held in the cache.
class
xarray.backends.netCDF4_.NetCDF4BackendEntrypointBackend for netCDF files based on the netCDF4 package.
func
xarray.backends.plugins.get_backend(engine:str | type[BackendEntrypoint]) -> BackendEntrypointSelect open_dataset method based on current engine.
func
xarray.backends.plugins.refresh_engines() -> NoneRefreshes the backend engines based on installed packages.
func
xarray.backends.pydap_.PydapBackendEntrypoint.group_fqn(store, path=None, g_fqn=None) -> dict[str, str]To be removed for pydap > 3.5.0.
class
xarray.backends.pydap_.PydapDataStoreStore for accessing OpenDAP datasets with pydap.
class
xarray.backends.scipy_.ScipyBackendEntrypointBackend for netCDF files based on the scipy package.
class
xarray.backends.scipy_.ScipyDataStoreStore for reading and writing data via scipy.io.netcdf_file.
class
xarray.backends.zarr.ZarrBackendEntrypointBackend for ".zarr" files based on the zarr package.
class
xarray.backends.zarr.ZarrStoreStore for reading and writing data via zarr
func
xarray.coding.cftime_offsets.cftime_range(start=None, end=None, periods=None, freq=None, normalize=False, name=None, inclusive:InclusiveOptions='both', calendar='standard') -> CFTimeIndexReturn a fixed frequency CFTimeIndex.
func
xarray.coding.cftime_offsets.delta_to_tick(delta:timedelta | pd.Timedelta) -> TickAdapted from pandas.tslib.delta_to_tick
func
xarray.coding.cftime_offsets.normalize_date(date)Round datetime down to midnight.
class
xarray.coding.common.SerializationWarningWarnings about encoding/decoding issues in serialization.
class
xarray.coding.common.VariableCoderBase class for encoding and decoding transformations on variables.
method
xarray.coding.common.VariableCoder.decode(variable:Variable, name:T_Name=None) -> VariableConvert a decoded variable to an encoded variable
method
xarray.coding.common.VariableCoder.encode(variable:Variable, name:T_Name=None) -> VariableConvert an encoded variable to a decoded variable
func
xarray.coding.common.pop_to(source:MutableMapping, dest:MutableMapping, key:Hashable, name:T_Name=None) -> AnyA convenience function which pops a key k from source to dest.
func
xarray.coding.frequencies.month_anchor_check(dates)Return the monthly offset string.
class
xarray.coding.times.CFDatetimeCoderCoder for CF Datetime coding.
class
xarray.coding.times.CFTimedeltaCoderCoder for CF Timedelta coding.
func
xarray.coding.times.infer_calendar_name(dates) -> CFCalendarGiven an array of datetimes, infer the CF calendar name
class
xarray.coding.variables.BooleanCoderCode boolean values.
class
xarray.coding.variables.CFMaskCoderMask or unmask fill values according to CF conventions.
class
xarray.coding.variables.CFScaleOffsetCoderScale and offset variables according to CF conventions.
class
xarray.coding.variables.DefaultFillvalueCoderEncode default _FillValue if needed.
class
xarray.coding.variables.EndianCoderDecode Endianness to native.
class
xarray.coding.variables.NativeEnumCoderEncode Enum into variable dtype metadata.
class
xarray.coding.variables.NonStringCoderEncode NonString variables if dtypes differ.
func
xarray.compat.dask_array_ops.push(array, n, axis, method='blelloch')Dask-aware bottleneck.push
func
xarray.compat.pdcompat.count_not_none(*args) -> intCompute the number of non-None arguments.
class
xarray.computation.arithmetic.SupportsArithmeticBase class for xarray types that support arithmetic.
func
xarray.computation.computation.cross(a:DataArray | Variable, b:DataArray | Variable, *dim:Hashable) -> DataArray | VariableCompute the cross product of two (arrays of) vectors.
func
xarray.computation.computation.dot(*dim:Dims=None, *arrays, **kwargs:Any)Generalized dot product for xarray objects.
class
xarray.computation.rolling.CoarsenA object that implements the coarsen.
class
xarray.computation.rolling.RollingA object that implements the moving window pattern.
class
xarray.computation.rolling_exp.RollingExpExponentially-weighted moving window object.
method
xarray.computation.rolling_exp.RollingExp.corr(other:T_DataWithCoords) -> T_DataWithCoordsExponentially weighted moving correlation.
method
xarray.computation.rolling_exp.RollingExp.cov(other:T_DataWithCoords) -> T_DataWithCoordsExponentially weighted moving covariance.
method
xarray.computation.rolling_exp.RollingExp.mean(keep_attrs:bool | None=None) -> T_DataWithCoordsExponentially weighted moving average.
method
xarray.computation.rolling_exp.RollingExp.std() -> T_DataWithCoordsExponentially weighted moving standard deviation.
method
xarray.computation.rolling_exp.RollingExp.sum(keep_attrs:bool | None=None) -> T_DataWithCoordsExponentially weighted moving sum.
method
xarray.computation.rolling_exp.RollingExp.var() -> T_DataWithCoordsExponentially weighted moving variance.
class
xarray.computation.weighted.WeightedAn object that implements weighted operations.
func
xarray.convert.from_iris(cube)Convert an Iris cube into a DataArray
func
xarray.convert.to_iris(dataarray)Convert a DataArray into an Iris Cube
class
xarray.core.accessor_str.StringAccessorVectorized string functions for string-like arrays.
method
xarray.core.accessor_str.StringAccessor.capitalize() -> T_DataArrayConvert strings in the array to be capitalized.
method
xarray.core.accessor_str.StringAccessor.casefold() -> T_DataArrayConvert strings in the array to be casefolded.
method
xarray.core.accessor_str.StringAccessor.cat(*sep:str | bytes | Any='', *others) -> T_DataArrayConcatenate strings elementwise in the DataArray with other strings.
method
xarray.core.accessor_str.StringAccessor.center(width:int | Any, fillchar:str | bytes | Any=' ') -> T_DataArrayPad left and right side of each string in the array.
method
xarray.core.accessor_str.StringAccessor.endswith(pat:str | bytes | Any) -> T_DataArrayTest if the end of each string in the array matches a pattern.
method
xarray.core.accessor_str.StringAccessor.get(i:int | Any, default:str | bytes='') -> T_DataArrayExtract character number `i` from each string in the array.
method
xarray.core.accessor_str.StringAccessor.get_dummies(dim:Hashable, sep:str | bytes | Any='|') -> DataArrayReturn DataArray of dummy/indicator variables.
method
xarray.core.accessor_str.StringAccessor.join(dim:Hashable=None, sep:str | bytes | Any='') -> T_DataArrayConcatenate strings in a DataArray along a particular dimension.
method
xarray.core.accessor_str.StringAccessor.len() -> T_DataArrayCompute the length of each string in the array.
method
xarray.core.accessor_str.StringAccessor.ljust(width:int | Any, fillchar:str | bytes | Any=' ') -> T_DataArrayPad right side of each string in the array.
method
xarray.core.accessor_str.StringAccessor.lower() -> T_DataArrayConvert strings in the array to lowercase.
method
xarray.core.accessor_str.StringAccessor.lstrip(to_strip:str | bytes | Any=None) -> T_DataArrayRemove leading characters.
method
xarray.core.accessor_str.StringAccessor.normalize(form:str) -> T_DataArrayReturn the Unicode normal form for the strings in the datarray.
method
xarray.core.accessor_str.StringAccessor.pad(width:int | Any, side:str='left', fillchar:str | bytes | Any=' ') -> T_DataArrayPad strings in the array up to width.
method
xarray.core.accessor_str.StringAccessor.repeat(repeats:int | Any) -> T_DataArrayRepeat each string in the array.
method
xarray.core.accessor_str.StringAccessor.rjust(width:int | Any, fillchar:str | bytes | Any=' ') -> T_DataArrayPad left side of each string in the array.
method
xarray.core.accessor_str.StringAccessor.rstrip(to_strip:str | bytes | Any=None) -> T_DataArrayRemove trailing characters.
method
xarray.core.accessor_str.StringAccessor.slice(start:int | Any | None=None, stop:int | Any | None=None, step:int | Any | None=None) -> T_DataArraySlice substrings from each string in the array.
method
xarray.core.accessor_str.StringAccessor.startswith(pat:str | bytes | Any) -> T_DataArrayTest if the start of each string in the array matches a pattern.
method
xarray.core.accessor_str.StringAccessor.strip(to_strip:str | bytes | Any=None, side:str='both') -> T_DataArrayRemove leading and trailing characters.
method
xarray.core.accessor_str.StringAccessor.swapcase() -> T_DataArrayConvert strings in the array to be swapcased.
method
xarray.core.accessor_str.StringAccessor.title() -> T_DataArrayConvert strings in the array to titlecase.
method
xarray.core.accessor_str.StringAccessor.upper() -> T_DataArrayConvert strings in the array to uppercase.
method
xarray.core.accessor_str.StringAccessor.zfill(width:int | Any) -> T_DataArrayPad each string in the array by prepending '0' characters.
class
xarray.core.common.AbstractArrayShared base class for DataArray and Variable.
method
xarray.core.common.AbstractArray.sizes() -> Mapping[Hashable, int]Ordered mapping from dimension names to lengths.
class
xarray.core.common.AttrAccessMixinMixin class that allows getting keys with attribute access
class
xarray.core.common.DataWithCoordsShared base class for Dataset and DataArray.
method
xarray.core.common.DataWithCoords.assign_attrs(*args:Any, **kwargs:Any) -> SelfAssign new attrs to this object.
method
xarray.core.common.DataWithCoords.assign_coords(coords:Mapping | None=None, **coords_kwargs:Any) -> SelfAssign new coordinates to this object.
method
xarray.core.common.DataWithCoords.close() -> NoneRelease any resources linked to this object.
method
xarray.core.common.DataWithCoords.isin(test_elements:Any) -> SelfTests each value in the array for whether it is in test elements.
method
xarray.core.common.DataWithCoords.isnull(keep_attrs:bool | None=None) -> SelfTest each value in the array for whether it is a missing value.
method
xarray.core.common.DataWithCoords.rolling_exp(window:Mapping[Any, int] | None=None, window_type:str='span', **window_kwargs) -> RollingExp[T_DataWithCoords]Exponentially-weighted moving window.
method
xarray.core.common.DataWithCoords.squeeze(dim:Hashable | Iterable[Hashable] | None=None, drop:bool=False, axis:int | Iterable[int] | None=None) -> SelfReturn a new object with squeezed data.
method
xarray.core.common.DataWithCoords.where(cond:Any, other:Any=dtypes.NA, drop:bool=False) -> SelfFilter elements from this object according to a condition.
class
xarray.core.common.TreeAttrAccessMixinMixin class that allows getting keys with attribute access
func
xarray.core.common.contains_cftime_datetimes(var:T_Variable) -> boolCheck if an xarray.Variable contains cftime.datetime objects
func
xarray.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.
func
xarray.core.common.is_np_datetime_like(dtype:DTypeLike | None) -> boolCheck if a dtype is a subclass of the numpy datetime types
func
xarray.core.common.is_np_timedelta_like(dtype:DTypeLike | None) -> boolCheck whether dtype is of the timedelta64 dtype.
class
xarray.core.coordinates.CoordinateValidationErrorError class for Xarray coordinate validation failures.
class
xarray.core.dataarray.DataArrayN-dimensional array with labeled coordinates and dimensions.
method
xarray.core.dataarray.DataArray.attrs() -> dict[Any, Any]Dictionary storing arbitrary metadata with this array.
method
xarray.core.dataarray.DataArray.combine_first(other:Self) -> SelfCombine two DataArray objects, with union of coordinates.
method
xarray.core.dataarray.DataArray.convert_calendar(calendar:str, dim:str='time', align_on:str | None=None, missing:Any | None=None, use_cftime:bool | None=None) -> SelfConvert the DataArray to another calendar.
method
xarray.core.dataarray.DataArray.copy(deep:bool=True, data:Any=None) -> SelfReturns a copy of this array.
method
xarray.core.dataarray.DataArray.cumulative(dim:str | Iterable[Hashable], min_periods:int=1) -> DataArrayRollingAccumulating object for DataArrays.
method
xarray.core.dataarray.DataArray.data() -> AnyThe DataArray's data as an array.
method
xarray.core.dataarray.DataArray.dims() -> tuple[Hashable, ...]Tuple of dimension names associated with this array.
method
xarray.core.dataarray.DataArray.dot(other:T_Xarray, dim:Dims=None) -> T_XarrayPerform dot product of two DataArrays along their shared dims.
method
xarray.core.dataarray.DataArray.drop_attrs(*deep:bool=True) -> SelfRemoves all attributes from the DataArray.
method
xarray.core.dataarray.DataArray.drop_indexes(coord_names:Hashable | Iterable[Hashable], *errors:ErrorOptions='raise') -> SelfDrop the indexes assigned to the given coordinates.
method
xarray.core.dataarray.DataArray.drop_isel(indexers:Mapping[Any, Any] | None=None, **indexers_kwargs) -> SelfDrop index positions from this DataArray.
method
xarray.core.dataarray.DataArray.drop_sel(labels:Mapping[Any, Any] | None=None, *errors:ErrorOptions='raise', **labels_kwargs) -> SelfDrop index labels from this DataArray.
method
xarray.core.dataarray.DataArray.drop_vars(names:str | Iterable[Hashable] | Callable[[Self], str | Iterable[Hashable]], *errors:ErrorOptions='raise') -> SelfReturns an array with dropped variables.
method
xarray.core.dataarray.DataArray.dtype() -> np.dtypeData-type of the array’s elements.
method
xarray.core.dataarray.DataArray.fillna(value:Any) -> SelfFill missing values in this object.
method
xarray.core.dataarray.DataArray.from_iris(cube:iris_Cube) -> SelfConvert an iris.cube.Cube into an xarray.DataArray
method
xarray.core.dataarray.DataArray.from_series(series:pd.Series, sparse:bool=False) -> DataArrayConvert a pandas.Series into an xarray.DataArray.
method
xarray.core.dataarray.DataArray.imag() -> SelfThe imaginary part of the array.
method
xarray.core.dataarray.DataArray.load(**kwargs) -> SelfTrigger loading data into memory and return this dataarray.
method
xarray.core.dataarray.DataArray.loc() -> _LocIndexerAttribute for location based indexing like pandas.
method
xarray.core.dataarray.DataArray.name() -> Hashable | NoneThe name of this array.
method
xarray.core.dataarray.DataArray.ndim() -> intNumber of array dimensions.
method
xarray.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) -> DatasetLeast squares polynomial fit.
method
xarray.core.dataarray.DataArray.rank(dim:Hashable, *pct:bool=False, *keep_attrs:bool | None=None) -> SelfRanks the data.
method
xarray.core.dataarray.DataArray.real() -> SelfThe real part of the array.
method
xarray.core.dataarray.DataArray.reorder_levels(dim_order:Mapping[Any, Sequence[int | Hashable]] | None=None, **dim_order_kwargs:Sequence[int | Hashable]) -> SelfRearrange index levels using input order.
method
xarray.core.dataarray.DataArray.reset_index(dims_or_levels:Hashable | Sequence[Hashable], drop:bool=False) -> SelfReset the specified index(es) or multi-index level(s).
method
xarray.core.dataarray.DataArray.rolling(dim:Mapping[Any, int] | None=None, min_periods:int | None=None, center:bool | Mapping[Any, bool]=False, **window_kwargs:int) -> DataArrayRollingRolling window object for DataArrays.
method
xarray.core.dataarray.DataArray.shape() -> tuple[int, ...]Tuple of array dimensions.
method
xarray.core.dataarray.DataArray.size() -> intNumber of elements in the array.
method
xarray.core.dataarray.DataArray.swap_dims(dims_dict:Mapping[Any, Hashable] | None=None, **dims_kwargs) -> SelfReturns a new DataArray with swapped dimensions.
method
xarray.core.dataarray.DataArray.to_dask_dataframe(dim_order:Sequence[Hashable] | None=None, set_index:bool=False) -> DaskDataFrameConvert this array into a dask.dataframe.DataFrame.
method
xarray.core.dataarray.DataArray.to_dataset(dim:Hashable=None, *name:Hashable=None, *promote_attrs:bool=False) -> DatasetConvert a DataArray to a Dataset.
method
xarray.core.dataarray.DataArray.to_index() -> pd.IndexConvert this variable to a pandas.Index.
method
xarray.core.dataarray.DataArray.to_iris() -> iris_CubeConvert this array into an iris.cube.Cube
method
xarray.core.dataarray.DataArray.to_numpy() -> np.ndarrayCoerces wrapped data to numpy and returns a numpy.ndarray.
method
xarray.core.dataarray.DataArray.to_series() -> pd.SeriesConvert this array into a pandas.Series.
method
xarray.core.dataarray.DataArray.transpose(*transpose_coords:bool=True, *missing_dims:ErrorOptionsWithWarn='raise', *dim:Hashable) -> SelfReturn a new DataArray object with transposed dimensions.
method
xarray.core.dataarray.DataArray.values() -> np.ndarrayThe array's data converted to numpy.ndarray.
method
xarray.core.dataarray.DataArray.weighted(weights:DataArray) -> DataArrayWeightedWeighted DataArray operations.
func
xarray.core.dataset_utils.as_dataset(obj:Any) -> DatasetCast the given object to a Dataset.
class
xarray.core.datatree.DataTreeA tree-like hierarchical collection of xarray objects.
method
xarray.core.datatree.DataTree.attrs() -> dict[Hashable, Any]Dictionary of global attributes on this node object.
method
xarray.core.datatree.DataTree.close() -> NoneClose any files associated with this tree.
method
xarray.core.datatree.DataTree.dims() -> Mapping[Hashable, int]Mapping from dimension names to lengths.
method
xarray.core.datatree.DataTree.drop_nodes(names:str | Iterable[str], *errors:ErrorOptions='raise') -> DataTreeDrop child nodes from this node.
method
xarray.core.datatree.DataTree.filter(filterfunc:Callable[[DataTree], bool]) -> DataTreeFilter nodes according to a specified condition.
method
xarray.core.datatree.DataTree.filter_like(other:DataTree) -> DataTreeFilter a datatree like another datatree.
method
xarray.core.datatree.DataTree.has_data() -> boolWhether or not there are any variables in this node.
method
xarray.core.datatree.DataTree.is_empty() -> boolFalse if node contains any data or attrs.
method
xarray.core.datatree.DataTree.is_hollow() -> boolTrue if only leaf nodes contain data.
method
xarray.core.datatree.DataTree.match(pattern:str) -> DataTreeReturn nodes with paths matching pattern.
method
xarray.core.datatree.DataTree.persist(**kwargs) -> SelfTrigger computation, keeping data as chunked arrays.
method
xarray.core.datatree.DataTree.prune(drop_size_zero_vars:bool=False) -> DataTreeRemove empty nodes from the tree.
method
xarray.core.datatree.DataTree.set_close(close:Callable[[], None] | None) -> NoneSet the closer for this node.
method
xarray.core.datatree.DataTree.sizes() -> Mapping[Hashable, int]Mapping from dimension names to lengths.
func
xarray.core.datatree_mapping.add_path_context_to_errors(path:str)Add path context to any errors.
func
xarray.core.dtypes.is_datetime_like(dtype) -> boolCheck if a dtype is a subclass of the numpy datetime types
func
xarray.core.dtypes.is_object(dtype) -> boolCheck if a dtype is object
func
xarray.core.dtypes.is_string(dtype) -> boolCheck if a dtype is a string dtype
func
xarray.core.dtypes.isdtype(dtype, kind:str | tuple[str, ...], xp=None) -> boolCompatibility wrapper for isdtype() from the array API standard.
func
xarray.core.duck_array_ops.cumprod(array, axis=None, **kwargs)N-dimensional version of cumprod.
func
xarray.core.duck_array_ops.cumsum(array, axis=None, **kwargs)N-dimensional version of cumsum.
func
xarray.core.duck_array_ops.isna(data:Any) -> boolChecks if data is literally np.nan or pd.NA.
class
xarray.core.eval.LogicalOperatorTransformerTransform operators for consistency with query().
func
xarray.core.eval.validate_expression(tree:ast.AST) -> NoneValidate that an AST doesn't contain patterns we don't support.
class
xarray.core.extension_array.PandasExtensionArrayNEP-18 compliant wrapper for pandas extension arrays.
func
xarray.core.extension_array.implements(numpy_function_or_name:Callable | str) -> CallableRegister an __array_function__ implementation.
class
xarray.core.extensions.AccessorRegistrationWarningWarning for conflicts in accessor registration.
func
xarray.core.formatting.calc_max_rows_first(max_rows:int) -> intCalculate the first rows to maintain the max number of rows.
func
xarray.core.formatting.calc_max_rows_last(max_rows:int) -> intCalculate the last rows to maintain the max number of rows.
func
xarray.core.formatting.datatree_repr(dt:DataTree) -> strA printable representation of the structure of this entire tree.
func
xarray.core.formatting.diff_indexes_repr(a_indexes, b_indexes, col_width:int=20) -> strGenerate diff representation for indexes.
func
xarray.core.formatting.diff_treestructure(a:DataTree, b:DataTree) -> str | NoneReturn a summary of why two trees are not isomorphic.
func
xarray.core.formatting.last_item(array)Returns the last item of an array.
func
xarray.core.formatting.short_data_repr(array)Format "data" for DataArray and Variable.
func
xarray.core.formatting_html.short_data_repr_html(array) -> strFormat "data" for DataArray and Variable.
class
xarray.core.groupby.ComposedGrouperHelper class for multi-variable GroupBy.
class
xarray.core.groupby.DataArrayGroupByBaseGroupBy object specialized to grouping DataArray objects
class
xarray.core.groupby.GroupByA object that implements the split-apply-combine pattern.
method
xarray.core.groupby.GroupBy.assign_coords(coords=None, **coords_kwargs)Assign coordinates by group.
method
xarray.core.groupby.GroupBy.fillna(value:Any) -> T_XarrayFill missing values in this object by group.
method
xarray.core.groupby.GroupBy.groups() -> dict[GroupKey, GroupIndex]Mapping from group labels to indices.
method
xarray.core.groupby.GroupBy.shuffle_to_chunks(chunks:T_Chunks=None) -> T_XarraySort or "shuffle" the underlying object.
method
xarray.core.groupby.GroupBy.sizes() -> Mapping[Hashable, int]Ordered mapping from dimension names to lengths.
class
xarray.core.groupby.ResolvedGrouperWrapper around a Grouper object.
method
xarray.core.groupby.ResolvedGrouper.name() -> HashableName for the grouped coordinate after reduction.
method
xarray.core.groupby.ResolvedGrouper.size() -> intNumber of groups.
class
xarray.core.indexes.IndexBase class inherited by all xarray-compatible indexes.
method
xarray.core.indexes.Index.copy(deep:bool=True) -> SelfReturn a (deep) copy of this index.
method
xarray.core.indexes.Index.create_variables(variables:Mapping[Any, Variable] | None=None) -> IndexVarsMaybe create new coordinate variables from this index.
method
xarray.core.indexes.Index.reindex_like(other:Self) -> dict[Hashable, Any]Query the index with another index of the same type.
method
xarray.core.indexes.Index.roll(shifts:Mapping[Any, int]) -> Self | NoneRoll this index by an offset along one or more dimensions.
method
xarray.core.indexes.Index.sel(labels:dict[Any, Any]) -> IndexSelResultQuery the index with arbitrary coordinate label indexers.
class
xarray.core.indexes.IndexesImmutable proxy for Dataset or DataArray indexes.
method
xarray.core.indexes.Indexes.get_all_coords(key:Hashable, errors:ErrorOptions='raise') -> dict[Hashable, Variable]Return all coordinates having the same index.
method
xarray.core.indexes.Indexes.get_all_dims(key:Hashable, errors:ErrorOptions='raise') -> Mapping[Hashable, int]Return all dimensions shared by an index.
method
xarray.core.indexes.Indexes.get_unique() -> list[T_PandasOrXarrayIndex]Return a list of unique indexes, preserving order.
class
xarray.core.indexes.PandasIndexWrap a pandas.Index as an xarray compatible index.
class
xarray.core.indexes.PandasMultiIndexWrap a pandas.MultiIndex as an xarray compatible index.
func
xarray.core.indexes.default_indexes(coords:Mapping[Any, Variable], dims:Iterable) -> dict[Hashable, Index]Default indexes for a Dataset/DataArray.
func
xarray.core.indexes.indexes_all_equal(elements:Sequence[tuple[Index, dict[Hashable, Variable]]], exclude_dims:frozenset[Hashable]) -> boolCheck if indexes are all equal.
func
xarray.core.indexes.indexes_identical(a_indexes:Indexes[Index], b_indexes:Indexes[Index]) -> boolCheck if two Indexes objects are identical.
func
xarray.core.indexes.safe_cast_to_index(array:Any) -> pd.IndexGiven an array, safely cast it to a pandas.Index.
class
xarray.core.indexing.ArrayApiIndexingAdapterWrap an array API array to use explicit indexing.
class
xarray.core.indexing.BasicIndexerTuple for basic indexing.
class
xarray.core.indexing.CoordinateTransformIndexingAdapterWrap a CoordinateTransform as a lazy coordinate array.
class
xarray.core.indexing.DaskIndexingAdapterWrap a dask array to support explicit indexing.
class
xarray.core.indexing.ExplicitIndexerBase class for explicit indexer objects.
class
xarray.core.indexing.ExplicitlyIndexedMixin to mark support for Indexer subclasses in indexing.
class
xarray.core.indexing.IndexCallableProvide getitem and setitem syntax for callable objects.
class
xarray.core.indexing.IndexSelResultIndex query results.
class
xarray.core.indexing.IndexingAdapterMarker class for indexing adapters.
class
xarray.core.indexing.LazilyIndexedArrayWrap an array to make basic and outer indexing lazy.
class
xarray.core.indexing.LazilyVectorizedIndexedArrayWrap an array to make vectorized indexing lazy.
class
xarray.core.indexing.NumpyIndexingAdapterWrap a NumPy array to use explicit indexing.
class
xarray.core.indexing.OuterIndexerTuple for outer/orthogonal indexing.
class
xarray.core.indexing.PandasMultiIndexingAdapterHandles explicit indexing for a pandas.MultiIndex.
class
xarray.core.indexing.VectorizedIndexerTuple for vectorized indexing.
func
xarray.core.indexing.apply_indexer(indexable, indexer:ExplicitIndexer)Apply an indexer to an indexable object.
func
xarray.core.indexing.set_with_indexer(indexable, indexer:ExplicitIndexer, value:Any) -> NoneSet values in an indexable object using an indexer.
class
xarray.core.missing.NumpyInterpolatorOne-dimensional linear interpolation.
func
xarray.core.missing.bfill(arr, dim=None, limit=None)backfill missing values
func
xarray.core.missing.ffill(arr, dim=None, limit=None)forward fill missing values
class
xarray.core.nputils.NumpyVIndexAdapterObject that implements indexing like vindex on an np.ndarray.
func
xarray.core.nputils.inverse_permutation(indices:np.ndarray, N:int | None=None) -> np.ndarrayReturn indices for an inverse permutation.
func
xarray.core.options.get_options()Get options for xarray.
class
xarray.core.options.set_optionsSet options for xarray in a controlled context.
class
xarray.core.treenode.NamedNodeA TreeNode which knows its own name.
method
xarray.core.treenode.NamedNode.find_common_ancestor(other:Self) -> SelfFind the first common ancestor of two nodes in the same tree.
method
xarray.core.treenode.NamedNode.name() -> str | NoneThe name of this node.
method
xarray.core.treenode.NamedNode.path() -> strReturn the file-like path from the root to this node.
method
xarray.core.treenode.NamedNode.relative_to(other:Self) -> strCompute the relative path from this node to node `other`.
class
xarray.core.treenode.NodePathRepresents a path from one node to another within a tree.
method
xarray.core.treenode.NodePath.absolute() -> SelfConvert into an absolute path.
method
xarray.core.treenode.TreeNode.copy(*inherit:bool=True, *deep:bool=False) -> SelfReturns a copy of this subtree.
method
xarray.core.treenode.TreeNode.depth() -> intMaximum level of this tree.
method
xarray.core.treenode.TreeNode.descendants() -> tuple[Self, ...]Child nodes and all their child nodes.
method
xarray.core.treenode.TreeNode.get(key:str, default:Self | None=None) -> Self | NoneReturn the child node with the specified key.
method
xarray.core.treenode.TreeNode.is_leaf() -> boolWhether this node is a leaf node.
method
xarray.core.treenode.TreeNode.is_root() -> boolWhether this node is the tree root.
method
xarray.core.treenode.TreeNode.iter_lineage() -> tuple[Self, ...]Iterate up the tree, starting from the current node.
method
xarray.core.treenode.TreeNode.leaves() -> tuple[Self, ...]All leaf nodes.
method
xarray.core.treenode.TreeNode.level() -> intLevel of this node.
method
xarray.core.treenode.TreeNode.orphan() -> NoneDetach this node from its parent.
method
xarray.core.treenode.TreeNode.parent() -> Self | NoneParent of this node.
method
xarray.core.treenode.TreeNode.root() -> SelfRoot node of the tree
method
xarray.core.treenode.TreeNode.same_tree(other:Self) -> boolTrue if other node is in the same tree as this node.
method
xarray.core.treenode.TreeNode.siblings() -> dict[str, Self]Nodes with the same parent as this node.
method
xarray.core.treenode.TreeNode.width() -> intNumber of nodes at this level in the tree.
func
xarray.core.treenode.zip_subtrees(*trees:AnyNamedNode) -> Iterator[tuple[AnyNamedNode, ...]]Zip together subtrees aligned by relative path.
class
xarray.core.types.AlignableRepresents any Xarray type that supports alignment.
class
xarray.core.utils.FilteredMappingImplements the Mapping interface.
class
xarray.core.utils.HiddenKeyDictActs like a normal dictionary, but hides certain keys.
class
xarray.core.utils.OrderedSetA simple ordered set.
func
xarray.core.utils.dict_equiv(first:Mapping[K, V], second:Mapping[K, V], compat:Callable[[V, V], bool]=equivalent) -> boolTest equivalence of two dict-like objects.
func
xarray.core.utils.hashable(v:Any) -> TypeGuard[Hashable]Determine whether `v` can be hashed.
func
xarray.core.utils.is_scalar(value:Any, include_0d:bool=True) -> TypeGuard[Hashable]Whether to treat a value as a scalar.
func
xarray.core.utils.iterable(v:Any) -> TypeGuard[Iterable[Any]]Determine whether `v` is iterable.
func
xarray.core.utils.iterable_of_hashable(v:Any) -> TypeGuard[Iterable[Hashable]]Determine whether `v` is an Iterable of Hashables.
func
xarray.core.utils.strip_uri_params(uri:str) -> strStrip query parameters and fragments from a URI.
func
xarray.core.utils.to_0d_array(value:Any) -> np.ndarrayGiven a value, wrap it in a 0-D numpy.ndarray.
class
xarray.core.variable.IndexVariableWrapper for accommodating a pandas.Index in an xarray.Variable.
method
xarray.core.variable.IndexVariable.copy(deep:bool=True, data:T_DuckArray | np.typing.ArrayLike | None=None)Returns a copy of this object.
method
xarray.core.variable.IndexVariable.to_index() -> pd.IndexConvert this variable to a pandas.Index
method
xarray.core.variable.IndexVariable.to_index_variable() -> IndexVariableReturn this variable as an xarray.IndexVariable
method
xarray.core.variable.Variable.coarsen(windows, func, boundary='exact', side='left', keep_attrs=None, **kwargs)Apply reduction function.
method
xarray.core.variable.Variable.data()The Variable's data as an array.
method
xarray.core.variable.Variable.drop_encoding() -> SelfReturn a new Variable without encoding.
method
xarray.core.variable.Variable.encoding() -> dict[Any, Any]Dictionary of encodings on this variable.
method
xarray.core.variable.Variable.imag() -> VariableThe imaginary part of the variable.
method
xarray.core.variable.Variable.load(**kwargs) -> SelfTrigger loading data into memory and return this variable.
method
xarray.core.variable.Variable.rank(dim, pct=False)Ranks the data.
method
xarray.core.variable.Variable.real() -> VariableThe real part of the variable.
method
xarray.core.variable.Variable.to_base_variable() -> VariableReturn this variable as a base xarray.Variable
method
xarray.core.variable.Variable.to_dict(data:bool | Literal['list', 'array']='list', encoding:bool=False) -> dict[str, Any]Dictionary representation of variable.
method
xarray.core.variable.Variable.to_index() -> pd.IndexConvert this variable to a pandas.Index
method
xarray.core.variable.Variable.to_index_variable() -> IndexVariableReturn this variable as an xarray.IndexVariable
method
xarray.core.variable.Variable.transpose(*missing_dims:ErrorOptionsWithWarn='raise', *dim:Hashable | EllipsisType) -> SelfReturn a new Variable object with transposed dimensions.
method
xarray.core.variable.Variable.values() -> np.ndarrayThe variable's data as a numpy.ndarray
func
xarray.core.variable.as_compatible_data(data:T_DuckArray | np.typing.ArrayLike, fastpath:bool=False) -> T_DuckArrayPrepare and wrap data to put in a Variable.
func
xarray.core.variable.as_variable(obj:T_DuckArray | Any, name=None, auto_convert:bool=True) -> Variable | IndexVariableConvert an object into a Variable.
func
xarray.core.variable.calculate_dimensions(variables:Mapping[Any, Variable]) -> dict[Hashable, int]Calculate the dimensions corresponding to a set of variables.
class
xarray.groupers.BinGrouperGrouper object for binning numeric data.
class
xarray.groupers.EncodedGroupsDataclass for storing intermediate values for GroupBy operation.
method
xarray.groupers.Grouper.factorize(group:T_Group) -> EncodedGroupsCreates intermediates necessary for GroupBy.
method
xarray.groupers.Grouper.reset() -> SelfCreates a new version of this Grouper clearing any caches.
class
xarray.groupers.SeasonGrouperAllows grouping using a custom definition of seasons.
class
xarray.groupers.SeasonResamplerAllows grouping using a custom definition of seasons.
method
xarray.groupers.SeasonResampler.compute_chunks(variable:Variable, *dim:Hashable) -> tuple[int, ...]Compute chunk sizes for this season resampler.
class
xarray.groupers.TimeResamplerGrouper object specialized to resampling the time coordinate.
method
xarray.groupers.TimeResampler.compute_chunks(variable:Variable, *dim:Hashable) -> tuple[int, ...]Compute chunk sizes for this time resampler.
class
xarray.groupers.UniqueGrouperGrouper object for grouping by a categorical variable.
method
xarray.groupers.UniqueGrouper.group_as_index() -> pd.IndexCaches the group DataArray as a pandas Index.
func
xarray.groupers.find_independent_seasons(seasons:Sequence[str]) -> Sequence[SeasonsGroup]Iterates though a list of seasons e.g.
func
xarray.groupers.unique_value_groups(ar, sort:bool=True) -> tuple[np.ndarray | pd.Index, np.ndarray]Group an array by its unique values.
class
xarray.indexes.nd_point_index.NDPointIndexXarray index for irregular, n-dimensional data.
method
xarray.indexes.range_index.RangeIndex.equals(other:'Index', *exclude:frozenset[Hashable] | None=None, *exact:bool=False) -> boolCheck equality with another RangeIndex.
method
xarray.indexes.range_index.RangeIndex.step() -> floatReturns the spacing between values.
func
xarray.namedarray._array_api.permute_dims(x:NamedArray[Any, _DType], axes:_Axes) -> NamedArray[Any, _DType]Permutes the dimensions of an array.
func
xarray.namedarray.dtypes.get_fill_value(dtype:np.dtype[np.generic]) -> AnyReturn an appropriate fill value for this dtype.
class
xarray.namedarray.pycompat.DuckArrayModuleSolely for internal isinstance and version checks.
func
xarray.namedarray.pycompat.array_type(mod:ModType) -> DuckArrayTypesQuick wrapper to get the array class of the module.
func
xarray.namedarray.pycompat.mod_version(mod:ModType) -> VersionQuick wrapper to get the version of the module.
func
xarray.namedarray.utils.module_available(module:str, minversion:str | None=None) -> boolChecks whether a module is installed without importing it.
func
xarray.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.
class
xarray.plot.facetgrid.FacetGridInitialize the Matplotlib figure and FacetGrid object.
method
xarray.plot.facetgrid.FacetGrid.add_colorbar(**kwargs:Any) -> NoneDraw a colorbar.
method
xarray.plot.facetgrid.FacetGrid.map(func:Callable, *args:Hashable, **kwargs:Any) -> T_FacetGridApply a plotting function to each facet's subset of the data.
method
xarray.plot.facetgrid.FacetGrid.set_axis_labels(*axlabels:Hashable) -> NoneSet axis labels on the left column and bottom row of the grid.
method
xarray.plot.facetgrid.FacetGrid.set_ticks(max_xticks:int=_NTICKS, max_yticks:int=_NTICKS, fontsize:str | int=_FONTSIZE) -> NoneSet and control tick behavior.
method
xarray.plot.facetgrid.FacetGrid.set_xlabels(label:str | None=None, **kwargs:Any) -> NoneLabel the x axis on the bottom row of the grid.
method
xarray.plot.facetgrid.FacetGrid.set_ylabels(label:str | None=None, **kwargs:Any) -> NoneLabel the y axis on the left column of the grid.
method
xarray.plot.facetgrid.FacetGrid.set_zlabels(label:str | None=None, **kwargs:Any) -> NoneLabel the z axis.
func
xarray.structure.combine.groupby_defaultdict(iter:list[T], key:Callable[[T], K]) -> Iterator[tuple[K, Iterator[T]]]replacement for itertools.groupby
class
xarray.structure.merge.Contextobject carrying the information of a call
class
xarray.structure.merge.MergeErrorError class for merge failures due to incompatible arguments.
func
xarray.structure.merge.broadcast_dimension_size(variables:list[Variable]) -> dict[Hashable, int]Extract dimension sizes from a dictionary of variables.
func
xarray.structure.merge.coerce_pandas_values(objects:Iterable[CoercibleMapping]) -> list[DatasetLike]Convert pandas values found in a list of labeled objects.
func
xarray.structure.merge.dataset_update_method(dataset:Dataset, other:CoercibleMapping) -> _MergeResultGuts of the Dataset.update method.
func
xarray.structure.merge.equivalent_attrs(a:Any, b:Any) -> boolCheck if two attribute values are equivalent.
func
xarray.structure.merge.merge_data_and_coords(data_vars:DataVars, coords) -> _MergeResultUsed in Dataset.__init__.
func
xarray.tutorial.scatter_example_dataset(*seed:int | None=None) -> DatasetCreate an example dataset.
func
xarray.util.generate_ops.render(ops_info:dict[str, list[OpsType]]) -> Iterator[str]Render the module or stub file.
func
xarray.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.