Google Earth Engine中的LandSat卫星数据

ee.ImageCollection.qualityMosaic()

  • mosaic获取的是最后一个有值的像素,然后生成一张影像;
  • qualityMosaic提取的是像素点的最大值,类似对集合使用max函数。在处理NDVI时可以有去云的效果;

Google Earth Engine中的LandSat卫星数据_第1张图片

Google Earth Engine中的LandSat卫星数据_第2张图片      Google Earth Engine中的LandSat卫星数据_第3张图片

var l8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA");

var l8_select=l8.filterBounds(ee.Geometry.Point(106.5,29.6))
                .filterDate("2018-01-01","2018-12-31")
                .select("B[3,4,5]")
                
function add_NDVI(image){
  var NDVI=image.normalizedDifference(["B5","B4"]).rename("NDVI")
  return image.addBands(NDVI)
}

var l8_ndvi=l8_select.map(add_NDVI)
var ndvi_quality=l8_ndvi.qualityMosaic("NDVI")

Map.setCenter(106.7,29.7,7)

Map.addLayer(l8_ndvi,{"bands":["B5","B4","B3"],"max":0.5},"l8_ndvi")
Map.addLayer(ndvi_quality,{"bands":["B5","B4","B3"],"max":0.5},"ndvi_quality")

print(l8_ndvi,ndvi_quality)

qualityMosaic()处理NDVI去云

Google Earth Engine中的LandSat卫星数据_第4张图片

var l8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA");

var l8_select=l8.filterBounds(ee.Geometry.Point(106.5,29.6))
                .filterDate("2018-01-01","2018-12-31")
                .select("B[3,4,5]")
                
function add_NDVI(image){
  var NDVI=image.normalizedDifference(["B5","B4"]).rename("NDVI")
  return image.addBands(NDVI)
}

var l8_ndvi=l8_select.map(add_NDVI)

var ndvi_quality=l8_ndvi.qualityMosaic("NDVI").select("NDVI")
                

Map.setCenter(106.7,29.7,9)

Map.addLayer(ndvi_quality,{"min":-1,"max":1,"palette":'FFFFFF, CE7E45, DF923D, F1B555, FCD163, 99B718, 74A901, 66A000, 529400,3E8601, 207401, 056201, 004C00, 023B01, 012E01, 011D01, 011301'},"ndvi_quality")

simpleCloudScore()

有待研究

simpleComposite()

取影像集中云层含量最小的栅格值作为选定值,再将所有选定值拼接成image

返回一个去了云的Image

注意:需要landsat中的row数据

Google Earth Engine中的LandSat卫星数据_第5张图片

Google Earth Engine中的LandSat卫星数据_第6张图片Google Earth Engine中的LandSat卫星数据_第7张图片

var sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan"),
    l8 = ee.ImageCollection("LANDSAT/LC08/C01/T1");


var l8_select=l8.filterBounds(sichuan)
                .filterDate("2018-01-01","2018-12-31")
              
var img_simpleComposite=ee.Algorithms.Landsat.simpleComposite({collection:l8_select,asFloat:true}).clip(sichuan)
print("img_simpleComposite",img_simpleComposite)
Map.centerObject(sichuan,6)
 
Map.addLayer(img_simpleComposite,{bands:["B5","B4","B3"],max:0.3},"B543")
Map.addLayer(img_simpleComposite,{bands:["B4","B3","B2"],max:0.3},"B432")

自定义函数去云

 给影像集中的每个image都去云,并且返回一个去了云的影像集

Google Earth Engine中的LandSat卫星数据_第8张图片

var l8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR"),
    sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");

var imgs = l8.filterBounds(sichuan) 
              .filterDate("2018-1-1", "2019-1-1") 
              .map(rmCloud) 
              .map(scaleImage) 
           
var l8Image = imgs.median().clip(sichuan)
print("l8Image",l8Image)

Map.centerObject(sichuan, 7); 
Map.addLayer(l8Image, {min: 0,max: 0.3,bands: ["B4", "B3", "B2"]}, "l8Image"); 


//Landsat8 SR数据去云 
function rmCloud(image) { 
  var cloudShadowBitMask = (1 << 3); 
  var cloudsBitMask = (1 << 5); 
  var qa = image.select("pixel_qa"); 
  var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0) 
                 .and(qa.bitwiseAnd(cloudsBitMask).eq(0)); 
  return image.updateMask(mask); 
} 

function scaleImage(image) { 
  var time_start = image.get("system:time_start"); 
  return image.multiply(0.0001).set("system:time_start", time_start); 
} 

又或者

Google Earth Engine中的LandSat卫星数据_第9张图片

Google Earth Engine中的LandSat卫星数据_第10张图片

var sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");

var maskL8 = function(image) {
  var qa = image.select('BQA');
  var mask = qa.bitwiseAnd(1 << 4).eq(0);
  return image.updateMask(mask);
}

var composite = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
    .filterDate('2018-01-01', '2019-1-1')
    .map(maskL8)
    .median();

Map.addLayer(composite.clip(sichuan), {bands: ['B4', 'B3', 'B2'], max: 0.3});
Map.centerObject(sichuan,6)

 

你可能感兴趣的:(Google,Earth,Engine)