I'm trying to calculate the mean precipitation for a given polygon for a specific period of time. My end goal is to get one polygon with one value that will be the mean precipitation for a given polygon in specific area. The idea is to create on the end table with different years and on each year to be able to say how much rainfall it had between October to march.

the logic of the code, which may be wrong, was to acess the dataset from PERSIAN, to clip it according to my polygon, then to sum all the images values from the months 10-03, and then to calculate mean using ReduceRegion.

It may be wrong logic so if you have any better ideas let me know.

I get error when I try to calculate the mean: "Dictionary (Error) Image.reduceRegion: Provide 'geometry' parameter when aggregating over an unbounded image."

why am I getting this messege?

this is my code:

var dataset = ee.ImageCollection('NOAA/PERSIANN-CDR')
                  .filter(ee.Filter.date('1999-10-01', '2000-03-31'));
var precipitation = dataset.select('precipitation');

var clippedCol=dataset.map(function(im){ 
  return im.clip(geometry);

// //First try to get the mean precipitation for a given area

var summing=clippedCol.sum();

// Reduce the region. The region parameter is the Feature geometry.
var meanDictionary =summing.reduceRegion({
  reducer: ee.Reducer.mean(),
  geometry: summing.geometry(),
  scale: 30,
  maxPixels: 1e9

// Get the number of images.
var count = dataset.size();
print('Count: ',count);

////create list and check some images
// var listOfImages =(clippedCol.toList(clippedCol.size()));
// var firstImage = ee.Image(listOfImages.get(99));

var precipitationVis = {
  min: 0.0,
  max: 200.0,
  palette: ['ff1105','fbff09','28ff25','03fff3','3907ff'],

Map.addLayer(summing, precipitationVis, 'sum');

2 Answers 2


The .sum() operator remove all geometry information, the associated geometry is the all world.

You can .clip() after the .sum(), no reason to do it before. https://code.earthengine.google.com/1de81fd8c3062451b4c15d6b622daa71

Or juste provide you geometry of interest at the reduction stage: https://code.earthengine.google.com/1de81fd8c3062451b4c15d6b622daa71

  • I still got the same error messeges
    – ReutKeller
    Jul 18, 2019 at 16:07

Try to clip as if it was a mask:

function clipCollection(image,geometry){
  var mask = ee.Image.constant(1).clip(geometry).mask();
  return image.updateMask(mask);

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.