pysteps.utils.dimension.aggregate_fields

pysteps.utils.dimension.aggregate_fields(R, window_size, axis=0, method='mean')

Aggregate fields. It attemps to aggregate the given R axis in an integer number of sections of length = window_size. If such a aggregation is not possible, an error is raised.

Parameters:
R : array-like

Array of any shape containing the input fields.

window_size : int

The length of the window that is used to aggregate the fields.

axis : int, optional

The axis where to perform the aggregation.

method : string, optional

Optional argument that specifies the operation to use to aggregate the values within the window. Default to mean operator.

Returns:
outputarray : array-like

The new aggregated array with shape[axis] = k, where k = R.shape[axis]/window_size