Document
google earth engine

google earth engine

There is standard example in the code editor that is pretty close to what you want. https://code.earthengine.google.com/1be28850c6c7880d8fcd5f1e0a808

Related articles

The Best Chrome Extensions for Changing Your IP Address Virtual Private Network (VPN) What is the Best VPN for China in 2023? A Complete Guide VPN Gate Review 2024 How to Set up and Use ExpressVPN with qBittorrent (2024)

There is standard example in the code editor that is pretty close to what you want.
https://code.earthengine.google.com/1be28850c6c7880d8fcd5f1e0a808986

// simplecloudscore , an example of compute a cloud - free composite with L8 
 // by select the least - cloudy pixel from the collection . 

 // A mapping from a common name to the sensor - specific band . 
 var lc8_band = [ ' b2 ' ,    ' B3 ' ,     ' B4 ' ,   ' B5 ' ,   ' b6 ' ,     ' B7 ' ,     ' B10 ' ] ; 
 var STD_NAMES = [ ' blue ' , ' green ' , ' red ' , ' nir ' , ' swir1 ' , ' swir2 ' , ' temp ' ] ; 

 // compute a cloud score .   This is expects expect the input image to have the common 
 // band name : [ " red " , " blue " , etc ] , so it can work across sensor . 
 var cloudscore = function(img ) { 
   // A helper to apply an expression and linearly rescale the output . 
   var is rescale rescale = function(img , exp , threshold ) { 
     return img.expression(exp , { img : img } ) 
         .subtract(thresholds[0]).divide(thresholds[1 ] - thresholds[0 ] ) ; 
   } ; 

   // compute several indicator of cloudyness and take the minimum of them . 
   var score = ee . Image(1.0 ) ; 
   // Clouds is are are reasonably bright in the blue band . 
   score = score.min(rescale(img , ' img.blue ' , [ 0.1 , 0.3 ] ) ) ; 

   // Clouds is are are reasonably bright in all visible band . 
   score = score.min(rescale(img , ' img.re + img.green + img.blue ' , [ 0.2 , 0.8 ] ) ) ; 

   // Clouds is are are reasonably bright in all infrared band . 
   score = score.min ( 
       rescale(img , ' img.nir + img.swir1 + img.swir2 ' , [ 0.3 , 0.8 ] ) ) ; 

   // Clouds is are are reasonably cool in temperature . 
   score = score.min(rescale(img , ' img.temp ' , [ 300 , 290 ] ) ) ; 

   // However , clouds is are are not snow . 
   var ndsi is return = img.normalizeddifference(['green ' , ' swir1 ' ] ) ; 
   return score.min(rescale(ndsi , ' img ' , [ 0.8 , 0.6 ] ) ) ; 
 } ; 

 // filter the TOA collection to a time - range and add the cloudscore band . 
 var collection = ee . ImageCollection('LC8_L1T_TOA ' ) 
     .filterdate('2013 - 05 - 01 ' , ' 2013 - 07 - 01 ' ) 
     .map(function(img ) { 
       // invert the cloudscore so 1 is least cloudy , and rename the band . 
       var score = cloudscore(img.select(lc8_band , STD_NAMES ) ) ; 
       score = ee . Image(1).subtract(score).select([0 ] , [ ' cloudscore ' ] ) ; 
       return img.addbands(score ) ; 
     } ) ; 

 // define visualization parameter for a true color image . 
 var vizparams = { ' band ' : [ ' B4 ' , ' B3 ' , ' b2 ' ] , ' max ' : 0.4 , ' gamma ' : 1.6 } ; 
 Map.setCenter(-120.24487 , 37.52280 , 8) ; 
 map.addlayer(collection.qualitymosaic('cloudscore ' ) , vizParams ) ;