Can you define pixel validity in multi-size mosaic of S2 tiles?

Is there any way to edit/set masks that determine which pixels are considered valid by multi-size mosaic?

For example, I am working with tiles that occasionally include edge of swath pixels that have very low values but are still valid and can cause problems in mosaics - see effect below caused by: S2A_MSIL2A_20170408T113321_N0204_R080_T30UVA_20170408T113407.SAFE

I can easily write a mask function (at each resolution) to eliminate these pixels but can I do this and then use the masks to inform a multi-size mosaic??

Keeping files multi-resolution for as long as possible in the analysis chain would help restrict the number of files and directories to be managed - and SNAP is hard to beat in terms of its ability to visualize images :slight_smile: . However, the value of SNAP tools like multi-size mosaic is very limited if there is no way to define pixel validity or perform some initial masking :disappointed: Suggestions welcome!

These edges are a problem in L2A products introduced by sen2cor. When they do resampling in their AC they don’t consider the no-data correctly outside of the orbit swath. Therefore the values at the borders are lowered. You can minimise this issue by expression that’s true, but as far as I know it can not be completely eliminated. The detector footprints are not sufficient.
In the expressions you use in the mosaic you can use your valid-expressions. Use a If-then-else approach. Unfortunately the conditions which are available in the single-resolution mosaic are not available in the multi-resolution mosaic.
Would you mind to share your expressions?

Many thanks - I’ve simply been using the B2 band in the cases I’ve encountered to limit valid pixels to where B2>0.0001. The edge cells in the scenes I’ve examined have consistent values of 0.0001 in B2 - not sure if this is the case for all such scenes.