API reference#
This page provides an auto-generated summary of xarray’s API. For more details and examples, refer to the relevant chapters in the main part of the documentation.
See also: What parts of xarray are considered public API?
Top-level functions#
|
Apply a vectorized function for unlabeled arrays on xarray objects. |
|
Given any number of Dataset and/or DataArray objects, returns new objects with aligned indexes and dimension sizes. |
|
Explicitly broadcast any number of DataArray or Dataset objects against one another. |
|
Concatenate xarray objects along a new or existing dimension. |
|
Merge any number of xarray objects into a single Dataset as variables. |
|
Attempt to auto-magically combine the given datasets (or data arrays) into one by using dimension coordinates. |
|
Explicitly combine an N-dimensional grid of datasets into one by using a succession of concat and merge operations along each dimension of the grid. |
|
Return elements from x or y depending on cond. |
|
Infer the most likely frequency given the input index. |
|
Return a new object with the same shape and type as a given object. |
|
Return a new object of zeros with the same shape and type as a given dataarray or dataset. |
|
Return a new object of ones with the same shape and type as a given dataarray or dataset. |
|
Compute covariance between two DataArray objects along a shared dimension. |
|
Compute the Pearson correlation coefficient between two DataArray objects along a shared dimension. |
|
Compute the cross product of two (arrays of) vectors. |
|
Generalized dot product for xarray objects. |
|
Evaluate a polynomial at specific values |
|
Apply a function to each block of a DataArray or Dataset. |
|
print the versions of xarray and its dependencies |
|
Set options for xarray in a controlled context. |
Get options for xarray. |
|
|
Given any number of Dataset and/or DataArray objects, returns new objects with unified chunk size along all chunked dimensions. |
Dataset#
Creating a dataset#
|
A multi-dimensional, in memory, array database. |
|
Decode the given Dataset or Datastore according to CF conventions into a new Dataset. |
Attributes#
Mapping from dimension names to lengths. |
|
Mapping from dimension names to lengths. |
|
Mapping from data variable names to dtypes. |
|
Dictionary of DataArray objects corresponding to data variables |
|
Dictionary of xarray.DataArray objects corresponding to coordinate variables |
|
Dictionary of global attributes on this dataset |
|
Dictionary of global encoding attributes on this dataset |
|
Mapping of pandas.Index objects used for label based indexing. |
|
Mapping from dimension names to block lengths for this dataset's data, or None if the underlying data is not a dask array. |
|
Mapping from dimension names to block lengths for this dataset's data, or None if the underlying data is not a dask array. |
|
Total bytes consumed by the data arrays of all variables in this dataset. |
Dictionary interface#
Datasets implement the mapping interface with keys given by variable names
and values given by DataArray
objects.
|
Access variables or coordinates of this dataset as a |
|
Add an array to this dataset. |
|
Remove a variable from this dataset. |
|
Update this dataset's variables with those from another dataset. |
|
|
Dataset contents#
|
Returns a copy of this dataset. |
|
Assign new data variables to a Dataset, returning a new object with all the original variables in addition to the new ones. |
|
Assign new coordinates to this object. |
|
Assign new attrs to this object. |
|
Apply |
|
Merge the arrays of two datasets into a single dataset. |
|
Returns a new object with renamed variables, coordinates and dimensions. |
|
Returns a new object with renamed variables including coordinates |
|
Returns a new object with renamed dimensions only. |
|
Returns a new object with swapped dimensions. |
|
Return a new object with an additional axis (or axes) inserted at the corresponding position in the array shape. |
|
Drop variables from this dataset. |
|
Drop the indexes assigned to the given coordinates. |
|
Returns a new Dataset with duplicate dimension values removed. |
|
Drop dimensions and associated variables from this dataset. |
|
Given names of one or more variables, set them as coordinates |
|
Given names of coordinates, reset them to become variables |
Return a new Dataset without encoding on the dataset or any of its variables/coords. |
|
|
Convert the Dataset to another calendar. |
|
Interpolates the Dataset to another calendar based on decimal year measure. |
|
Get an index for a dimension, with fall-back to a default RangeIndex |
Comparisons#
|
Two Datasets are equal if they have matching variables and coordinates, all of which are equal. |
|
Like equals, but also checks all dataset attributes and the attributes on all variables and coordinates. |
|
Two Datasets are broadcast equal if they are equal after broadcasting all variables against each other. |
Indexing#
Attribute for location based indexing. |
|
|
Returns a new dataset with each array indexed along the specified dimension(s). |
|
Returns a new dataset with each array indexed by tick labels along the specified dimension(s). |
|
Drop index labels from this dataset. |
|
Drop index positions from this Dataset. |
|
Returns a new dataset with the first n values of each array for the specified dimension(s). |
|
Returns a new dataset with the last n values of each array for the specified dimension(s). |
|
Returns a new dataset with each array indexed along every n-th value for the specified dimension(s) |
|
Return a new object with squeezed data. |
|
Interpolate a Dataset onto new coordinates |
|
Interpolate this object onto the coordinates of another object, filling the out of range values with NaN. |
|
Conform this object onto a new set of indexes, filling in missing values with |
|
Conform this object onto the indexes of another object, filling in missing values with |
|
Set Dataset (multi-)indexes using one or more existing coordinates or variables. |
|
Reset the specified index(es) or multi-index level(s). |
|
Set a new, Xarray-compatible index from one or more existing coordinate(s). |
|
Rearrange index levels using input order. |
|
Return a new dataset with each array indexed along the specified dimension(s), where the indexers are given as strings containing Python expressions to be evaluated against the data variables in the dataset. |
Missing value handling#
|
Test each value in the array for whether it is a missing value. |
|
Test each value in the array for whether it is not a missing value. |
|
Combine two Datasets, default to data_vars of self. |
|
Reduce this Dataset's data by applying |
|
Returns a new dataset with dropped labels for missing values along the provided dimension. |
|
Fill missing values in this object. |
|
Fill NaN values by propagating values forward |
|
Fill NaN values by propagating values backward |
|
Fill in NaNs by interpolating according to different methods. |
|
Filter elements from this object according to a condition. |
|
Tests each value in the array for whether it is in test elements. |
Computation#
|
Apply a function to each data variable in this dataset |
|
Reduce this dataset by applying func along some dimension(s). |
|
Returns a DatasetGroupBy object for performing grouped operations. |
|
Returns a DatasetGroupBy object for performing grouped operations. |
|
Rolling window object for Datasets. |
|
Exponentially-weighted moving window. |
|
Weighted Dataset operations. |
|
Coarsen object for Datasets. |
|
Returns a Resample object for performing resampling operations. |
|
Calculate the n-th order discrete difference along given axis. |
|
Compute the qth quantile of the data along the specified dimension. |
|
Differentiate with the second order accurate central differences. |
|
Integrate along the given coordinate using the trapezoidal rule. |
|
Apply a function to each block of this Dataset. |
|
Least squares polynomial fit. |
|
Curve fitting optimization for arbitrary functions. |
Aggregation#
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Indices of the maxima of the member variables. |
|
Indices of the minima of the member variables. |
|
Reduce this Dataset's data by applying |
|
Return the coordinate label of the maximum value along a dimension. |
|
Return the coordinate label of the minimum value along a dimension. |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
ndarray methods#
|
Returns the indices that would sort this array. |
|
Copy of the xarray object, with data cast to a specified type. |
|
Return an array whose values are limited to |
Complex-conjugate all elements. |
|
Return the complex conjugate, element-wise. |
|
The imaginary part of each data variable. |
|
|
Evenly round to the given number of decimals. |
The real part of each data variable. |
|
|
Ranks the data. |
Reshaping and reorganizing#
|
Return a new Dataset object with all array dimensions transposed. |
|
Stack any number of existing dimensions into a single new dimension. |
|
Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions. |
|
Combine variables of differing dimensionality into a DataArray without broadcasting. |
|
Shift this dataset by an offset along one or more dimensions. |
|
Roll this dataset by an offset along one or more dimensions. |
|
Pad this dataset along one or more dimensions. |
|
Sort object by labels or values (along an axis). |
|
Broadcast this DataArray against another Dataset or DataArray. |
DataArray#
|
N-dimensional array with labeled coordinates and dimensions. |
Attributes#
The array's data as a numpy.ndarray. |
|
The DataArray's data as an array. |
|
Dictionary-like container of coordinate arrays. |
|
Tuple of dimension names associated with this array. |
|
Ordered mapping from dimension names to lengths. |
|
The name of this array. |
|
Dictionary storing arbitrary metadata with this array. |
|
Dictionary of format-specific settings for how this array should be serialized. |
|
Mapping of pandas.Index objects used for label based indexing. |
|
Mapping from dimension names to block lengths for this dataarray's data, or None if the underlying data is not a dask array. |
ndarray attributes#
Number of array dimensions. |
|
Total bytes consumed by the elements of this DataArray's data. |
|
Tuple of array dimensions. |
|
Number of elements in the array. |
|
Data-type of the array’s elements. |
|
Tuple of block lengths for this dataarray's data, in order of dimensions, or None if the underlying data is not a dask array. |
DataArray contents#
|
Assign new coordinates to this object. |
|
Assign new attrs to this object. |
|
Apply |
|
Returns a new DataArray with renamed coordinates, dimensions or a new name. |
|
Returns a new DataArray with swapped dimensions. |
|
Return a new object with an additional axis (or axes) inserted at the corresponding position in the array shape. |
|
Returns an array with dropped variables. |
|
Drop the indexes assigned to the given coordinates. |
|
Returns a new DataArray with duplicate dimension values removed. |
|
Given names of coordinates, reset them to become variables. |
Return a new DataArray without encoding on the array or any attached coords. |
|
|
Returns a copy of this array. |
|
Convert the DataArray to another calendar. |
|
Interpolates the DataArray to another calendar based on decimal year measure. |
|
Get an index for a dimension, with fall-back to a default RangeIndex |
|
Copy of the xarray object, with data cast to a specified type. |
|
Copy an element of an array to a standard Python scalar and return it. |
Indexing#
|
|
Attribute for location based indexing like pandas. |
|
|
Return a new DataArray whose data is given by selecting indexes along the specified dimension(s). |
|
Return a new DataArray whose data is given by selecting index labels along the specified dimension(s). |
|
Drop index labels from this DataArray. |
|
Drop index positions from this DataArray. |
|
Return a new DataArray whose data is given by the the first n values along the specified dimension(s). |
|
Return a new DataArray whose data is given by the the last n values along the specified dimension(s). |
|
Return a new DataArray whose data is given by each n value along the specified dimension(s). |
|
Return a new object with squeezed data. |
|
Interpolate a DataArray onto new coordinates |
|
Interpolate this object onto the coordinates of another object, filling out of range values with NaN. |
|
Conform this object onto the indexes of another object, filling in missing values with |
|
Conform this object onto the indexes of another object, filling in missing values with |
|
Set DataArray (multi-)indexes using one or more existing coordinates. |
|
Reset the specified index(es) or multi-index level(s). |
|
Set a new, Xarray-compatible index from one or more existing coordinate(s). |
|
Rearrange index levels using input order. |
|
Return a new data array indexed along the specified dimension(s), where the indexers are given as strings containing Python expressions to be evaluated against the values in the array. |
Missing value handling#
|
Test each value in the array for whether it is a missing value. |
|
Test each value in the array for whether it is not a missing value. |
|
Combine two DataArray objects, with union of coordinates. |
|
Reduce this DataArray's data by applying |
|
Returns a new array with dropped labels for missing values along the provided dimension. |
|
Fill missing values in this object. |
|
Fill NaN values by propagating values forward |
|
Fill NaN values by propagating values backward |
|
Fill in NaNs by interpolating according to different methods. |
|
Filter elements from this object according to a condition. |
|
Tests each value in the array for whether it is in test elements. |
Comparisons#
|
True if two DataArrays have the same dimensions, coordinates and values; otherwise False. |
|
Like equals, but also checks the array name and attributes, and attributes on all coordinates. |
|
Two DataArrays are broadcast equal if they are equal after broadcasting them against each other such that they have the same dimensions. |
Computation#
|
Reduce this array by applying func along some dimension(s). |
|
Returns a DataArrayGroupBy object for performing grouped operations. |
|
Returns a DataArrayGroupBy object for performing grouped operations. |
|
Rolling window object for DataArrays. |
|
Exponentially-weighted moving window. |
|
Weighted DataArray operations. |
|
Coarsen object for DataArrays. |
|
Returns a Resample object for performing resampling operations. |
Return axis number(s) corresponding to dimension(s) in this array. |
|
|
Calculate the n-th order discrete difference along given axis. |
|
Perform dot product of two DataArrays along their shared dims. |
|
Compute the qth quantile of the data along the specified dimension. |
|
Differentiate the array with the second order accurate central differences. |
|
Integrate along the given coordinate using the trapezoidal rule. |
|
Least squares polynomial fit. |
|
Apply a function to each block of this DataArray. |
|
Curve fitting optimization for arbitrary functions. |
Aggregation#
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Index or indices of the maximum of the DataArray over one or more dimensions. |
|
Index or indices of the minimum of the DataArray over one or more dimensions. |
|
Reduce this DataArray's data by applying |
|
Return the coordinate label of the maximum value along a dimension. |
|
Return the coordinate label of the minimum value along a dimension. |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
ndarray methods#
|
Returns the indices that would sort this array. |
|
Return an array whose values are limited to |
Complex-conjugate all elements. |
|
Return the complex conjugate, element-wise. |
|
The imaginary part of the array. |
|
|
Find indices where elements of v should be inserted in a to maintain order. |
|
Evenly round to the given number of decimals. |
The real part of the array. |
|
|
Ranks the data. |
String manipulation#
Convert strings in the array to be capitalized. |
|
Convert strings in the array to be casefolded. |
|
|
Concatenate strings elementwise in the DataArray with other strings. |
|
Pad left and right side of each string in the array. |
|
Test if pattern or regex is contained within each string of the array. |
|
Count occurrences of pattern in each string of the array. |
|
Decode character string in the array using indicated encoding. |
|
Encode character string in the array using indicated encoding. |
Test if the end of each string in the array matches a pattern. |
|
|
Extract the first match of capture groups in the regex pat as a new dimension in a DataArray. |
|
Extract all matches of capture groups in the regex pat as new dimensions in a DataArray. |
|
Return lowest or highest indexes in each strings in the array where the substring is fully contained between [start:end]. |
|
Find all occurrences of pattern or regular expression in the DataArray. |
|
Perform python string formatting on each element of the DataArray. |
|
Extract character number i from each string in the array. |
|
Return DataArray of dummy/indicator variables. |
|
Return lowest or highest indexes in each strings where the substring is fully contained between [start:end]. |
Check whether all characters in each string are alphanumeric. |
|
Check whether all characters in each string are alphabetic. |
|
Check whether all characters in each string are decimal. |
|
Check whether all characters in each string are digits. |
|
Check whether all characters in each string are lowercase. |
|
Check whether all characters in each string are numeric. |
|
Check whether all characters in each string are spaces. |
|
Check whether all characters in each string are titlecase. |
|
Check whether all characters in each string are uppercase. |
|
|
Concatenate strings in a DataArray along a particular dimension. |
Compute the length of each string in the array. |
|
|
Pad right side of each string in the array. |
Convert strings in the array to lowercase. |
|
|
Remove leading characters. |
|
Determine if each string in the array matches a regular expression. |
|
Return the Unicode normal form for the strings in the datarray. |
|
Pad strings in the array up to width. |
|
Split the strings in the DataArray at the first occurrence of separator sep. |
|
Repeat each string in the array. |
|
Replace occurrences of pattern/regex in the array with some string. |
|
Return highest indexes in each strings in the array where the substring is fully contained between [start:end]. |
|
Return highest indexes in each strings where the substring is fully contained between [start:end]. |
|
Pad left side of each string in the array. |
|
Split the strings in the DataArray at the last occurrence of separator sep. |
|
Split strings in a DataArray around the given separator/delimiter sep. |
|
Remove trailing characters. |
|
Slice substrings from each string in the array. |
|
Replace a positional slice of a string with another value. |
|
Split strings in a DataArray around the given separator/delimiter sep. |
Test if the start of each string in the array matches a pattern. |
|
|
Remove leading and trailing characters. |
Convert strings in the array to be swapcased. |
|
Convert strings in the array to titlecase. |
|
|
Map characters of each string through the given mapping table. |
Convert strings in the array to uppercase. |
|
|
Wrap long strings in the array in paragraphs with length less than width. |
|
Pad each string in the array by prepending '0' characters. |
Datetimelike properties#
Datetime properties:
The year of the datetime |
|
The month as January=1, December=12 |
|
The days of the datetime |
|
The hours of the datetime |
|
The minutes of the datetime |
|
The seconds of the datetime |
|
The microseconds of the datetime |
|
The nanoseconds of the datetime |
|
The day of the week with Monday=0, Sunday=6 |
|
The day of the week with Monday=0, Sunday=6 |
|
The name of day in a week |
|
The ordinal day of the year |
|
The quarter of the date |
|
The number of days in the month |
|
The number of days in the month |
|
Season of the year |
|
Timestamps corresponding to datetimes |
|
Date corresponding to datetimes |
|
The name of the calendar of the dates. |
|
Indicate whether the date is the first day of the month |
|
Indicate whether the date is the last day of the month |
|
Indicate whether the date is the last day of a quarter |
|
Indicate whether the date is the first day of a year |
|
Indicate if the date belongs to a leap year |
Datetime methods:
|
Round timestamps downward to specified frequency resolution. |
|
Round timestamps upward to specified frequency resolution. |
Dataset containing ISO year, week number, and weekday. |
|
|
Round timestamps to specified frequency resolution. |
|
Return an array of formatted strings specified by date_format, which supports the same string format as the python standard library. |
Timedelta properties:
Number of days for each element |
|
Number of seconds (>= 0 and less than 1 day) for each element |
|
Number of microseconds (>= 0 and less than 1 second) for each element |
|
Number of nanoseconds (>= 0 and less than 1 microsecond) for each element |
Timedelta methods:
|
Round timestamps downward to specified frequency resolution. |
|
Round timestamps upward to specified frequency resolution. |
|
Round timestamps to specified frequency resolution. |
Reshaping and reorganizing#
|
Return a new DataArray object with transposed dimensions. |
|
Stack any number of existing dimensions into a single new dimension. |
|
Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions. |
|
Unstack DataArray expanding to Dataset along a given level of a stacked coordinate. |
|
Shift this DataArray by an offset along one or more dimensions. |
|
Roll this array by an offset along one or more dimensions. |
|
Pad this array along one or more dimensions. |
|
Sort object by labels or values (along an axis). |
|
Broadcast this DataArray against another Dataset or DataArray. |
IO / Conversion#
Dataset methods#
|
Open, load into memory, and close a Dataset from a file or file-like object. |
|
Open and decode a dataset from a file or file-like object. |
|
Open multiple files as a single dataset. |
|
Load and decode a dataset from a Zarr store. |
|
Write multiple datasets to disk as netCDF files simultaneously. |
Coerces wrapped data and coordinates into numpy arrays, returning a Dataset. |
|
|
Convert a pandas.DataFrame into an xarray.Dataset |
Convert a dictionary into an xarray.Dataset. |
|
|
Convert this dataset into an xarray.DataArray |
|
Convert this dataset into a pandas.DataFrame. |
|
Convert this dataset into a dask.dataframe.DataFrame. |
|
Convert this dataset to a dictionary following xarray naming conventions. |
|
Write dataset contents to a netCDF file. |
Convert this dataset into a pandas object without changing the number of dimensions. |
|
|
Write dataset contents to a zarr group. |
|
Coerce all arrays in this dataset into dask arrays with the given chunks. |
Release any resources linked to this object. |
|
|
Manually trigger loading and/or computation of this dataset's data from disk or a remote source into memory and return a new dataset. |
|
Returns a |
|
Concise summary of a Dataset variables and attributes. |
|
Manually trigger loading and/or computation of this dataset's data from disk or a remote source into memory and return this dataset. |
|
Trigger computation, keeping data as dask arrays |
Unify chunk size along all chunked dimensions of this Dataset. |
DataArray methods#
|
Open, load into memory, and close a DataArray from a file or file-like object containing a single data variable. |
|
Open an DataArray from a file or file-like object containing a single data variable. |
Coerces wrapped data and coordinates into numpy arrays, returning a DataArray. |
|
|
Convert a cdms2.Variable into an xarray.DataArray |
Convert a dictionary into an xarray.DataArray |
|
|
Convert a iris.cube.Cube into an xarray.DataArray |
|
Convert a pandas.Series into an xarray.DataArray. |
Convert this array into a cdms2.Variable |
|
|
Convert this array and its coordinates into a tidy pandas.DataFrame. |
|
Convert a DataArray to a Dataset. |
|
Convert this xarray.DataArray into a dictionary following xarray naming conventions. |
Convert this variable to a pandas.Index. |
|
Convert this array into a iris.cube.Cube |
|
|
Convert this array into a numpy.ma.MaskedArray |
|
Write DataArray contents to a netCDF file. |
Coerces wrapped data to numpy and returns a numpy.ndarray. |
|
Convert this array into a pandas object with the same shape. |
|
Convert this array into a pandas.Series. |
|
|
Write DataArray contents to a Zarr store |
|
Coerce this array's data into a dask arrays with the given chunks. |
Release any resources linked to this object. |
|
|
Manually trigger loading of this array's data from disk or a remote source into memory and return a new array. |
|
Trigger computation in constituent dask arrays |
|
Manually trigger loading of this array's data from disk or a remote source into memory and return this array. |
Unify chunk size along all chunked dimensions of this DataArray. |
Coordinates objects#
Dataset#
|
Dictionary like container for Dataset coordinates. |
Mapping from coordinate names to dtypes. |
DataArray#
|
Dictionary like container for DataArray coordinates. |
Mapping from coordinate names to dtypes. |
Plotting#
Dataset#
|
Scatter variables against each other. |
|
Quiver plot of Dataset variables. |
|
Plot streamlines of Dataset variables. |
DataArray#
|
Default plot of DataArray using |
|
Filled contour plot of 2D DataArray. |
|
Contour plot of 2D DataArray. |
|
Histogram of DataArray. |
|
Image plot of 2D DataArray. |
|
Line plot of DataArray values. |
|
Pseudocolor plot of 2D DataArray. |
|
Step plot of DataArray values. |
|
Scatter variables against each other. |
|
Surface plot of 2D DataArray. |
Faceting#
|
Initialize the Matplotlib figure and FacetGrid object. |
|
Draw a colorbar. |
|
|
|
|
|
Apply a plotting function to each facet's subset of the data. |
|
Apply a plotting function to a 2d facet's subset of the data. |
|
|
|
|
|
Apply a plotting function to a 1d facet's subset of the data. |
|
Set axis labels on the left column and bottom row of the grid. |
|
Set and control tick behavior. |
|
Draw titles either above each facet or on the grid margins. |
|
Label the x axis on the bottom row of the grid. |
|
Label the y axis on the left column of the grid. |
GroupBy objects#
Dataset#
|
|
|
Apply a function to each Dataset in the group and concatenate them together into a new Dataset. |
|
Reduce the items in this group by applying func along some dimension(s). |
|
Assign data variables by group. |
|
Assign coordinates by group. |
|
Return the first element of each group along the group dimension |
|
Return the last element of each group along the group dimension |
|
Fill missing values in this object by group. |
|
Compute the qth quantile over each array in the groups and concatenate them together into a new array. |
|
Return elements from self or other depending on cond. |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
Mapping from group labels to indices. |
DataArray#
|
|
|
Apply a function to each array in the group and concatenate them together into a new array. |
|
Reduce the items in this group by applying func along some dimension(s). |
|
Assign coordinates by group. |
|
Return the first element of each group along the group dimension |
|
Return the last element of each group along the group dimension |
|
Fill missing values in this object by group. |
|
Compute the qth quantile over each array in the groups and concatenate them together into a new array. |
|
Return elements from self or other depending on cond. |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
Mapping from group labels to indices. |
Rolling objects#
Dataset#
|
|
|
Convert this rolling object to xr.Dataset, where the window dimension is stacked as a new dimension |
|
Reduce the items in this group by applying func along some dimension(s). |
|
Reduce this object's data windows by applying argmax along its dimension. |
|
Reduce this object's data windows by applying argmin along its dimension. |
|
Reduce this object's data windows by applying count along its dimension. |
|
Reduce this object's data windows by applying max along its dimension. |
|
Reduce this object's data windows by applying mean along its dimension. |
|
Reduce this object's data windows by applying median along its dimension. |
|
Reduce this object's data windows by applying min along its dimension. |
|
Reduce this object's data windows by applying prod along its dimension. |
|
Reduce this object's data windows by applying std along its dimension. |
|
Reduce this object's data windows by applying sum along its dimension. |
|
Reduce this object's data windows by applying var along its dimension. |
DataArray#
|
|
|
Convert this rolling object to xr.DataArray, where the window dimension is stacked as a new dimension |
|
Reduce the items in this group by applying func along some dimension(s). |
|
Reduce this object's data windows by applying argmax along its dimension. |
|
Reduce this object's data windows by applying argmin along its dimension. |
|
Reduce this object's data windows by applying count along its dimension. |
|
Reduce this object's data windows by applying max along its dimension. |
|
Reduce this object's data windows by applying mean along its dimension. |
|
Reduce this object's data windows by applying median along its dimension. |
|
Reduce this object's data windows by applying min along its dimension. |
|
Reduce this object's data windows by applying prod along its dimension. |
|
Reduce this object's data windows by applying std along its dimension. |
|
Reduce this object's data windows by applying sum along its dimension. |
|
Reduce this object's data windows by applying var along its dimension. |
Coarsen objects#
Dataset#
|
|
|
Reduce this DatasetCoarsen's data by applying all along some dimension(s). |
|
Reduce this DatasetCoarsen's data by applying any along some dimension(s). |
|
Convert this Coarsen object to a DataArray or Dataset, where the coarsening dimension is split or reshaped to two new dimensions. |
|
Reduce this DatasetCoarsen's data by applying count along some dimension(s). |
|
Reduce this DatasetCoarsen's data by applying max along some dimension(s). |
|
Reduce this DatasetCoarsen's data by applying mean along some dimension(s). |
|
Reduce this DatasetCoarsen's data by applying median along some dimension(s). |
|
Reduce this DatasetCoarsen's data by applying min along some dimension(s). |
|
Reduce this DatasetCoarsen's data by applying prod along some dimension(s). |
|
Reduce the items in this group by applying func along some dimension(s). |
|
Reduce this DatasetCoarsen's data by applying std along some dimension(s). |
|
Reduce this DatasetCoarsen's data by applying sum along some dimension(s). |
|
Reduce this DatasetCoarsen's data by applying var along some dimension(s). |
DataArray#
|
|
|
Reduce this DataArrayCoarsen's data by applying all along some dimension(s). |
|
Reduce this DataArrayCoarsen's data by applying any along some dimension(s). |
|
Convert this Coarsen object to a DataArray or Dataset, where the coarsening dimension is split or reshaped to two new dimensions. |
|
Reduce this DataArrayCoarsen's data by applying count along some dimension(s). |
|
Reduce this DataArrayCoarsen's data by applying max along some dimension(s). |
|
Reduce this DataArrayCoarsen's data by applying mean along some dimension(s). |
|
Reduce this DataArrayCoarsen's data by applying median along some dimension(s). |
|
Reduce this DataArrayCoarsen's data by applying min along some dimension(s). |
|
Reduce this DataArrayCoarsen's data by applying prod along some dimension(s). |
|
Reduce the items in this group by applying func along some dimension(s). |
|
Reduce this DataArrayCoarsen's data by applying std along some dimension(s). |
|
Reduce this DataArrayCoarsen's data by applying sum along some dimension(s). |
|
Reduce this DataArrayCoarsen's data by applying var along some dimension(s). |
Exponential rolling objects#
|
Exponentially-weighted moving window object. |
|
Exponentially weighted moving average. |
|
Exponentially weighted moving sum. |
Weighted objects#
Dataset#
|
|
|
Reduce this Dataset's data by a weighted |
|
Apply a weighted |
|
Reduce this Dataset's data by a weighted |
|
Reduce this Dataset's data by a weighted |
|
Reduce this Dataset's data by a weighted |
|
Calculate the sum of weights, accounting for missing values in the data. |
|
Reduce this Dataset's data by a weighted |
DataArray#
|
|
|
Reduce this Dataset's data by a weighted |
|
Apply a weighted |
|
Reduce this Dataset's data by a weighted |
|
Reduce this Dataset's data by a weighted |
|
Reduce this Dataset's data by a weighted |
|
Calculate the sum of weights, accounting for missing values in the data. |
|
Reduce this Dataset's data by a weighted |
Resample objects#
Dataset#
|
DatasetGroupBy object specialized to resampling a specified dimension |
Return values of original object at the new up-sampling frequency; essentially a re-index with new times set to NaN. |
|
|
Backward fill new values at up-sampled frequency. |
|
Interpolate up-sampled data using the original data as knots. |
|
Take new values from nearest original coordinate to up-sampled frequency coordinates. |
|
Forward fill new values at up-sampled frequency. |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Backward compatible implementation of |
|
Assign data variables by group. |
|
Assign coordinates by group. |
|
Backward fill new values at up-sampled frequency. |
|
Reduce this Dataset's data by applying |
|
Forward fill new values at up-sampled frequency. |
|
Fill missing values in this object by group. |
|
Return the first element of each group along the group dimension |
|
Return the last element of each group along the group dimension |
|
Apply a function over each Dataset in the groups generated for resampling and concatenate them together into a new Dataset. |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Compute the qth quantile over each array in the groups and concatenate them together into a new array. |
|
Reduce the items in this group by applying func along the pre-defined resampling dimension. |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Reduce this Dataset's data by applying |
|
Return elements from self or other depending on cond. |
Mapping from group labels to indices. |
DataArray#
|
DataArrayGroupBy object specialized to time resampling operations over a specified dimension |
Return values of original object at the new up-sampling frequency; essentially a re-index with new times set to NaN. |
|
|
Backward fill new values at up-sampled frequency. |
|
Interpolate up-sampled data using the original data as knots. |
|
Take new values from nearest original coordinate to up-sampled frequency coordinates. |
|
Forward fill new values at up-sampled frequency. |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Backward compatible implementation of |
|
Assign coordinates by group. |
|
Backward fill new values at up-sampled frequency. |
|
Reduce this DataArray's data by applying |
|
Forward fill new values at up-sampled frequency. |
|
Fill missing values in this object by group. |
|
Return the first element of each group along the group dimension |
|
Return the last element of each group along the group dimension |
|
Apply a function to each array in the group and concatenate them together into a new array. |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Compute the qth quantile over each array in the groups and concatenate them together into a new array. |
|
Reduce the items in this group by applying func along some dimension(s). |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Reduce this DataArray's data by applying |
|
Return elements from self or other depending on cond. |
Mapping from group labels to indices. |
Accessors#
Access datetime fields for DataArrays with datetime-like dtypes. |
|
Access Timedelta fields for DataArrays with Timedelta-like dtypes. |
|
Vectorized string functions for string-like arrays. |
Custom Indexes#
|
Custom Index for working with CF calendars and dates |
Creating custom indexes#
|
Return a fixed frequency CFTimeIndex. |
|
Return a fixed frequency datetime index. |
|
Generate a datetime array with the same frequency, start and end as another one, but in a different calendar. |
Tutorial#
|
Open a dataset from the online repository (requires internet). |
|
Open, load into memory, and close a dataset from the online repository (requires internet). |
Testing#
|
Like |
|
Like |
|
Like |
Assert that chunksizes along chunked dimensions are equal. |
Exceptions#
Error class for merge failures due to incompatible arguments. |
|
Warnings about encoding/decoding issues in serialization. |
Advanced API#
Low level interface to Dataset contents as dict of Variable objects. |
|
Low level interface to the Variable object for this DataArray. |
|
|
A netcdf-like variable consisting of dimensions, data and attributes which describe a single Array. |
|
Wrapper for accommodating a pandas.Index in an xarray.Variable. |
|
Convert an object into a Variable. |
Base class inherited by all xarray-compatible indexes. |
|
|
object carrying the information of a call |
Register a custom property on xarray.Dataset objects. |
|
Register a custom accessor on xarray.DataArray objects. |
|
|
Register the function that releases any resources linked to this object. |
|
|
Return a dictionary of available engines and their BackendEntrypoint objects. |
|
Refreshes the backend engines based on installed packages. |
Default, pandas-backed indexes built-in Xarray:
indexes.PandasIndex indexes.PandasMultiIndex
These backends provide a low-level interface for lazily loading data from
external file-formats or protocols, and can be manually invoked to create
arguments for the load_store
and dump_to_store
Dataset methods:
|
Store for reading and writing data via the Python-NetCDF4 library. |
|
Store for reading and writing data via h5netcdf |
|
Store for accessing datasets via PseudoNetCDF |
Store for accessing OpenDAP datasets with pydap. |
|
|
Store for reading and writing data via scipy.io.netcdf. |
|
Store for reading and writing data via zarr |
Manager for acquiring and closing a file object. |
|
|
Wrapper for automatically opening and closing file objects. |
|
FileManager that simply wraps an open file in the FileManager interface. |
These BackendEntrypoints provide a basic interface to the most commonly used filetypes in the xarray universe.
Backend for netCDF files based on the netCDF4 package. |
|
Backend for netCDF files based on the h5netcdf package. |
|
Backend for netCDF-like data formats in the air quality field based on the PseudoNetCDF package. |
|
Backend for steaming datasets over the internet using the Data Access Protocol, also known as DODS or OPeNDAP based on the pydap package. |
|
Backend for netCDF files based on the scipy package. |
|
Backend for ".zarr" files based on the zarr package. |
Deprecated / Pending Deprecation#
|
Backward compatible method based on drop_vars and drop_sel |
|
Backward compatible method based on drop_vars and drop_sel |
|
Backward compatible implementation of |
|
Backward compatible implementation of |
|
Backward compatible implementation of |
The week ordinal of the year |
|
The week ordinal of the year |