easyclimate.core.stats.yearstat#

This module calculates statistical values over timesteps of the same year

Functions#

calc_yearly_mean(data_input[, dim])

Calculate yearly mean.

calc_yearly_sum(data_input[, dim])

Calculate yearly sum.

calc_yearly_std(data_input[, dim])

Calculate yearly standard deviation.

calc_yearly_var(data_input[, dim])

Calculate yearly standard deviation.

calc_yearly_max(data_input[, dim])

Calculate yearly standard deviation.

calc_yearly_min(data_input[, dim])

Calculate yearly standard deviation.

Module Contents#

easyclimate.core.stats.yearstat.calc_yearly_mean(data_input: xarray.DataArray, dim: str = 'time', **kwargs)#

Calculate yearly mean.

For every adjacent sequence \(t_1, ..., t_n\) of timesteps of the same year it is:

\[o(t, x) = \mathrm{mean} \left \lbrace i(t', x), t_1 < t' \leqslant t_n \right\rbrace\]

Tip

This function uses xarray.DataArray.groupby to implement the calculation. To substantially improve the performance of GroupBy operations, particularly with dask install the flox package. flox extends Xarray’s in-built GroupBy capabilities by allowing grouping by multiple variables, and lazy grouping by dask arrays. If installed, Xarray will automatically use flox by default.

Parameters#

data_input: xarray.DataArray.

xarray.DataArray to be calculated.

Note

The recommended frequence of the data_input is monthly.

dim: str

Dimension(s) over which to apply extracting. By default extracting is applied over the time dimension.

**kwargs:

Additional keyword arguments passed on to the appropriate array function for calculating mean on this object’s data. These could include dask-specific kwargs like split_every.

Returns#

xarray.DataArray with time dimension type of numpy.datetime64.

easyclimate.core.stats.yearstat.calc_yearly_sum(data_input: xarray.DataArray, dim: str = 'time', **kwargs)#

Calculate yearly sum.

For every adjacent sequence \(t_1, ..., t_n\) of timesteps of the same year it is:

\[o(t, x) = \mathrm{sum} \left \lbrace i(t', x), t_1 < t' \leqslant t_n \right\rbrace\]

Tip

This function uses xarray.DataArray.groupby to implement the calculation. To substantially improve the performance of GroupBy operations, particularly with dask install the flox package. flox extends Xarray’s in-built GroupBy capabilities by allowing grouping by multiple variables, and lazy grouping by dask arrays. If installed, Xarray will automatically use flox by default.

Parameters#

data_input: xarray.DataArray.

xarray.DataArray to be calculated.

Note

The recommended frequence of the data_input is monthly.

dim: str

Dimension(s) over which to apply extracting. By default extracting is applied over the time dimension.

**kwargs:

Additional keyword arguments passed on to the appropriate array function for calculating sum on this object’s data. These could include dask-specific kwargs like split_every.

Returns#

xarray.DataArray with time dimension type of numpy.datetime64.

easyclimate.core.stats.yearstat.calc_yearly_std(data_input: xarray.DataArray, dim: str = 'time', **kwargs)#

Calculate yearly standard deviation.

For every adjacent sequence \(t_1, ..., t_n\) of timesteps of the same year it is:

\[o(t, x) = \mathrm{std} \left \lbrace i(t', x), t_1 < t' \leqslant t_n \right\rbrace\]

Tip

This function uses xarray.DataArray.groupby to implement the calculation. To substantially improve the performance of GroupBy operations, particularly with dask install the flox package. flox extends Xarray’s in-built GroupBy capabilities by allowing grouping by multiple variables, and lazy grouping by dask arrays. If installed, Xarray will automatically use flox by default.

Parameters#

data_input: xarray.DataArray.

xarray.DataArray to be calculated.

Note

The recommended frequence of the data_input is monthly.

dim: str

Dimension(s) over which to apply extracting. By default extracting is applied over the time dimension.

**kwargs:

Additional keyword arguments passed on to the appropriate array function for calculating std on this object’s data. These could include dask-specific kwargs like split_every.

Note

The parameter ddof is Delta Degrees of Freedom: the divisor used in the calculation is N - ddof, where N represents the number of elements. If the data needs to be Normalize by (n-1), then ddof=1.

Returns#

xarray.DataArray with time dimension type of numpy.datetime64.

easyclimate.core.stats.yearstat.calc_yearly_var(data_input: xarray.DataArray, dim: str = 'time', **kwargs)#

Calculate yearly standard deviation.

For every adjacent sequence \(t_1, ..., t_n\) of timesteps of the same year it is:

\[o(t, x) = \mathrm{var} \left \lbrace i(t', x), t_1 < t' \leqslant t_n \right\rbrace\]

Tip

This function uses xarray.DataArray.groupby to implement the calculation. To substantially improve the performance of GroupBy operations, particularly with dask install the flox package. flox extends Xarray’s in-built GroupBy capabilities by allowing grouping by multiple variables, and lazy grouping by dask arrays. If installed, Xarray will automatically use flox by default.

Parameters#

data_input: xarray.DataArray.

xarray.DataArray to be calculated.

Note

The recommended frequence of the data_input is monthly.

dim: str

Dimension(s) over which to apply extracting. By default extracting is applied over the time dimension.

**kwargs:

Additional keyword arguments passed on to the appropriate array function for calculating var on this object’s data. These could include dask-specific kwargs like split_every.

Note

The parameter ddof is Delta Degrees of Freedom: the divisor used in the calculation is N - ddof, where N represents the number of elements. If the data needs to be Normalize by (n-1), then ddof=1.

Returns#

xarray.DataArray with time dimension type of numpy.datetime64.

easyclimate.core.stats.yearstat.calc_yearly_max(data_input: xarray.DataArray, dim: str = 'time', **kwargs)#

Calculate yearly standard deviation.

For every adjacent sequence \(t_1, ..., t_n\) of timesteps of the same year it is:

\[o(t, x) = \mathrm{max} \left \lbrace i(t', x), t_1 < t' \leqslant t_n \right\rbrace\]

Tip

This function uses xarray.DataArray.groupby to implement the calculation. To substantially improve the performance of GroupBy operations, particularly with dask install the flox package. flox extends Xarray’s in-built GroupBy capabilities by allowing grouping by multiple variables, and lazy grouping by dask arrays. If installed, Xarray will automatically use flox by default.

Parameters#

data_input: xarray.DataArray.

xarray.DataArray to be calculated.

Note

The recommended frequence of the data_input is monthly.

dim: str

Dimension(s) over which to apply extracting. By default extracting is applied over the time dimension.

**kwargs:

Additional keyword arguments passed on to the appropriate array function for calculating max on this object’s data. These could include dask-specific kwargs like split_every.

Returns#

xarray.DataArray with time dimension type of numpy.datetime64.

easyclimate.core.stats.yearstat.calc_yearly_min(data_input: xarray.DataArray, dim: str = 'time', **kwargs)#

Calculate yearly standard deviation.

For every adjacent sequence \(t_1, ..., t_n\) of timesteps of the same year it is:

\[o(t, x) = \mathrm{min} \left \lbrace i(t', x), t_1 < t' \leqslant t_n \right\rbrace\]

Tip

This function uses xarray.DataArray.groupby to implement the calculation. To substantially improve the performance of GroupBy operations, particularly with dask install the flox package. flox extends Xarray’s in-built GroupBy capabilities by allowing grouping by multiple variables, and lazy grouping by dask arrays. If installed, Xarray will automatically use flox by default.

Parameters#

data_input: xarray.DataArray.

xarray.DataArray to be calculated.

Note

The recommended frequence of the data_input is monthly.

dim: str

Dimension(s) over which to apply extracting. By default extracting is applied over the time dimension.

**kwargs:

Additional keyword arguments passed on to the appropriate array function for calculating min on this object’s data. These could include dask-specific kwargs like split_every.

Returns#

xarray.DataArray with time dimension type of numpy.datetime64.