insert_masked_region

seas.rois.insert_masked_region(array: numpy.ndarray, masked_array: numpy.ndarray, mask: numpy.ndarray, maskval: float = 1)[source]

Insert a spatially masked array from get_masked_region. Masked array is inserted where the mask == 1 or mask == maskval. Accepts masked array in (t,xy) or (xy,c) format. Accepts (t,x,y) arrays or (x,y,c) arrays, returns them in the same format.

Parameters
  • array – A (t,x,y) numpy array or an (x,y,c) numpy array

  • masked_array – The masked array in (t,xy) or (xy,c) format. Usually extracted using get_masked_region.

  • mask – The mask used to extract the masked array originally, will be used for reinsertion.

  • maskval – The value used to extracted the region, if not the default of 1.

Returns

The array with the masked values reinserted.

Return type

array