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

var precipitation = dataset.select('precipitation');

var onlyPercipitation = precipitation.filter(ee.Filter.calendarRange(10, 3,'month'));

print(ui.Chart.image.series(onlyPercipitation, geometry, ee.Reducer.mean(),30));

1 Answer 1


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:

  • Reduce each image to the value of interest. This will create a Feature Collection from your Image Collection.
  • Create a chart from the resulted Feature Collection.

Example code:

// Create Feature Collection of mean value
var ft_col = onlyPrecipitation.map(function(img) {
    var date = img.get('system:time_start')
    var mean = img.reduceRegion({
        reducer: ee.Reducer.mean(),
        geometry: geometry,
        maxPixels: 1e13
    return ee.Feature(null, { precipitation: mean, 'system:time_start': date })
// Create and print chart from ft_col
print(ui.Chart.feature.byFeature(ft_col, 'system:time_start', 'precipitation'))

By using img.reduceRegion, you can specify the maximum number of pixels to reduce via maxPixels. Feel free in increase it if 1e13 is not enough.

P.S. I think you mean onlyPrecipitation not onlyPercipitation in your code?

  • How would you do this with ui.Chart.image.doySeriesByYear()?
    – user2031
    May 12, 2023 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.