google-app-engine - 在 GEE 中将每小时 GPM 数据汇总为每日数据

标签 google-app-engine google-earth-engine

我需要汇总 GPM 集合每天 48 张半小时图像的总和,得到带“precipitationCal”波段的 imageCollection 和每日图像

我试图填充和迭代一个空的 featureCollection,但我得到一个没有图像的空集合

    var dataset = ee.ImageCollection('NASA/GPM_L3/IMERG_V05')
    var startdate = ee.Date.fromYMD(2014,3,1)
    var enddate = ee.Date.fromYMD(2014,4,1)
    var precipitation = dataset.filter(ee.Filter.date(startdate,enddate)).select('precipitationCal')
    print(precipitation)
    
    var difdate = enddate.difference(startdate, 'day')
    
    // Time lapse
    var lapse = ee.List.sequence(0, difdate.subtract(1))
    var startdate = ee.Date('2014-01-01')
    var listdates = lapse.map(function(day){
      return startdate.advance(day, 'day')
    })
    
    var pts = ee.FeatureCollection(ee.List([]))
    var newft = ee.FeatureCollection(listdates.iterate(function(img, ft) {
      // Cast
      ft = ee.FeatureCollection(ft)
      var day = ee.Date(img)
      // Filter the collection in one day
      var day_collection = precipitation.filterDate(day, day.advance(1, 'day'))
      // Get the sum of all 24 images into one Image
      var sum = ee.Image(day_collection.sum())
      // Return the FeatureCollection with the new properties set
      return sum
    }, listdates))

最佳答案

请试一下我的包裹pkg_trend .其中的aggregate_prob函数,就像R language中的aggregate一样工作.

var imgcol_all = ee.ImageCollection('NASA/GPM_L3/IMERG_V06');

function add_date(img){
    var date  = ee.Date(img.get('system:time_start'));
    var date_daily = date.format('YYYY-MM-dd');
    return img.set('date_daily', date_daily);
}

var startdate = ee.Date.fromYMD(2014,3,1);
var enddate   = ee.Date.fromYMD(2014,4,1);
var imgcol = imgcol_all
    .filter(ee.Filter.date(startdate,enddate)).select('precipitationCal')
    .map(add_date);
// imgcol = pkg_trend.imgcol_addSeasonProb(imgcol); 
print(imgcol.limit(3), imgcol.size());

var pkgs = require('users/kongdd/pkgs:pkgs.js');
var imgcol_daily = pkgs.aggregate_prop(imgcol, "date_daily", 'sum');
print(imgcol_daily);

Map.addLayer(imgcol_daily, {}, 'precp daily');

GEE 链接是 https://code.earthengine.google.com/3d8c7e68e0a7a16554ff8081880bfdad

关于google-app-engine - 在 GEE 中将每小时 GPM 数据汇总为每日数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56306009/

相关文章:

javascript - Earth Engine 将特征属性添加到 ImageCollection

python - 在 Google App Engine 上使用 couchdbkit(第 3 方库)

javascript - 将看起来像数字但不是整数的内容转换为整数(Google Earth Engine)

python-3.x - 如何使用 tfrecord 中的 python API 从 Google Earth 引擎下载哨兵图像

javascript - 从 Chrome 扩展程序到 App Engine 的 POST 请求作为 GET 请求收到

javascript - 在 Google Earth Engine 中通过 imageCollection 对每个图像执行 PCA

javascript - 谷歌自定义搜索结果加载完成后,如何加载函数?

python - GQL 与 Google 应用引擎和 Google 云数据存储使用的语言相同吗?

java - Objectifyfilter 的注释