Cloud mask for SLSTR lavel1B image


#1

how can i get pixel wise cloud information for SLSTR lavel 1B images. I can see flags_in.nc has cloud_in. but what does the number signify. how to tell if the pixel is cloudy or not. Any document would be helpful. I am trying to screen cloudy pixel over Dome C.


#2

If you open the xfdumanifest.xml instead of the *.nc files in SNAP you are provided with the necessary information.
Also, the SLSTR Document Library is probably useful for you.


#3

Hi,
Thank you. I have more than 1000’s images and opening each image through SNAP is not helpful. Is there any python (simple code) that i can use to get the information about the cloud information for SLSTR lavel 1B images.

Thanks
Ashish


#4

you can access the netcdf variables through python’s netcdf library, e.g.:

data = netCDF4.Dataset(YOURFILENAME, 'r', 'NETCDF4').variables['cloud_in'][:]
if isinstance(data,np.ma.MaskedArray):
    data = data.data

this will provide the flags “summarized” into one integer value per pixel. That is, for accessing the mask layers, represented by individual bits, you have to disentangle the integer value into its bits. I do that by:

flags=np.unpackbits(data[...,np.newaxis].view("uint8")[...,::-1][...,np.newaxis],axis=-1).reshape(data.shape+(-1,))[...,::-1]

flags is then an array of dimensions NxImage,NyImage,NFlagbits (i have made this and tested it only for 16-bit flags. might need some adaptations for other number of bits).

there might be (better) ways to do this through snappy, of course…


#5

Thanks. But information upto 8(https://sentinel.esa.int/web/sentinel/technical-guides/sentinel-3-synergy/level-2/pixel-flagging) bits are only provided. How can i interpret the meaning ??

3 0 clear Indicates cloud-free pixels.
3 1 shadow Indicates pixels shadowed by clouds.
3 2 uncertain Indicates uncertain cloud detection.
3 3 cloud Indicates cloudy pixels.
4 4 ice_or_snow Indicates ice or snow.
8 8 land Indicates land.
16 16 MIR_good Quality of MIR measurement is good.
32 32 B3_good Quality of B3 measurement is good.
64 64 B2_good Quality of B2 measurement is good.
128 128 B0_good Quality of B0 measurement is good.

#6

The link you shared is for level-2 SYN data not for SLSTR level-1 data.

Maybe the following two links shine some light on your question.
https://sentinel.esa.int/web/sentinel/technical-guides/sentinel-3-slstr/level-1/cloud-identification