Python’s ma.getmask()
function returns the mask of a masked array (i.e, the nomask
).
ma.getmask(a)
The ma.getmask()
function takes the a
value as a parameter. This represents an input MaskedArray for which the mask is required.
The ma.getmask()
function returns an array of Boolean values indicating which input array elements are nomask
or mask
. It returns True
if the element is mask
and False
if the element is nomask
.
import numpy as npimport numpy.ma as ma# creating a MaskedArray with the element 3 as the maskmyarray = ma.masked_equal([[1,2],[3,4]], 3)# implementing the ma.getmask() functionnewarray = ma.getmask(myarray)print(newarray)
myarray
، which has its element 3
as the mask
.ma.getmask()
function on the input MaskedArray. The result is assigned to a variable newarray
.newarray
.