geocat.comp.climatologies.climatology_average

geocat.comp.climatologies.climatology_average#

geocat.comp.climatologies.climatology_average(dset, freq, custom_seasons=None, time_dim=None, keep_attrs=None)#

This function calculates long term hourly, daily, monthly, or seasonal averages across all years in the given dataset.

Parameters:
  • dset (xarray.Dataset, xarray.DataArray) – The data on which to operate. It must be uniformly spaced in the time dimension.

  • freq (str) – Frequency alias. Accepted alias:

    • hour: for hourly averages

    • day: for daily averages

    • month: for monthly averages

    • season: for meteorological seasonal averages (default: DJF, JJA, MAM, and SON)

  • custom_seasons (list[str], str, optional) – The list of 3-months season aliases or a single seaonal alias string. Analysis is done on the provided seasons. This parameter will be ignored if the freq is not set to season. Accepted alias:

    • DJF : for a season of December, January, and February

    • JFM : for a season of January, February, and March

    • FMA : for a season of February, March, and April

    • MAM : for a season of March, April, and May

    • AMJ : for a season of April, May, ad June

    • MJJ : for a season of May, June, and July

    • JJA : for a season of June, July, and August

    • JAS : for a season of July, August, and September

    • ASO : for a season of August, September, and October

    • SON : for a season of September, October, and November

    • OND : for a season of October, November, and December

    • NDJ : for a season of November, December, and January

  • time_dim (str, optional) – Name of the time coordinate for xarray objects. Defaults to None and infers the name from the data.

  • keep_attrs (bool, optional) – If True, attrs will be copied from the original object to the new one. If False, the new object will be returned without attributes. Defaults to None which means the attrs will only be kept in unambiguous circumstances.

Returns:

computed_dset (xarray.Dataset, xarray.DataArray) – The computed data

Note

Seasonal averages are weighted based on the number of days in each month. This means that the given data must be uniformly spaced (i.e. data every 6 hours, every two days, every month, etc.) and must not cross month boundaries (i.e. don’t use weekly averages where the week falls in two different months)