S3 Masks/quality flags management with GPT

Hi again,
as you may already knows from other topics I have created on the forum, I’m working on reprojecting some OLCI L1/L2 and SLSTR L1/L2 products.
Now I have a question about masks and quality flags usage.

So I have a Graph chain defined like this:

  1. Read the xfdumanifest
  2. Subset (with bandnames and region parameters)
  3. Reproject
  4. #N Subsets (1 band each)
  5. #N Writes (1 band each to tiff )

I have seen around on the forum some samples about bandMaths OP usage to export masks as bands.
So I was able to create a standalone graph which simply read a product and export the mask as a target band using the name of the mask as expression.

Couple of questions now:

  1. Will the reproject/subset(Region) operations also be applied to masks OR there is any way to make this happen with some additional nodes/configuration params?
  2. Supposing I would like to create an output tif with pixels covered by clouds being filtered out, should I define a BandMaths node between previous steps 4 and 5 applying a kind of AND with the quality_flags?
  3. What about if I want generate on steps 4 and 5 a quality_flags output GeoTIFF? will the quality_flags mask survive and be propagated and properly reprojected after steps 1,2,3?
  4. Final question: I see some netcdfs from OLCI L2 containing quality flags as “long” datatype whilst the bandMaths op supports up to Int32. Opening them on SNAP Desktop GUI I see WQSF_lsb and WQSF_msb so I think it’s splitting it into 2 representable datatypes. In relation to previous 3 questions, how should I deal with that on GPT graph?

Thanks for your assistance and sorry for all of these questions.

Yes masks will be processed as any other bands, you can reproject/subset them and subset them. On difference to other bands is that masks (flag bands) are not interpolated.

This could be an option.

Yes, they will survive. But probably not in the geotiff.

Yes the source data is split into to flag variables but there is no need to especially deal with it. Treat them as normal bands or use it in expressions. You can use the flag like “WQSF_lsb.CLOUD ? NaN : Oa01_reflectance” or you can use the Mask like “WQSF_lsb_CLOUD ? NaN : Oa01_reflectance”. Note one is seperated by a dot the other with a underscore. For Each flag there is also a mask.