0

I have implemented the s2cloudless code as written in the official documentation. The only changes I did were:

  • Skipping the step where the median is calculated (I aim to do a time-series analysis);
  • Adding code for: NDVI as well as more specific band maths, visparams for my assets and charting.

The code works perfectly and clouds as well as sometimes cloud shadows are masked out. However, I have noticed that sometimes agricultural fields are also nullified - see below.

enter image description here

I am guessing this is because recently mown fields look very pale? Albeit I was under the impression that the algorithm learnt cloud probability from a variety of pictures taken at different times, not from pixel colour.

Changing the var MAX_CLOUD_PROBABILITY doesn't yield different results.

What could lie behing that, and is there a way to refine the output? Alternatively, do you suggest any other cloud masking code that does not run the risk of masking out fields?

I am working with grass mowing detection, which is why it's important that pale fields remain in the picture.

Link to my code, if helpful.

3
  • 1
    NDVI of cloudly images is low (usually) since NIR and RED reflectance from clouds is similar. I suppose the NDVI of your fields should be over 0.2 in most cases (unless the crop is emerging or the soil has been prepared). You can use s2cloudless + NDVI to mask out only when NDVI is lower than some limit
    – aldo_tapia
    Commented Apr 13, 2023 at 14:49
  • very good idea @aldo_tapia. Would you know how to modify the s2cloudless code to only mask out when NDVI < 0.25? As seen in my code, NDVI under this condition has only been calculated after the mask has been applied. I'm new to coding and wouldn't be able to edit the original GEE script myself. Commented Apr 14, 2023 at 11:05
  • Can't run the code because tables are not public
    – aldo_tapia
    Commented Apr 17, 2023 at 13:08

1 Answer 1

1

You are currently masking out pixels where NDVI <= 0.25. That's why some fields are masked out. It's unrelated to the cloud masking. If you remove the cloud masking code, you'll still see these fields masked out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.