You can use the ee.Image.unmask()
method
var noDataMask = myImage
.unmask(-99) // give no data pixels an abitrary value outside the range of your data
.eq(-99); // make a boolean raster using the assigned value
noDataMask = (myImage
.unmask(-99) # give no data pixels an abitrary value outside the range of your data
.eq(-99)) # make a boolean raster using the assigned value
Here white is value 1
, where the .eq(-99)
evaluates to true
(where clouds are masked, leaving patches of no data), and black is 0
where it is false
.
To invert the mask, use .neq(-99)
in place of .eq(-99)
.