pcmdi_metrics.utils.custom_season_average

pcmdi_metrics.utils.custom_season_average(ds, data_var, season, method='xcdat')[source]

Calculates the average of a user defined season in each year.

Parameters:
  • ds (xr.Dataset) – Input xarray Dataset

  • data_var (str) – name of variable (dataArray)

  • season (str) – A string representing a custom season (e.g., “MJJ”). Must consist of one or more month abbreviations.

  • method (str, optional) – method for yearly average, by default “xcdat”, optional alternative is “xcdat”

Raises:

ValueError

Returns:

xr.Dataset – xarray Dataset that contains timeseries of seasonal mean for each year

Examples

>>> from pcmdi_metrics.utils import custom_season_average