I applied the tutorial for 'Sentinel-2 Cloud Masking with s2cloudless' and have this script in GEE:


In this tutorial, I do not understand the purpose of 'cloud transform' layer and I do not know how to display the final cloud free image. Should I apply a median to see the final result? If yes, over which layer?

1 Answer 1


The purpose of 'cloud transform' is to estimate projection of cloud shadows based on cloud position and sun azimuth. Or, as the author specifies it // Project shadows from clouds for the distance specified by the CLD_PRJ_DIST input.

Then, if you want to display the cloud-free image, you need to apply all those masks using apply_cld_shdw_mask() function. Here is a result: https://code.earthengine.google.com/0701d40fb1f844cfd376e8e6cbd7d946

However, if you want to make a cloud-free composite, you have to map this function over many images and then reduce them into a composite (e.g. take median). Here is a result: https://code.earthengine.google.com/d9aaa276f0fa1ab33e78230e8f348c6f

  • Thanks @Basile, this solved my problem. I was after the composite as you mentioned
    – Paris
    Apr 30, 2021 at 13:48

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