统计研究区内Landsat影像数量

统计研究区内Landsat影像数量

2021-08-28 17:11:39 星期六
导出结果为数量csv文件

var ROI = ee.FeatureCollection("users/xxx/xxx");
function cloudmask(image) {
  // Remove edge pixels that don't occur in all bands
  var mask1 = image.mask().select('B.*').reduce(ee.Reducer.min());
  return image.updateMask(mask1);
}
function setImageInfo(image){
  var date = image.get("SENSING_TIME");//获取影像时间
  var year=ee.Date(date).get("year");
  image=image.set("year",year);//设置属性 年
  var month=ee.Date(date).get("month");
  image=image.set("month",month);//设置属性 月
  var day=ee.Date(date).get("day");
  image=image.set("day",day);//设置属性 日
  return image;
}
///////////////////////////////////////////////////////
//------------------Landsat5--------------------------//
var colTM2 = ee.ImageCollection("LANDSAT/LT05/C01/T1_SR")
                .filterDate('1989-01-01', '2012-05-31')
                .filterBounds(ROI)
                .map(cloudmask)
                .map(setImageInfo);
print(colTM2)
//export imageCollection information
Export.table.toDrive({
  collection:colTM2,
  description:"L5_Stat",
  fileNamePrefix:"L5_Stat",
  fileFormat:"CSV",
  selectors:["year","month","day","WRS_PATH","WRS_ROW"]});
////////////////////////////////////////////////////////
//------------------Landsat7--------------------------//
var colETM = ee.ImageCollection("LANDSAT/LE07/C01/T1_SR")
                .filterDate('1999-01-01', '2003-05-31')
                .filterBounds(ROI)
                .map(cloudmask)
                .map(setImageInfo);
//export imageCollection information
Export.table.toDrive({
  collection:colETM,
  description:"L7_Stat",
  fileNamePrefix:"L7_Stat",
  fileFormat:"CSV",
  selectors:["year","month","day","WRS_PATH","WRS_ROW"]});
///////////////////////////////////////////////////////
//------------------Landsat8--------------------------//
var colOLI = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR")
                .filterDate('2013-01-01', '2019-12-31')
                .filterBounds(ROI)
                .map(cloudmask)
                .map(setImageInfo);
//export imageCollection information
Export.table.toDrive({
  collection:colOLI,
  description:"L8_Stat",
  fileNamePrefix:"L8_Stat",
  fileFormat:"CSV",
  selectors:["year","month","day","WRS_PATH","WRS_ROW"]});
上一篇:8.14


下一篇:大数据学习(天书计划)day01