decode.stats module#

all(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) all operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the all operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the all operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the all operation.

  • **options (Any) – Other options to be passed to the all operation.

Returns:

DataArray that the (chunked) all operation is applied.

Return type:

DataArray

any(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) any operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the any operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the any operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the any operation.

  • **options (Any) – Other options to be passed to the any operation.

Returns:

DataArray that the (chunked) any operation is applied.

Return type:

DataArray

apply(da: DataArray, func: Callable[[...], Any] | str, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) statistical operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • func (Callable[[...], Any] | str) – Function or name of the statistical operation (e.g. 'mean').

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the statistical operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the statistical operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the statistical operation.

  • **options (Any) – Other options to be passed to the statistical operation.

Returns:

DataArray that the (chunked) statistical operation is applied.

Return type:

DataArray

count(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) count operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the count operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the count operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the count operation.

  • **options (Any) – Other options to be passed to the count operation.

Returns:

DataArray that the (chunked) count operation is applied.

Return type:

DataArray

first(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) first operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the first operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the first operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the first operation.

  • **options (Any) – Other options to be passed to the first operation.

Returns:

DataArray that the (chunked) first operation is applied.

Return type:

DataArray

last(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) last operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the last operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the last operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the last operation.

  • **options (Any) – Other options to be passed to the last operation.

Returns:

DataArray that the (chunked) last operation is applied.

Return type:

DataArray

max(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) max operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the max operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the max operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the max operation.

  • skipna (bool | None) – Whether to ignore missing values in the max operation.

  • **options (Any) – Other options to be passed to the max operation.

Returns:

DataArray that the (chunked) max operation is applied.

Return type:

DataArray

mean(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) mean operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the mean operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the mean operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the mean operation.

  • skipna (bool | None) – Whether to ignore missing values in the mean operation.

  • **options (Any) – Other options to be passed to the mean operation.

Returns:

DataArray that the (chunked) mean operation is applied.

Return type:

DataArray

median(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) median operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the median operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the median operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the median operation.

  • skipna (bool | None) – Whether to ignore missing values in the median operation.

  • **options (Any) – Other options to be passed to the median operation.

Returns:

DataArray that the (chunked) median operation is applied.

Return type:

DataArray

min(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) min operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the min operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the min operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the min operation.

  • skipna (bool | None) – Whether to ignore missing values in the min operation.

  • **options (Any) – Other options to be passed to the min operation.

Returns:

DataArray that the (chunked) min operation is applied.

Return type:

DataArray

prod(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) prod operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the prod operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the prod operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the prod operation.

  • skipna (bool | None) – Whether to ignore missing values in the prod operation.

  • **options (Any) – Other options to be passed to the prod operation.

Returns:

DataArray that the (chunked) prod operation is applied.

Return type:

DataArray

std(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) std operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the std operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the std operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the std operation.

  • skipna (bool | None) – Whether to ignore missing values in the std operation.

  • **options (Any) – Other options to be passed to the std operation.

Returns:

DataArray that the (chunked) std operation is applied.

Return type:

DataArray

sum(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) sum operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the sum operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the sum operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the sum operation.

  • skipna (bool | None) – Whether to ignore missing values in the sum operation.

  • **options (Any) – Other options to be passed to the sum operation.

Returns:

DataArray that the (chunked) sum operation is applied.

Return type:

DataArray

var(da: DataArray, /, *, dim: str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int] = None, boundary: Literal['exact', 'trim', 'pad'] = 'trim', side: Literal['left', 'right'] | dict[Hashable, Literal['left', 'right']] = 'left', numeric_coord_func: Callable[[...], Any] | str = 'mean', nonnumeric_coord_func: Callable[[...], Any] | str = 'first', keep_attrs: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) var operation to a DataArray.

Parameters:
  • da (DataArray) – Input DataArray.

  • dim (str | Collection[Hashable] | EllipsisType | None | dict[Hashable, int]) – Name(s) of the dimension(s) along which the var operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the var operation will be applied to every data chunk of given size.

  • boundary (Literal['exact', 'trim', 'pad']) – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side (Literal['left', 'right'] | dict[~collections.abc.Hashable, ~typing.Literal['left', 'right']]) – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

  • nonnumeric_coord_func (Callable[[...], Any] | str) – Function or name of the statistical operation for the non-numeric coordinates (str, bytes, and general object).

  • keep_attrs (bool | None) – Whether to keep attributes in the var operation.

  • skipna (bool | None) – Whether to ignore missing values in the var operation.

  • **options (Any) – Other options to be passed to the var operation.

Returns:

DataArray that the (chunked) var operation is applied.

Return type:

DataArray