使用 Google Earth Engine 将每日数据减少为每月数据

N K*_*ler 7 javascript reduce time-series google-earth-engine

我正在使用 Google Earth Engine 查看印度尼西亚不同省份的降水数据( GPMCHIRPS )。GPM 为次日一次(每 30 分钟一次),CHIRPS 为每日一次。我只对获取每月价值感兴趣。与此处此处不同,我对获取多年月度值不感兴趣,而只是对每个月的平均值并制作一个时间序列感兴趣。

在这里,我找到了一种创建包含每个月平均值的值列表的方法。

编辑:感谢尼古拉斯·克林顿的回答,我设法让它发挥作用:

var fc = ee.FeatureCollection('ft:1J2EbxO3zzCLggEYc57Q4mzItFFaaPCAHqe1CBA4u') // Containing multiple polygons
    .filter(ee.Filter.eq('name', 'bangka')); // Here I select my ROI

Map.addLayer(fc, {}, 'area');
Map.centerObject(fc, 7);

var aggregate_array = fc.aggregate_array('name');
print('Name of area: ', aggregate_array, 'Selected data in FeatureCollection:', fc);

var month_mean = ee.List.sequence(0, 16*12).map(function(n) { // .sequence: number of years from starting year to present
  var start = ee.Date('2002-01-01').advance(n, 'month'); // Starting date
  var end = start.advance(1, 'month'); // Step by each iteration

  return ee.ImageCollection("UCSB-CHG/CHIRPS/DAILY")
        .filterDate(start, end)
        .mean()
        .set('system:time_start', start.millis());
});
print(month_mean); 

var collection = ee.ImageCollection(month_mean);

print(collection);

// Plotting

var area_name = fc.aggregate_array('name').getInfo();
var title = 'CHIRPS [mm/hr] for ' + area_name;

var TimeSeries = ui.Chart.image.seriesByRegion({
    imageCollection: collection,
    regions: fc,
    reducer: ee.Reducer.mean(),
    scale: 5000,
    xProperty: 'system:time_start',
    seriesProperty: 'label'
  }).setChartType('ScatterChart')
    .setOptions({
      title: title,
      vAxis: {title: '[mm/hr]'},
      lineWidth: 1,
      pointSize: 1,
    });

print('TimeSeries of selected area:', TimeSeries);
Run Code Online (Sandbox Code Playgroud)

Nic*_*ton 3

尚未测试,但应该是这样的(或设置一些其他date属性):

return ee.ImageCollection("UCSB-CHG/CHIRPS/DAILY")
      .filterDate(start, end)
      .sum()
      .set('system:time_start', start.millis());
Run Code Online (Sandbox Code Playgroud)