I am analyzing impact of wildfire on precipitation patterns and I'd like to see the monthly mean precipitation over a region (point) to see if it is decreasing or increasing. I am still dealing why I get "Error generating chart: User memory limit exceeded" since my codes seems to be clear. If anyone can help me I will be very grateful.
Thanks in advance!!
Here I share my codes:
// portugal shapefile
var port_shp = ee.FeatureCollection("projects/ee-geoyons/assets/portugal");
// burned area
var burnt_area_p = ee.FeatureCollection("projects/ee-geoyons/assets/burnt_area_s_p")
.select('area_ha')
var clipImg = function(image){
return image.clip(port_shp);
}
// **************** 01. Monthly Precipitation *********************
var collPP = ee.ImageCollection("NASA/GPM_L3/IMERG_V06")
.map(clipImg);
var pp = collPP.select('precipitationCal');
var months = ee.List.sequence(1, 12);
var years = ee.List.sequence(2014, 2023);
var monthPP_sum = ee.ImageCollection.fromImages(
years.map(function(y) {
return months.map(function (m) {
return pp.filter(ee.Filter.calendarRange(y, y, 'year'))
.filter(ee.Filter.calendarRange(m, m, 'month'))
.sum()
.set('system:time_start', ee.Date.fromYMD(y, m, 1));
});
}).flatten());
//print(monthPP_sum)
var chart = ui.Chart.image.series(monthPP_sum.select('precipitationCal'), point, ee.Reducer.mean(), 1000);
//print(chart);
// ******************** 02. Annual Precipitation **********************
var collPP = ee.ImageCollection("NASA/GPM_L3/IMERG_V06")
.map(clipImg);
var pp = collPP.select('precipitationCal');
var months = ee.List.sequence(1, 12);
var years = ee.List.sequence(2002, 2023);
var yearPP_sum = ee.ImageCollection.fromImages(
years.map(function(y) {
return pp.filter(ee.Filter.calendarRange(y, y, 'year'))
.sum().set('system:time_start', ee.Date.fromYMD(y, 1, 1))
}).flatten());
var chart_pp_annual = ui.Chart.image.series(yearPP_sum.select('precipitationCal'), point, ee.Reducer.mean(), 1000);
print(chart_pp_annual);
// **************** 03. Monthly mean Precipitation *********************
var years = ee.List.sequence(2014, 2023);
var monthPP_mean = ee.ImageCollection.fromImages(
years.map(function(y) {
return monthPP_sum.filter(ee.Filter.calendarRange(y, y, 'year'))
.mean().set('system:time_start', ee.Date.fromYMD(y, 1, 1))
}).flatten());
var chart_pp_month_mean = ui.Chart.image.series(monthPP_mean.select('precipitationCal'), point, ee.Reducer.mean(), 1000);
print(chart_pp_month_mean);
Here is the link to GEE: https://code.earthengine.google.com/a0be0393623f5809fcb272ba87513e1d
I am expecting to see the chart of monthly mean precipitation.