0

I am trying to understand the scale parameter in earth engine better. My goal is to calculate monthly sums of precipitation across a geometry. Here is the python pseudo code:

area = ee.Geometry.Polygon(
        [[[-120.29277343749999, 37.319672371647655],
          [-118.51298828124999, 35.13985393638227],
          [-117.10673828124999, 35.552070101618895],
          [-118.46904296874999, 37.73787899128162]]])

col = ee.ImageCollection('OREGONSTATE/PRISM/AN81m')
t = col.filter(ee.Filter.calendarRange(2014,2014,'year'))
    .filter(ee.Filter.calendarRange(4,4,'month'))
    .filterBounds(area).select("ppt")

result = t.getRegion(area, scale).getInfo()

However this gives very different sums depending on the scale parameter value that is supplied. Here is a plot for the image sum as a function of scale parameter:

p vs scale

Is the best practice to reduce as sum before calling getRegion and getInfo? I have read the documentation on scale in earth engine, and the native resolution suggested by the dataset is 2.5 arc minutes or approximately 4.5 km. I am curious what the best practices are for supplying a scale parameter, especially when working with multiple data sources over the same area.

1

Without seeing working code it's hard to say for sure, but here's a guess. (And I presume getRegion() is not really what you want or what you're using). In the dataset you describe, precipitation is in mm. When you aggregate pixels in Earth Engine, say with something like image.reduceRegion(ee.Reducer.sum(), geometry, scale), the input is resampled as necessary to scale, then all the pixels are summed. Doing that with mm doesn't make sense since you need to scale precipitation in mm by ee.Image.pixelArea() (which is in square meters) converted to square mm. It's the scaling step which I think you're missing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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