要从 WorldClim 数据集中提取 Mean Annual Temperature (MAT) 和 Mean Annual Precipitation (MAP) 数据,可使用 Google Earth Engine 中的以下代码:
// Load the WorldClim dataset.
var worldClim = ee.ImageCollection('WORLDCLIM/V1/BIO');
// Select the MAT and MAP bands.
var mat = worldClim.select('bio01'); // MAT
var map = worldClim.select('bio12'); // MAP
// Define a region of interest (ROI) to extract the data.
var roi = ee.Geometry.Point(-122.084, 37.42);
// Extract the data for the ROI.
var matValue = mat.reduceRegion({
reducer: ee.Reducer.first(),
geometry: roi,
scale: 1000
});
var mapValue = map.reduceRegion({
reducer: ee.Reducer.first(),
geometry: roi,
scale: 1000
});
// Print the extracted data.
print('MAT:', matValue);
print('MAP:', mapValue);
这段代码中,我们首先加载了 WorldClim 数据集。然后,我们选择了 bio01 和 bio12 两个数据层分别代表 MAT 和 MAP。接下来,我们定义了一个感兴趣区域 (ROI),在这里我们选择了一个经纬度坐标 (-122.084, 37.42)。然后,我们使用 reduceRegion() 方法从数据集中提取了 ROI 内的MAT 和 MAP 数据。最后,我们将提取的数据打印出来。
PS: 这只是一个简单的示例,您需要根据自己的需要调整代码,玩的开心!