哨兵2的NDVI时间序列数据下载
2021/11/23 6:10:38
本文主要是介绍哨兵2的NDVI时间序列数据下载,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1.导入哨兵2数据集
2.绘制下载区域
3.修改绘制区域与数据集名称
4.运行下面代码
//define ROI var roi = ee.FeatureCollection(ROI) //哨兵2去云处理 function s2_rmcloud(image) { var qa = image.select('QA60'); var cloudBitMask = 1 << 10; var cirrusBitMask = 1 << 11; var mask = qa.bitwiseAnd(cloudBitMask).eq(0) .and(qa.bitwiseAnd(cirrusBitMask).eq(0)); return image.updateMask(mask); } //在原影像中加入一个新的波段,命名为NDVI var s2_ndvi = function(image) { return image.addBands(image.normalizedDifference(["B8", "B4"]).rename("NDVI")); }; //选择某一年的NDVI时间序列数据集 var Year = '2020'; var DateTime = [Year+'-01-01', Year+'-03-31',Year+'-02-01', Year+'-02-28',Year+'-03-01', Year+'-03-31', Year+'-04-01', Year+'-04-30',Year+'-05-01', Year+'-05-31',Year+'-06-01', Year+'-06-30', Year+'-07-01', Year+'-07-31',Year+'-08-01', Year+'-08-31',Year+'-09-01', Year+'-09-30', Year+'-10-01', Year+'-10-31',Year+'-11-01', Year+'-11-30',Year+'-12-01', Year+'-12-31',]; //print(DateTime); //定义批量导出函数 function exportImage(imgCol,region,fileName) { Export.image.toDrive({ image: imgCol, description: "NDVI", fileNamePrefix: "ndvi"+fileName, scale: 10, region:region, crs: "EPSG:4326", maxPixels: 1e13 }); } //过滤筛选哨兵2影像中NDVI,并导出。 for(var i=0;i<DateTime.length;i+=2){ var s2_nocloud = s2_col.map(s2_rmcloud) .filterBounds(roi) .filterDate(DateTime[i], DateTime[i+1]) .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 12)); var ndvi = s2_nocloud.map(s2_ndvi).select("NDVI").reduce(ee.Reducer.mean()); var ndvi_clipped = ndvi.clipToCollection(roi); exportImage(ndvi_clipped,roi,DateTime[i]); } var visParam = {min: 0, max: 1, palette: ['ffffff', '000000']}; Map.centerObject(roi,7); Map.addLayer(roi,{color:'FFFF00'},"roi"); Map.addLayer(ndvi, visParam, "ndvi",false); Map.addLayer(ndvi_clipped, visParam, "ndvi_clipped");
5.当导出run的列表全部显示后,打开浏览器的console命令行运行窗口,复制粘贴杨老师的批量点run代码,再enter,耐心等待即可。
runTasks = function() { const evt = new MouseEvent('click', {bubbles: true, cancelable: true, ctrlKey: true}) $$('.run-button' ,$$('ee-task-pane')[0].shadowRoot).forEach(function(e) { e.dispatchEvent(evt) }) } runTasks()
如图:
导入谷歌网盘。
这篇关于哨兵2的NDVI时间序列数据下载的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23Springboot应用的多环境打包入门
- 2024-11-23Springboot应用的生产发布入门教程
- 2024-11-23Python编程入门指南
- 2024-11-23Java创业入门:从零开始的编程之旅
- 2024-11-23Java创业入门:新手必读的Java编程与创业指南
- 2024-11-23Java对接阿里云智能语音服务入门详解
- 2024-11-23Java对接阿里云智能语音服务入门教程
- 2024-11-23JAVA对接阿里云智能语音服务入门教程
- 2024-11-23Java副业入门:初学者的简单教程
- 2024-11-23JAVA副业入门:初学者的实战指南