pysteps.utils.dimension.square_domain

Contents

pysteps.utils.dimension.square_domain#

pysteps.utils.dimension.square_domain(dataset: Dataset, method='pad', inverse=False)#

Either pad or crop a field to obtain a square domain.

Parameters:
  • dataset (xarray.Dataset) – Dataset containing the input fields as described in the documentation of pysteps.io.importers.

  • method ({'pad', 'crop'}, optional) – Either pad or crop. If pad, an equal number of pixels filled with the minimum value of the precipitation field is added to both ends of the precipitation fields shortest side in order to produce a square domain. The quality and velocity fields are always padded with zeros. If crop, an equal number of pixels is removed to both ends of its longest side in order to produce a square domain. Note that the crop method involves an irreversible loss of data.

  • inverse (bool, optional) – Perform the inverse method to recover the original domain shape. After a crop, the inverse is performed by doing a pad.

Returns:

dataset – the reshaped dataset

Return type:

xarray.Dataset