I am having trouble cloud-screening Landsat 8 imagery in Google Earth Engine for a country with high cloud cover throughout the year.

I have tried various techniques but unfortunately there is a substantial amount of cloud in all imagery and the techniques given in the Earth Engine Help are not quite cutting it.

I've tried simply requesting the median of each band as given here but clouds remain. The Google Earth Engine SimpleCloudScore script works much better but leaves some gaps. The code that has worked the best for me is the code given by Nicholas Clinton in this answer. Here it is in full:

    var ic = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT_TOA");

    // A polygon representing the roi.
    var geometry = ee.Geometry.Polygon(
            [[[-121.85897778617999, 37.70881514186375],
              [-121.83975284337708, 37.76202899390253],
              [-121.94137041100134, 37.759857750255144]]]);

    var c = ic.filterBounds(geometry);

    var withCloudiness = c.map(function(image) {
      var cloud = ee.Algorithms.Landsat.simpleCloudScore(image).select('cloud');
      var cloudiness = cloud.reduceRegion({
        reducer: 'mean', 
        geometry: geometry, 
        scale: 30,
      return image.set(cloudiness);

var filteredCollection = withCloudiness.filter(ee.Filter.lt('cloud', 10));

This issue is that this only brings up entire images for a small ROI or single point of interest.

What would be ideal is if this code could be edited so that it ran the same calculation per pixel, selecting the most cloud-free image for each individual pixel within the time range given. I've tried combining it with the SimpleCloudScore script so that a function calls back to the extended simpleCloudScore algorithm in Richard's code but no luck so far.

Of course, if anybody has any completely different approaches to suggest it would be great to hear them also.

I was hoping this question could produce useful answers to all new users building up their scripts for cloud-screening in Earth Engine.


ee.Algorithms.Landsat.simpleComposite() does exactly what you're asking for. There is an example script in the Code Editor examples. For cloudy areas, fiddle with the parameters of simpleComposite() and/or increase the temporal range of the input collection.

  • Thanks Nicholas, I was hoping you'd be the one to respond! I tried the algorithm but again, gaps. When I apply your code to the specific region where those gaps are, I get a clean image. I wonder, would you be able to explain the function withCloudiness? how does the mean reducer function?
    – unlocated
    Jan 25 '18 at 8:05
  • I would note the simpleComposite algorithm is very effective though. A bit of a rudimentary question but the output for the bands are different to those of the other methods. For example for B2 it is 23 for the simpleComposite output compared to 0.09 using the other methods. If the algorithm also applies TOA calibration to the Landsat raw scenes, shouldn't the output be the same?
    – unlocated
    Jan 25 '18 at 8:16
  • You need to set asFloat: true to avoid the output being scaled to 8 bits. Jan 25 '18 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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