使用 Google Earth Engine 将每日数据减少到每月 [英] Reduce daily data to monthly using Google Earth Engine

查看:144
本文介绍了使用 Google Earth Engine 将每日数据减少到每月的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看降水数据(GPMCHIRPS) 使用 Google 地球引擎针对印度尼西亚的不同省份.GPM 为次日(每 30 分钟一次),CHIRPS 为每日一次.我只对获得每月的价值感兴趣.不像这里这里 我对获得多年每月值,但只是每个月的平均值并制作时间序列.

I am looking at precipitation data (both GPM and CHIRPS) for different provinces in Indonesia using Google Earth Engine. GPM is sub-daily (every 30 minutes) and CHIRPS is daily. I am only interested in getting the monthly values. Unlike here and here I am not interested in getting the multi-annual monthly values, but simply the average of each month and make a time series.

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

Here I found a way to create a list of values containing the mean of each month.

感谢 Nicholas Clinton 的 answer 我设法让它工作:

Thanks to Nicholas Clinton's answer I managed to get it to work:

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);

推荐答案

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

Have not tested, but should be something like this (or set some other date property):

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

这篇关于使用 Google Earth Engine 将每日数据减少到每月的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆