简介

在本篇博客中,我们将使用Google Earth Engine (GEE) 进行植被状况指数(Vegetation Condition Index, VCI)的计算和干旱监测。通过MODIS NDVI数据,我们可以评估2001年至2024年间的植被状况和干旱等级。

背景知识

MODIS NDVI数据集

MODIS/061/MOD13A2数据集提供了MODIS的归一化植被指数(NDVI)数据,这些数据可以用来评估植被覆盖和健康状况。

植被状况指数(VCI)

VCI是一种基于NDVI的指标,用于评估植被状况和监测干旱。VCI的计算公式为:
[ VCI = \left(\frac{(NDVI - NDVI_{min})}{(NDVI_{max} - NDVI_{min})}\right) \times 100 ]

完整代码

// 定义研究点坐标
var cor = [52.91994991092, 33.56756085477778];
var point = ee.Geometry.Point(cor);

// 加载FAO GAUL数据集并筛选研究区域
var feature = ee.FeatureCollection("FAO/GAUL/2015/level0");
var roi = feature.filterBounds(point);
Map.centerObject(roi);
Map.addLayer(roi);

// 定义时间范围
var time_start = '2001', time_end = '2003';

// 加载MODIS NDVI数据集
var ndvi = ee.ImageCollection("MODIS/061/MOD13A2")
  .select(['NDVI'])
  .filterDate(time_start, time_end);

// 计算VCI
var ndvi_min = ndvi.min().multiply(0.0001);
var ndvi_max = ndvi.max().multiply(0.0001);

var vci = ndvi.map(function (img) {
  var band = img.multiply(0.0001);
  var index = band.expression('((ndvi - min)/(max - min))*100.0', {
    'ndvi': band,
    'min': ndvi_min,
    'max': ndvi_max
  }).rename('vci');
  return index.copyProperties(img, ['system:time_start', 'system:time_end']);
});

// 计算VCI中值
var vci_median = vci.median();
Map.addLayer(vci_median.clip(roi), [], 'vci_median', false);

// 打印VCI直方图
print(
  ui.Chart.image.histogram(vci_median, roi, 1000)
);

// VCI分类
var cons = ee.Image.constant(0);

var extreme = cons.where(vci_median.gte(0).and(vci_median.lt(10)), 1);
var severe = extreme.where(vci_median.gte(10).and(vci_median.lt(20)), 2);
var moderate = severe.where(vci_median.gte(20).and(vci_median.lt(30)), 3);
var light = moderate.where(vci_median.gte(30).gte(vci_median.lt(40)), 4);
var no1 = light.where(vci_median.gte(40).and(vci_median.lt(60)), 5);
var no2 = no1.where(vci_median.gte(60).and(vci_median.lt(80)), 6);
var no3 = no2.where(vci_median.gte(80), 7);

Map.addLayer(moderate.clip(roi), {min: 1, max: 7}, 'drought_map', false);

// VCI时间序列分类
var time_start = '2001', time_end = '2024';
var ndvi2 = ee.ImageCollection("MODIS/061/MOD13A2")
  .select(['NDVI'])
  .filterDate(time_start, time_end);

var ndvi_min2 = ndvi2.min().multiply(0.0001);
var ndvi_max2 = ndvi2.max().multiply(0.0001);

var vci2 = ndvi2.map(function (img) {
  var band = img.multiply(0.0001);
  var index = band.expression('((ndvi - min)/(max - min))*100.0', {
    'ndvi': band,
    'min': ndvi_min2,
    'max': ndvi_max2
  }).rename('vci');
  return index.copyProperties(img, ['system:time_start', 'system:time_end']);
});

// 修正:vci_class 应使用 vci2 而不是 vci_median
var vci_class = vci2.map(function (img) {
  var vci_value = img.select('vci');
  return img.expression(
    'extreme + severe + moderate + light + no1 + no2 + no3',
    {
      'extreme': vci_value.gte(0).and(vci_value.lt(10)).multiply(1),
      'severe': vci_value.gte(10).and(vci_value.lt(20)).multiply(2),
      'moderate': vci_value.gte(20).and(vci_value.lt(30)).multiply(3),
      'light': vci_value.gte(30).and(vci_value.lt(40)).multiply(4),
      'no1': vci_value.gte(40).and(vci_value.lt(60)).multiply(5),
      'no2': vci_value.gte(60).and(vci_value.lt(80)).multiply(6),
      'no3': vci_value.gte(80).multiply(7)
    }
  ).rename('class');
});

var vci_map = vci_class.mode();

Map.addLayer(vci_map.clip(roi), {
  palette: ['black', 'brown', 'red', 'orange', 'yellow', 'lightgreen', 'darkgreen'],
  min: 1,
  max: 7
}, 'vci_mode', false);

// 导出VCI分类图
Export.image.toDrive({
  image: vci_map.clip(roi),
  description: 'vci_map',
  region: roi,
  maxPixels: 1e13,
  crs: 'EPSG:4326',
  folder: 'drought',
  scale: 1000
});

// 计算干旱面积
var drought_area = (ee.Image.pixelArea().divide(1e6)).addBands(vci_map);

print(
  ui.Chart.image.byClass(drought_area, 'constant',
    roi, ee.Reducer.sum(), 1000, ['nan', 'extreme drought', 'severe drought', 'moderate drought', 'light drought', 'no drought1', 'nodrought2', 'no drought3'])
);
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.

代码详解

1. 定义研究点

创建一个点对象point,用于确定研究区域。

2. 加载FAO GAUL数据集

加载并筛选与研究点相交的区域roi

3. 加载MODIS NDVI数据集

加载指定时间范围内的MODIS NDVI数据。

4. 计算VCI

基于NDVI的最小值和最大值计算VCI。

5. VCI分类

根据VCI值将图像分类为不同的干旱等级。

6. 绘制VCI中值图层

将VCI中值图层添加到地图上。

7. 打印VCI直方图

打印VCI中值的直方图,以了解VCI值的分布。

8. VCI时间序列分类

对整个时间序列的VCI进行分类,并计算每个干旱等级的频率。

9. 导出VCI分类图

将VCI分类图导出到Google Drive。

10. 计算干旱面积

计算每个干旱等级的面积。

结论

本教程展示了如何使用GEE对MODIS数据进行VCI计算和干旱监测。通过VCI,我们可以评估植被状况并识别干旱区域。

进一步探索

GEE提供了多种工具和方法来进行植被和干旱分析。在后续的教程中,我们将继续探索GEE在不同领域的应用。