GEE开发之Modis_EVI数据分析获取大总结
前言:主要总结一下在GEE上获取Modis_EVI数据的各种形式,主要包括MYD13Q1、MOD13Q1、MOD13A1、MOD13A2以及日数据、月数据、年数据的获取和下载。
0. 之前的链接
可以参考:
《GEE开发之Modis_NDVI数据分析获取大总结》
1. MYD13Q1(250米/16天)
//以鹿邑为例子
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,6);
//选取影像集以及波段 EVi
var evi = ee.ImageCollection("MODIS/006/MYD13Q1").filterDate('2020-01-01', '2020-12-31').filterBounds(geometry).select("EVI");
//换算单位
var multiply = function(image){
var img = image.multiply(0.0001);
return img.set('system:time_start',image.get('system:time_start'));
};
evi = evi.map(multiply);
print(evi);
//设置调色板并展示影像
var colorizedVis = {min: 0.0, max: 1.0, palette: ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301']};
Map.addLayer(evi.median().clip(geometry), colorizedVis, 'evi');//2020年evi的均值
2. MOD13Q1(250米/16天)
//以鹿邑为例子
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,6);
//选取影像集以及波段 EVi
var evi = ee.ImageCollection("MODIS/006/MOD13Q1").filterDate('2020-01-01', '2020-12-31').filterBounds(geometry).select("EVI");
//换算单位
var multiply = function(image){
var img = image.multiply(0.0001);
return img.set('system:time_start',image.get('system:time_start'));
};
evi = evi.map(multiply);
print(evi);
//设置调色板并展示影像
var colorizedVis = {min: 0.0, max: 1.0, palette: ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301']};
Map.addLayer(evi.median().clip(geometry), colorizedVis, 'evi');//2020年evi的均值
3. MOD13A1(500米/16天)
//以鹿邑为例子
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,6);
//选取影像集以及波段 EVi
var evi = ee.ImageCollection("MODIS/006/MOD13A1").filterDate('2020-01-01', '2020-12-31').filterBounds(geometry).select("EVI");
//换算单位
var multiply = function(image){
var img = image.multiply(0.0001);
return img.set('system:time_start',image.get('system:time_start'));
};
evi = evi.map(multiply);
print(evi);
//设置调色板并展示影像
var colorizedVis = {min: 0.0, max: 1.0, palette: ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301']};
Map.addLayer(evi.median().clip(geometry), colorizedVis, 'evi');//2020年evi的均值
4. MOD13A2(1000米/16天)
//以鹿邑为例子
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,6);
//选取影像集以及波段 EVi
var evi = ee.ImageCollection("MODIS/006/MOD13A2").filterDate('2020-01-01', '2020-12-31').filterBounds(geometry).select("EVI");
//换算单位
var multiply = function(image){
var img = image.multiply(0.0001);
return img.set('system:time_start',image.get('system:time_start'));
};
evi = evi.map(multiply);
print(evi);
//设置调色板并展示影像
var colorizedVis = {min: 0.0, max: 1.0, palette: ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301']};
Map.addLayer(evi.median().clip(geometry), colorizedVis, 'evi');//2020年evi的均值
5. 日数据下载(以MYD13Q1为例子)
//以鹿邑为例子
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,6);
//选取影像集以及波段 EVI
var evi = ee.ImageCollection("MODIS/006/MYD13Q1").filterDate('2020-01-01', '2020-12-31').select("EVI");
//换算单位
var multiply = function(image){
var img = image.multiply(0.0001);
return img.set('system:time_start',image.get('system:time_start'));
};
evi = evi.map(multiply);
//设置调色板并展示影像
var colorizedVis = {min: 0.0, max: 1.0, palette: ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301']};
print(evi);
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.clip(geometry);
Map.addLayer(image, colorizedVis, indexs[i]);//查看具体的遥感影像
//tif数据下载
Export.image.toDrive({
image: image,
description: 'modis_evi_'+indexs[i],
fileNamePrefix: 'modis_evi_'+indexs[i],
folder: 'Modis',
region: geometry,
scale: 250,
crs: "EPSG:4326",
maxPixels: 1e13
});
}
});
}
exportImageCollection(evi);
6. 月数据下载(以MYD13Q1为例子)
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,6);
var EVI =ee.ImageCollection("MODIS/006/MYD13Q1");
for(var i=2018;i<=2020;i++){
for(var j=1;j<=12;j++){
var data_collection = null;
switch(j){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
data_collection = EVI.filterDate(i+'-'+j+'-01',i+'-'+j+'-31').select('EVI');
break;
case 4:
case 6:
case 9:
case 11:
data_collection = EVI.filterDate(i+'-'+j+'-01',i+'-'+j+'-30').select('EVI');
break;
case 2:
data_collection = EVI.filterDate(i+'-'+j+'-01',i+'-'+j+'-28').select('EVI');
break;
}
// print(data_collection)
var YR_collection = data_collection.mean().multiply(0.0001).clip(geometry);
// print(YR_collection)
Export.image.toDrive({
image: YR_collection,
description: i+'-'+j,
fileNamePrefix: i+'-'+j,
scale: 250,
region: geometry,
maxPixels: 1e13,
folder: 'Modis'
})
}
}
7. 年数据下载(以MYD13Q1为例子)
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,6);
var EVI =ee.ImageCollection("MODIS/006/MYD13Q1");
for(var i=2018;i<=2020;i++){
var data_collection = EVI.filterDate(i+'-01-01',i+'-12-31').select('EVI');
print(data_collection)
var YR_collection = data_collection.mean().multiply(0.0001).clip(geometry);
Export.image.toDrive({
image: YR_collection,
description: i,
fileNamePrefix: i,
scale: 250,
region: geometry,
maxPixels: 1e13,
folder: 'Modis'
});
}