I'm trying to create a time series chart that will tell me that mean precipitation for a given imageCollection, but my polygon is too big and I get the next error message:
"Error generating chart: Collection.first: Error in map(ID=19991001):
Image.reduceRegion: Too many pixels in the region. Found 67144509, but
only 10000000 allowed."
How can I change the number of pixels and allow it to calculate the mean precipitation value for a given polygon? Whenever I run my code with the big polygon I get the error messege.
This is my code:
var geometry=table;
var dataset = ee.ImageCollection('NOAA/PERSIANN-CDR')
.filter(ee.Filter.date('1999-10-01', '2018-03-31'))
.filterBounds(geometry);
var precipitation = dataset.select('precipitation');
var onlyPercipitation = precipitation.filter(ee.Filter.calendarRange(10, 3,'month'));
print(onlyPercipitation);
print(ui.Chart.image.series(onlyPercipitation, geometry, ee.Reducer.mean(),30));
Best Answer
I got the same problem in one of my project, and came up with a workaround. The idea is to split the chart creation into 2 steps:
Example code:
By using
img.reduceRegion
, you can specify the maximum number of pixels to reduce viamaxPixels
. Feel free in increase it if1e13
is not enough.P.S. I think you mean
onlyPrecipitation
notonlyPercipitation
in your code?