Gpt : applying multiple flags and band math

Hello everyone,

I would like to apply the masks/flags (cloud/lands etc) to some bands in the band math operator to be applied later in my gpt graph. I’m doing " cloud ? NaN : Band1 " , which works (it masks the Band1 data where the cloud flag is up, in a new product). How could I do it multiple times with multiple masks ? I tried with the “||” operator but it is not working.
I can do it multiple time in the script, but I think that I need to do it “virtually” ? To store only the final product and avoid memory troubles, I don’t know how inefficient repeating a band math operation for each flag could be.

Can I apply all the wanted masks at the same time ?

Cheers

HI madjidh,

actually it should work with the ‘||’ operator.
I just tried on a sentinel-3 product with this expresson:

quality_flags_land || quality_flags_coastline ? NaN : Oa08_radiance

As a result I got only water pixels.

Can you tell what is not working in your case when you use the or operator. Have you tried the expression first in SNAP Desktop?

1 Like

Thanks Marco,

I was doing quality_flags_land ? NaN || quality_flags_coastline ? NaN || etc : Oa08_radiance
rather than your method !