ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Google Earth Engine(GEE)学习笔记1.影像加载去云筛选导出

2021-09-21 18:00:46  阅读:1290  来源: 互联网

标签:Engine startdate Google enddate ee image GEE var 影像


加载影像

//加载Landsat8
var l8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR")
//加载sentinel
var imageCollection = ee.ImageCollection("COPERNICUS/S1_GRD"),
var imageCollection2 = ee.ImageCollection("COPERNICUS/S2"),
var imageCollection3 = ee.ImageCollection("COPERNICUS/S2_SR");

影像去云函数

//Landsat8去云
function rmL8Cloud(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); 
} 
//Sentinel去云
var cloudfunction_ST2 = function(image){
  //use add the cloud likelihood band to the image
  var quality = image.select("QA60").unmask();
  //get pixels above the threshold
  var cloud01 = quality.gt(0);
  //create a mask from high likelihood pixels
  var cloudmask = image.mask().and(cloud01.not());
  //mask those pixels from the image
  return image.updateMask(cloudmask);
};

影像筛选显示

//定义时间节点
var startdate = ee.Date.fromYMD(2020,9,1);
var enddate = ee.Date.fromYMD(2020,10,30);
//landsat8
//影像筛选
var l8Imgs  = l8 .filterBounds(roi)
            .filterDate(startdate, enddate)
            .filterMetadata('CLOUD_COVER','less_than',5);
Map.setCenter( 107.753, 34.238, 4);                                                        
Map.addLayer( L8, {bands:'B4,B3,B2', min:0, max:0.2}, 'Original Images' );
//sentinel
//s1为从GEE 数据集导入的Sentinel 1数据
var Sentinel1_VV =  s1.filterBounds(roi)
                    .filterDate(startdate, enddate)
                    .filter(ee.Filter.eq('instrumentMode', 'IW'))
                    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
                    .select('VV')
                     .median();
​
var Sentinel1_VH =  s1.filterBounds(roi)
                    .filterDate(startdate, enddate)
                    .filter(ee.Filter.eq('instrumentMode', 'IW'))
                    .filter(ee.Filter.listContains('transmitterReceiverPolarisation',                       'VH'))
                   
                    .select('VH')
                    .median();
//s2为从GEE 数据集导入的Sentinel 2数据
var Sentinel2 = s2.filterBounds(roi)
                .filterDate(startdate, enddate)
                .map(cloudfunction_ST2)
                 .median();

影像导出

//影像数据集下载
//影像集合导出方法 
 function exportImageCollection(imgCol) { 
   var indexList = imgCol.reduceColumns(ee.Reducer.toList(), ["system:index"]) 
                         .get("list"); 
  indexList.evaluate(function(indexs) { 
     for (var i=0; i<indexs.length; i++) { 
       var image = imgCol.filter(ee.Filter.eq("system:index", indexs[i])).first(); 
       image = image.toInt16(); 
       Export.image.toDrive({ 
         image: image.clip(table), 
         description: indexs[i], 
         fileNamePrefix: indexs[i], 
         region: table, 
         scale: 30, 
         crs: "EPSG:4326", 
         maxPixels: 1e13 
       }); 
     } 
   }); 
 } 
 exportImageCollection(l8Imgs); 

标签:Engine,startdate,Google,enddate,ee,image,GEE,var,影像
来源: https://blog.csdn.net/ZZSOGA/article/details/120403728

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有