pysteps.utils.dimension.aggregate_fields_time

pysteps.utils.dimension.aggregate_fields_time#

pysteps.utils.dimension.aggregate_fields_time(dataset: Dataset, time_window_min, ignore_nan=False) → Dataset#

Aggregate fields in time.

It attempts to aggregate the given dataset in the time direction in an integer number of sections of length = time_window_min. If such a aggregation is not possible, an error is raised. The data is aggregated by a method chosen based on the unit of the precipitation data in the dataset. mean is used when the unit is mm/h and sum is used when the unit is mm. For other units an error is raised.

Parameters:
  • dataset (xarray.Dataset) – Dataset containing a time series of (ensemble) input fields as described in the documentation of pysteps.io.importers. They must be evenly spaced in time.

  • time_window_min (float or None) – The length in minutes of the time window that is used to aggregate the fields. The time spanned by the t dimension of R must be a multiple of time_window_min. If set to None, it returns a copy of the original R and metadata.

  • ignore_nan (bool, optional) – If True, ignore nan values.

Returns:

dataset – The new dataset.

Return type:

xarray.Dataset