Cloud related problem

Dear sir,

I am preprocessing the Sentinel 2A data MLSI1C. For cloud removal, I have used the Idepix cloud mask. Still, I am getting the cloudy image. The processed image is shown below. Can you please suggest how I can remove the cloud completely.

Idepix doesn’t remove the clouds, it is just one way to identify cloud pixels.
Masking clouds in this context means to exclude all pixels identified as clouds from the image. It is not able to restore the information below the clouds.
Or did I miss your point?

1 Like

Dear Sir,

Thanks for reply.

So does this mean that all pixels identified as clouds will not be considered when analysis is done on a satellite imagery which has undergone cloud masking by Idlepix?

you can define them as invalid in the band properties and they will probably be excluded in subsequent tasks, yes.

How do I define them as invalid in the band properties. Please walk me through this as it has been a challenge for the past 2 weeks.

Thanks

I haven’t done it yet but I would lookup the number of clouds in the IdePix result and open the band properties of the original product. There you can define a “valid pixel expression” which could be Idepix=!clouds or something like that. That depends on the exact output of the module.

Hello, could you please check the attached xml. I try to mask clouds + cloud shadows from every S2 bands and write them to a new product using this xml, but I get the following error:

mask.xml (4.1 KB)
Thanks

I opened the xml in the graph builder and applied it to a calibrated Sentinel-2 image and it worked

The only thing I noticed it that it only works if all rasters have the same resolution and pixel size. But as you are obviously referring to the scene_classification metadata which is only present after sen2cor, you probably have calibrated it yourself.

Thanks for your quick answer. As I see you get a single band product (only B2 band)(now I see, if we load the xml into the Graph Builder, only the first section will be applied. Why?), but I want to have a multiband image with 10 masked bands. I used a subset from a calibrated (L2A) and resampled S2 image and get a java.io.EOFException error when running the xml from the Graph Builder. Do you see any syntax error in the xml especially where I try to create the new bands based on the expressions? Or is the Read/Write node? Do you understand the error messages in the cmd, because I don’t :slight_smile:

Unfortunately, I am no expert for the math syntax, nor for the java error. Maybe @marpet can answer this

ok, thank you. I try to share my problem in an other topic or ask marpet directly.

He will get a notification because I used the @ in my post. So let’s just wait.

Now I updated the Java on my PC and regenerated the input image (a subset of the resampled output of the sen2cor process). It runs in cmd without any error and derives the expected result. So the xml is correct :slight_smile:

good to hear :+1:

Yes, good to hear.
Because I can’t explain the error message either. But I have seen it a few times before, but I don’t know where it comes from.

@marpet @ABraun in removing the clouds of the sentinel 2 images the i have the sentinel 2 level 2 images. the cloud areas doesn’t display 0 values after pre processing so i like to remove them before further processing. the problem is in the quality_cloud_confidence image given in the processed outputs assign a value range from 0 to 100 . Therefore even for the urban content it has assigned a value.i want to know if i want remove only the clouds should i use only the value 100 in quality_cloud_confidence image or any other methods?

Probably you have to find an appropriate threshold. The cloud screening of sen2cor is not perfect. It is a tough job and all cloud-screening algorithms struggle in on or another case.
For filtering the cloudy pixels you can also use the flags.
image
Maybe you can find a condition using the confidence and the flags in conjunction.