This question is an addition to this answer to Creating Sentinel-2 cloud free, cloud-shadow free composite or scene on Google Earth Engine (GEE)?

There Rodrigo E. Principe showed how to mask out the clouds. I am wondering if there is a way to mask the shadows as well. And, if possible then not only the shadows of the clouds but also, shadows in rugged topography.

1 Answer 1


There has been an approach to do this using a decision tree: Ready-to-Use Methods for the Detection of Clouds, Cirrus, Snow, Shadow, Water and Clear Sky Pixels in Sentinel-2 MSI Images.

I have adapted the code to EE, and make it open source in geetools, both for the Python API and for the JavaScript API

var cld = require('users/fitoprincipe/geetools:cloud_masks')
var image = ee.Image('COPERNICUS/S2/20151123T142942_20170221T180430_T19GCN')


var mask_shadow = cld.hollstein_S2(['shadow'])(image)

Map.addLayer(mask_shadow, {bands:['B8', 'B11','B4'], min:0, max:5000})

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.