// Load a cloudy Landsat scene and display it.varcloudy_scene=ee.Image('LANDSAT/LT05/C01/T1_TOA/LT05_015030_20100531');Map.centerObject(cloudy_scene);Map.addLayer(cloudy_scene,{bands:['B4','B3','B2'],max:0.4},'TOA');/* Add the cloud score band, which is automatically called 'cloud'. The simpleCloudScore function
uses brightness, temperature, and NDSI to compute a score in the range [0,100]. */varscored=ee.Algorithms.Landsat.simpleCloudScore(cloudy_scene);/* Create a mask from the cloud score by experimentally selecting a threshold. Smaller thresholds
mean more pixels are selected as clouds. */varmask50=scored.select(['cloud']).lte(50);// selects pixels with cloud score of 50 or lessvarmask30=scored.select(['cloud']).lte(30);// Apply the masks created above to the image and display the result to determine an appropriate threshold. varmasked50=cloudy_scene.updateMask(mask50);//apply mask50Map.addLayer(masked50,{bands:['B4','B3','B2'],max:0.4},'masked50');varmasked30=cloudy_scene.updateMask(mask30);//apply mask30Map.addLayer(masked30,{bands:['B4','B3','B2'],max:0.4},'masked30');