Algorithms in Google Earth Engine (gee)

ee.Algorithms.Landsat.simpleComposite()

This function processes the landsat image set and returns a new image that has gone to the cloud

var imgs = ee.ImageCollection("LANDSAT/LC08/C01/T1")
               .filterBounds(ee.Geometry.Point(106.1125, 30.3772))
               .filterDate('2018-01-01','2018-12-31')
               
var img_simpleComposite = ee.Algorithms.Landsat.simpleComposite({collection:imgs,asFloat:true})

Map.setCenter(106.1125, 30.3772,8)

Map.addLayer(imgs.mosaic(),{},"imgs.mosaic()")
Map.addLayer(img_simpleComposite,{},"img_simpleComposite")

ee.Algorithms.Landsat.simpleCloudScore()

This function works on Image. It can add a cloud band to the original Image band and return a new Image. This Image has one more cloud band than the original Image.

This function can only be used on landsat images, not on other images such as modis

var img = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA")
               .filterBounds(ee.Geometry.Point(106.2608, 29.5755))
               .first()

print(img)

var img_withCloud = ee.Algorithms.Landsat.simpleCloudScore(img)
print(img_withCloud)

Map.setCenter(106.14, 30.3488,8)
Map.addLayer(img_withCloud,{bands:['B5','B4','B3'],max:0.3})
Map.addLayer(img_withCloud.select('cloud'))

An example of going to the cloud is as follows:

var l8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT_TOA");
var roi = /* color: #d63000 */ee.Geometry.Polygon(
        [[[116.33401967309078, 39.8738616709093],
          [116.46882950954137, 39.87808443916675],
          [116.46882978521751, 39.94772261856061],
          [116.33952185055819, 39.943504136461144]]]);
var selectCol = l8.filterBounds(roi)
                   .filterDate("2017-1-1", "2018-6-1")
                   .map(ee.Algorithms.Landsat.simpleCloudScore)
                   .map(function(img) {
                      img = img.updateMask(img.select("cloud").lt(1));
                      return img;
                   })
                   .sort("system:time_start");
var l8Img = selectCol.mosaic().clip(roi);
Map.addLayer(l8Img, {bands: ["B3", "B2", "B1"], min:0, max:0.3}, "l8");
Map.centerObject(roi, 12);

 

Guess you like

Origin blog.csdn.net/qq_40323256/article/details/110119946