Using S2A gml cloud masks

How can one open the S2A cloud gml files in SNAP ? I’m referring to the gml files that come along with the S2A dowload (Granule, Q1_data folder). The Mask Manager only allows import of .xml, .bmd or .bmdx.

I’d appreciate some advice as to how to use these gml files downloaded with the image, so as to remove cloud areas. Also, any advice on whether these masks also treat the shadow area or a respective cloud.



The Cloud Masks (and others) are available in Mask Manager (view > Tool Windows > Mask manager)



S2 MPC/CC Operations Manager

Thanks. I noted that the masks are only viewable on the original S2A image. I was trying to search for the masks for a resampled subset I’d created for the original image.
When I click Cloud Mask and Cirrus Mask, lots of cloud areas are not covered. Nor are they in any of the innate masks downloaded with the original S2 image. Refer to image.

So it seems that one would have to digitise each cloud manually to create a cloud mask ?


To get a cloud mask you can try IdePix. You can find it at Optical -> Preprocessing -> Masking. This will classify your scene, including clouds.

Thanks. I’ve converted my L1C product to a L2A using Sen2Cor AT 10m resolution. I’ve then followed your steps to use IdePix on this S2A image (Image 1). However, I received an error message - it seems that S2 images are not supported in IdePix (Image 2). Can it be so, since Sentinel 2 MSI was available in the drop down list ?

Image 1:

Image 2:

You need to use the L1C products as input, not the L2 products generated by Sen2Cor.
Are you sure you are using the latest version of SNAP? I think the error message is different since a while.

Thanks. IdePix did run on the resampled L1C product. I then opened Mask Manager, on the resultant product (resampled_idepix). However, none of the selected cloud masks did appear on the image, so I’m really questioning whether any masks were created at all, even considering there are obvious cloud areas and their shadows.

Interestingly, if one clicks the top row in the Mask Manager, labelled as ‘Invalid pixels’, all the scene is selected:

I do have the latest SNAP version installed with all the recent updates.


Can you tell the name of the product?

Which product are you referring to ? The image is a S2A level L1C. My SNAP version is 5.0

I mean the file name. Something like S2A_MSIL1C_20170211T075031_N0204_R135_T36MYD_20170211T080009.
So we can download it and replicate what you have done.


Here is the path for the xml file:

I then resampled this image and ran the IdePix on it. I also applied the Sen2Cor.

I just let idepix run with the same product. I have only resampled the product before to 20m.
I got a nice result as you can see here:

I don’t know what went wrong for you. Maybe you try again?

Thanks. I had resampled to 10m. Could that make a difference ?

Just tried it on the 10-meter resolution. I got the same result.

OK, so just to reconfirm so that I will repeat the process. You carried out (1) resampling to 10m and (2) ran IdePix on the resultant resampled image. The starting xml file you used was:
S2A_MSIL1C_20170108T095401_N0204_R079_T33SVV_20170108T095949.SAFE\GRANULE\L1C_T33SVV_A008084_20170108T095949\MTD_TL.xml ?

Ah, maybe this is the problem.
I did not start on the granule.
I’ve started from directly S2A_MSIL1C_20170108T095401_N0204_R079_T33SVV_20170108T095949.SAFE\MTD_MSIL1C.xml

OK thanks. Will try it out from there then.

Thanks. It worked :slight_smile: