以下是使用 Google Earth Engine (GEE) 下载全球干旱指数和蒸发数据集,并将其裁剪到研究区的代码:
//设定感兴趣的区域
var region = ee.Geometry.Rectangle([xmin, ymin, xmax, ymax]);
// 导入MCDI产品(截止于2018年),逐月分辨率
var mcdi = ee.ImageCollection("MODIS/MCDI/MCDI_051")
.filter(ee.Filter.date('2000-01-01', '2018-12-01'))
.select('MCDI')
.map(function(image) {
return image.copyProperties(image,['system:time_start']);
});
// 裁剪全球干旱指数数据,栅格大小为动态匹配(250米和1000米)
mcdi = mcdi.map(function(image){
return image.clip(region)
.reproject({
crs: image.select('MCDI').projection(),
scale: image.select('MCDI').projection().nominalScale()
});
});
//导入MERRA-2蒸散数据(截止于2021年6月),日分辨率
var evap = ee.ImageCollection('NASA/GMAO/\MERRA-2/M2T1NXFLX.5.12.4')
.filter(ee.Filter.date('1980-01-01', '2021-06-01'))
.select('EVPCT')
.map(function(image) {
return image.divide(100).copyProperties(image,['system:time_start']);//转换比例因子
});
// 裁剪蒸发数据,栅格大小为1/2度
evap = evap.map(function(image){
return image.clip(region)
.reproject({
crs: image.select('EVPCT').projection(),
scale: image.select('EVPCT').projection().nominalScale()
});
});
//添加图层到Map
Map.centerObject(region, zoom);
Map.addLayer(mcdi.first());
Map.addLayer(evap.first());
首先需要定义矩形范围来确定感兴趣的地理区域。接下来,使用`ee.ImageCollection()`函数导入全球干旱指数MCDI数据集(截止于2018年)和MERRA-2蒸散数据集,并选择其数据属性。
在这里,也考虑到了两个数据集的匹配问题。对于全球干旱指数数据集,分别将其裁剪至区域范围内,然后调整栅格大小以避免计算过程中的像元尺寸不匹配的问题。
对于蒸发数据集,则要根据当前图片语言质量范畴,下载栅格大小合适并且时空满足的数据。
最后,我们添加所选单张原始图层到,设置缩放级别并让视图中心围绕感兴趣的区域自动调整。