FORMA 是一种基于 MODIS 的森林砍伐预警系统,可每半个月提供一次热带雨林森林砍伐预警,预警范围为 500 x 500 米。Earth Engine 中的 FORMA 500 数据集是一张包含自 2006 年 1 月起每月更新的提醒的图片。每个提醒都具有一个关联的时间,该时间以 epoch 秒为单位,位于名为 alert_date
的单个频段中。按日期过滤 FORMA 数据并计算感兴趣区域内的提醒是您可以使用 FORMA 数据集完成的两项最重要的任务。
按日期过滤 FORMA
如需仅显示 2012 年发生的提醒,请查找时间介于 2012 年第一天和 2013 年第一天之间的像素(以自 1970 年 1 月 1 日午夜以来的秒数表示):
代码编辑器 (JavaScript)
// Convert dates from milliseconds to seconds. var start = ee.Date('2012-01-01').millis().divide(1000); var end = ee.Date('2013-01-01').millis().divide(1000); // Load the FORMA 500 dataset. var forma = ee.Image('FORMA/FORMA_500m'); // Create a binary layer from the dates of interest. var forma2012 = forma.gte(start).and(forma.lte(end)); Map.setCenter(15.87, -0.391, 7); Map.addLayer( forma2012.mask(forma2012), {palette: ['FF0000']}, 'FORMA alerts in 2012' );
在此示例中,forma2012
是一个二元图像,仅包含时间发生在 2012 年的像素(即所有其他像素都被遮盖)。
统计感兴趣区域内的 FORMA 提醒
与上一部分中处理 Hansen 等人的数据一样,我们可以先统计感兴趣区域内的 FORMA 提醒(像素)数量。例如,如需统计 2012 年刚果共和国保护区内的警报数量,请在上述示例的基础上进行如下修改:
代码编辑器 (JavaScript)
// Load country features from Large Scale International Boundary (LSIB) dataset. var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017'); // Subset the Congo Republic feature from countries. var congo = ee.Feature( countries .filter(ee.Filter.eq('country_na', 'Rep of the Congo')) .first() ); // Subset protected areas to the bounds of the congo feature // and other criteria. Clip to the intersection with congo. var protectedAreas = ee.FeatureCollection('WCMC/WDPA/current/polygons') .filter(ee.Filter.and( ee.Filter.bounds(congo.geometry()), ee.Filter.neq('IUCN_CAT', 'VI'), ee.Filter.neq('STATUS', 'proposed'), ee.Filter.lt('STATUS_YR', 2010) )) .map(function(feat){ return congo.intersection(feat); }); // Display protected areas on the map. Map.addLayer( protectedAreas, {color: '000000'}, 'Congo Republic protected areas' ); // Calculate the number of FORMA pixels in protected // areas of the Congo Republic, 2012. var stats = forma2012.reduceRegion({ reducer: ee.Reducer.sum(), geometry: protectedAreas.geometry(), scale: 500 }); print('Number of FORMA pixels, 2012: ', stats.get('constant'));
统计多个感兴趣区域中的 FORMA 提醒
到目前为止,我们一直是在单个区域中一次性计算统计信息。如需同时计算多个地区的统计信息,您可以使用 reduceRegions()
。我们再次基于上一个示例进行构建:
代码编辑器 (JavaScript)
var regionsStats = forma2012.reduceRegions({ collection: protectedAreas, reducer: ee.Reducer.sum(), scale: forma2012.projection().nominalScale() }); print(regionsStats);
检查输出到控制台的对象,并观察到 reduceRegions()
的输出是另一个 FeatureCollection
。请注意,刚果共和国保护区集合中的每个区域现在都有一个额外的属性 sum
,该属性以精简器的名称命名。此属性的值是 reducer 的输出,即保护区内 2012 年的警报数量。
比较 FORMA 和 Hansen 等人的数据集
如需比较 FORMA 和 Hansen 等人的数据集,您可以使用逻辑运算符。 (详细了解逻辑运算)。具体来说,我们希望制作一张图片,其中被 FORMA 和 Hansen 等人的数据标记为森林砍伐的像素值为 1,其余像素值为 0。此代码会生成 2012 年的此类图片,并将其与其他预测的森林砍伐层一起显示:
代码编辑器 (JavaScript)
// Convert dates from milliseconds to seconds. var start = ee.Date('2012-01-01').millis().divide(1000); var end = ee.Date('2013-01-01').millis().divide(1000); var region = ee.Geometry.Rectangle([-59.81163, -9.43348, -59.27561, -9.22818]); // Load the FORMA 500 dataset. var forma = ee.Image('FORMA/FORMA_500m'); // Create a binary layer from the dates of interest. var forma2012 = forma.gte(start).and(forma.lte(end)); // Load Hansen et al. data and get change in 2012. var gfc = ee.Image('UMD/hansen/global_forest_change_2015'); var gfc12 = gfc.select(['lossyear']).eq(12); // Create an image which is one where the datasets // both show deforestation and zero elsewhere. var gfc_forma = gfc12.eq(1).and(forma2012.eq(1)); // Display data on the map. Map.setCenter(-59.58813, -9.36439, 11); Map.addLayer(forma.updateMask(forma), {palette: '00FF00'}, 'Forma (green)'); Map.addLayer(gfc12.updateMask(gfc12), {palette: 'FF0000'}, 'Hansen (red)'); Map.addLayer( gfc_forma.updateMask(gfc_forma), {palette: 'FFFF00'}, 'Hansen & FORMA (yellow)' );
Earth Engine 中森林变化数据集的概览到此结束。我们期待看到您能用它们做出什么!