demist.stats module#

demist.stats.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, keep_dims: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) all operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the all operation.

  • keep_dims – Whether to keep dimensions in the all operation.

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

Returns:

DataArray that the (chunked) all operation is applied.

demist.stats.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, keep_dims: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) any operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the any operation.

  • keep_dims – Whether to keep dimensions in the any operation.

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

Returns:

DataArray that the (chunked) any operation is applied.

demist.stats.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, keep_dims: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) statistical operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • func – Function or name of the statistical operation (e.g. 'mean').

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the statistical operation.

  • keep_dims – Whether to keep dimensions in the statistical operation.

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

Returns:

DataArray that the (chunked) statistical operation is applied.

demist.stats.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, keep_dims: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) count operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the count operation.

  • keep_dims – Whether to keep dimensions in the count operation.

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

Returns:

DataArray that the (chunked) count operation is applied.

demist.stats.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, keep_dims: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) first operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the first operation.

  • keep_dims – Whether to keep dimensions in the first operation.

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

Returns:

DataArray that the (chunked) first operation is applied.

demist.stats.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, keep_dims: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) last operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the last operation.

  • keep_dims – Whether to keep dimensions in the last operation.

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

Returns:

DataArray that the (chunked) last operation is applied.

demist.stats.mad(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, keep_dims: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) mad operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – Name(s) of the dimension(s) along which the mad operation will be applied. If a dictionary such as {dim: size, ...} is specified, then the mad operation will be applied to every data chunk of given size.

  • boundary – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the mad operation.

  • keep_dims – Whether to keep dimensions in the mad operation.

  • skipna – Whether to ignore missing values in the mad operation.

  • **options – Other options to be passed to the mad operation.

Returns:

DataArray that the (chunked) mad operation is applied.

demist.stats.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, keep_dims: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) max operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the max operation.

  • keep_dims – Whether to keep dimensions in the max operation.

  • skipna – Whether to ignore missing values in the max operation.

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

Returns:

DataArray that the (chunked) max operation is applied.

demist.stats.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, keep_dims: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) mean operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the mean operation.

  • keep_dims – Whether to keep dimensions in the mean operation.

  • skipna – Whether to ignore missing values in the mean operation.

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

Returns:

DataArray that the (chunked) mean operation is applied.

demist.stats.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, keep_dims: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) median operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the median operation.

  • keep_dims – Whether to keep dimensions in the median operation.

  • skipna – Whether to ignore missing values in the median operation.

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

Returns:

DataArray that the (chunked) median operation is applied.

demist.stats.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, keep_dims: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) min operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the min operation.

  • keep_dims – Whether to keep dimensions in the min operation.

  • skipna – Whether to ignore missing values in the min operation.

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

Returns:

DataArray that the (chunked) min operation is applied.

demist.stats.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, keep_dims: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) prod operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the prod operation.

  • keep_dims – Whether to keep dimensions in the prod operation.

  • skipna – Whether to ignore missing values in the prod operation.

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

Returns:

DataArray that the (chunked) prod operation is applied.

demist.stats.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, keep_dims: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) std operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the std operation.

  • keep_dims – Whether to keep dimensions in the std operation.

  • skipna – Whether to ignore missing values in the std operation.

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

Returns:

DataArray that the (chunked) std operation is applied.

demist.stats.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, keep_dims: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) sum operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the sum operation.

  • keep_dims – Whether to keep dimensions in the sum operation.

  • skipna – Whether to ignore missing values in the sum operation.

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

Returns:

DataArray that the (chunked) sum operation is applied.

demist.stats.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, keep_dims: bool | None = None, skipna: bool | None = None, **options: Any) DataArray[source]#

Apply a (chunked) var operation to a DataArray.

Parameters:
  • da – Input DataArray.

  • dim – 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 – Same option as xarray.DataArray.coarsen but defaults to 'trim'.

  • side – Same option as xarray.DataArray.coarsen and defualts to 'left'.

  • numeric_coord_func – Function or name of the statistical operation for the numeric coordinates (bool, numbers, datetime, timedelta).

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

  • keep_attrs – Whether to keep attributes in the var operation.

  • keep_dims – Whether to keep dimensions in the var operation.

  • skipna – Whether to ignore missing values in the var operation.

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

Returns:

DataArray that the (chunked) var operation is applied.