pysteps.utils.dimension.clip_domain

pysteps.utils.dimension.clip_domain(R, metadata, extent=None)

Clip the field domain by geographical coordinates.

Parameters:
R : array-like

Array of shape (m,n) or (t,m,n) containing the input fields.

metadata : dict

Metadata dictionary containing the x1, x2, y1, y2, xpixelsize, ypixelsize, zerovalue and yorigin attributes as described in the documentation of pysteps.io.importers.

extent : scalars (left, right, bottom, top), optional

The extent of the bounding box in data coordinates to be used to clip the data. Note that the direction of the vertical axis and thus the default values for top and bottom depend on origin. We follow the same convention as in the imshow method of matplotlib: https://matplotlib.org/tutorials/intermediate/imshow_extent.html

Returns:
R : array-like

the clipped array

metadata : dict

the metadata with updated attributes.