IDEPIX masks as bands after masking with shapefile using Land-Sea-Mask

Hello!

I use Sentinel-2 L1C products and want to keep IDEPIX masks as bands. After applying IDEPIX, I used Band extractor to have masks in the band list, however, after importing shapefile and masking out only the polygon area, masks disappear from the band list. I wonder if there is a way how to keep them?

Best regards,
Dalia

are the masks inside the bands list or just under masks?

grafik

I am asking this because it makes a difference regarding how they are stored (and preserved).

After using BandsExtractor everyhing appears together. But masks still have M letter.

you can make a mask permanent in two steps:

  1. Create a new band using the band maths, but remove this checkbox grafik

  2. File > Save Product

This will write all bands to a physical raster and you won’t lose them after closing the product.

Thank you for the answer! So this is the only way to do it?

as far as I know - yes, a mask is simply a logical expression (or the sum of several combined). It differs from a permament raster and needs to be converted, especially if you want to use it outside SNAP or when you remove the vector from the data.

The band extractor is not working properply.
It does not copy the flag band on which the masks are based on. Each flag defines a mask.
And if you have used the land/sea mask operation to apply the shapefile then you had bad luck again. This one does not handle the masks at all. And it’s not its intention.
It just changes the data of the selected bands.
If you want to use the result of it, you need to merge with the original data. The merging can be done by another operator, named ‘Merge’, available in the GraphBuilder and on the command line or you can use the band math to copy a band from one product to another.

The question is actually why do you need the masks as bands.
Do you need them in another application?
Then the suggestion Andreas made is proberbly the best. Turn them into a band via the band math. Or you can use the flag band ‘pixel_classif_flags’ and check which bits are set for each pixel, if this is doable in the other application.

1 Like