geocat.comp.climatologies._calculate_center_of_time_bounds#

geocat.comp.climatologies._calculate_center_of_time_bounds(dset, time_dim, freq, calendar, start, end)#

Helper function to determine the time bounds based on the given dataset and frequency and then calculate the averages of them.

Returns the dataset with the time coordinate changed to the center of the time bounds.

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

  • time_dim (str) – Name of the time coordinate for xarray objects

  • freq (str) – Alias for the frequency of the adjusted timestamps (i.e. daily, monthly)

  • calendar (str) – Alias for the calendar the time stamps are in (i.e. gregorian, no leap years)

  • start (str, cftime.datetime) – The starting date of the data. The string representation must be in ISO format

  • end (str, cftime.datetime) – The ending date of the data. The string representation must be in ISO format

Returns

computed_dset (xarray.Dataset, xarray.DataArray) – The data with adjusted time coordinate

Notes

See xarray.cftime_range for accepted values for freq and calendar.