get_masked_region

seas.rois.get_masked_region(array: numpy.ndarray, mask: numpy.ndarray, maskval: Optional[float] = None)[source]

Extract a spatially masked array where the mask == 1 or mask == maskval. Reinsert masked region using insert_masked_region function.

Parameters

array – a (t,x,y) numpy array or an (x,y,c) numpy array

Returns

the masked array in (t,xy) or (xy,c) format.

Return type

masked_array

Raises

Exception – if (x,y) mask indices did not match the shape of the input array.