@marpet, Thank you so much for you help. I have done Mosaicing of cloudy sentinel 2B_L2A image. i have attached the cloud masking image here. please tell me how can i replace the mask areas with reference image. Thank you in advance.
if both the masked and the reference image have the same pixel extent and size, you can replace the masked values in the band maths with an IF statement as demonstrated here: Replacing NaN with 3x3 average
. In the picture, 2 no. image is cloudy, 3 no. image is clear image and 4 no. image that i have masked the cloud using Moasaicing option in SNAP 6. Now i want to replace the cloud mask areas from 4 no. image by 3 no. clear image. i do not want to replace with average values of around the NaN value areas. I exactly want to replace the cloudy areas by their corresponding clear areas. Otherwise, the my mapping result will not be good. Thank you so much
I understood that - the principle to replace the values is the same. Instead of the average raster you simply use image number 4 (I4). But you have to do this band by band:
IF I2_b1 == 0 THEN I4_b1 ELSE I1_b1
IF I2_b2 == 0 THEN I4_b2 ELSE I1_b2
IF I2_b3 == 0 THEN I4_b3 ELSE I1_b3
…
If you are not bound to the date you currently use. The S2GM service might be useful for you. For your region (53TLN) L2A data is only available from December 2018 onwards.
There is also Theia which is providing mosaics of Sentinel-2 but I think your region is also not available. (@OHagolle)
@marpet, i have created Cloud mask band using band math given in picture(Cloud_mask). Then i have resampled the the S2B_MSIL2A image considering 10 m pixel size, not the reference band.
After i have mosaiced the image cloud_Mask image (Mosaic) and i have got the cloud mask image given in picture. I have an clear image near date. Now i want replace the Could_mask areas by corresponding parts of clear image. could you tell me the steps, procedures or ways how will i replace the cloud areas. i have uploaded cloudy, cloud_mask image and clear image previous time. Thank you in advance.
You use both the maskes image and the mosaic. Open the band maths and go to the advanced expression editor. You find a dropdown menu in the top where you can switch between both products and create the statement by selecting the bands as formulated above.
@ABraun, i am sorry to disturb you again, i can not do it. could you write the band math according to my image. i can not match your band math with my image. could you tell me which will be my target image? During Mosaic as target product there is no product option in Band math Expression Editor page. i am showing some pictures below.
@Rim: Your rasters should not be named band_1, band_2 ect. in SNAP. If you import the L2A product they should have correct names and also there should be quality bands in the product.
You can then check “show masks” in the band maths to create your expression, but currently the statement refers to raster names which are not there.
Have you done anything before applying the band maths?