wradlib.zonalstats.mask_from_bbox¶
-
wradlib.zonalstats.
mask_from_bbox
(x, y, bbox, polar=False)¶ Return 2-d index array based on spatial selection from a bounding box.
Use this function to create a 2-d boolean mask from 2-d arrays of grids points.
Parameters: - x (
numpy.ndarray
) – x (Cartesian) coordinates of shape (num rows, num columns) - y (
numpy.ndarray
) – y (Cartesian) coordinates of shape (num rows, num columns) - bbox (dict) – dictionary with keys “left”, “right”, “bottom”, “top” These must refer to the same Cartesian reference system as x and y
- polar (bool) – if True, x, y are aligned polar (azimuth x range)
Returns: mask, shape (
numpy.ndarray
, tuple) – mask is a boolean array that is True if the point is inside the bbox, shape is the shape of the True subgrid- x (