pysteps.utils.dimension.aggregate_fields_space

pysteps.utils.dimension.aggregate_fields_space#

pysteps.utils.dimension.aggregate_fields_space(dataset: Dataset, space_window, ignore_nan=False) → Dataset#

Upscale fields in space.

It attempts to aggregate the given dataset in y and x direction in an integer number of sections of length = (window_size_y, window_size_x). If such a aggregation is not possible, an error is raised. The data is aggregated by computing the mean. Only datasets with precipitation data in the mm or mm/h unit are currently supported.

Parameters:
  • dataset (xarray.Dataset) – Dataset containing a single field or a time series of (ensemble) input fields as described in the documentation of pysteps.io.importers.

  • space_window (float, tuple or None) – The length of the space window that is used to upscale the fields. If a float is given, the same window size is used for the x- and y-directions. Separate window sizes are used for x- and y-directions if a two-element tuple is given (y, x). The space_window unit is the same as the unit of x and y in the input dataset. The space spanned by the n- and m-dimensions of the dataset content must be a multiple of space_window. If set to None, the function returns a copy of the original dataset.

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

Returns:

dataset – The new dataset.

Return type:

xarray.Dataset