I'm pulling GEE images for large areas, for a short time period and with a fairly strict cloud condition. This can leave some parts of the GEE image with gaps where the collection has no images. That's ok given my needs. But I would like to export a simple boolean or binary mask showing where the gaps in the image collection are (eg 1 for data and 0 for no data).
I'm interested in the water so would like to avoid the assumption that no data patches are black (ie avoid the use of relationals like .eq(0) ).
Is there a simple method to output some sort of raster or vector with image validity and/or no data values? I'm doing this in Python/Colab.
EDIT
I've tried .unmask as follows:
#get collection and cloud mask
S2B8=s2_sr_masked.select('B8').reduce(ee.Reducer.median()) #reduce 1 band
S2nodata=ee.Image(S2B8).unmask(-99).eq(-99) #unmask
NoDataUTM=S2nodata.reproject(thisCRS, scale=100) #reproject
#add a task to export
The output has to correct location, projection and resolution. But it's uniform 1s and by looking at an actual image pulled with similar code, there is definitly both image and data gaps. So there should be both 1s and 0s. Is there a code error in the conversion from collection to image?
Extreme example below. Here there is only a tiny spot of data in the SE corner of the image. But if you look at the NoData... layer on the left, it goes from 1 to 1. I checked and both minimum and maximum are indeed both 1.