TransWikia.com

Aggregate daily to monthly values for each pixel in google earth engine

Geographic Information Systems Asked by 89_Simple on May 31, 2021

I have an ImageCollection which is daily resolution for multiple years. For each year and month, I want to sum the pr band in the ee.ImageCollection such that I have a monthly value instead of daily.

// Define the polygon
var polygon = ee.Geometry.Polygon([114, 0.37, 114, 2.04, 112, 2.04, 112, 0.37]);

// Define the dataset
var NASA = ee.ImageCollection('NASA/NEX-GDDP');

// a function that takes a year and month and filters the `ImageCollection`
var filterYrMo = function(analysis, gcm, variable, y, m, imageCol) {

var imageColYr = imageCol
                .select(variable)
                .filter(ee.Filter.bounds(polygon))
                .filterMetadata('scenario', 'equals', analysis)
                .filterMetadata('model', 'equals', gcm)
                .filter(ee.Filter.calendarRange(y, y,'year'))
                .filter(ee.Filter.calendarRange(m, m,'month'));

 return imageColYr  
};

// Using the function to select January, 2000
var test = filterYrMo('historical', 'CanESM2', 'tasmax', 2000, 1, NASA);
print(test)

test has 31 images or features (31 days of January) for year 2000 for the polygon. Each image is a day and I want to sum pr variables across the 31 days for each pixels to generate the monthly value for each pixel.

Is there a function that can do this in earth engine?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP