1

I am grappling with an issue in reducing NDVI values for South America. I am interested in knowing what the mean NDVI is for this continent (single value), without having to lose resolution by increasing my pixel scale to a very large number. My thought was trying to place some type of grid that could create smaller regions and then make a dictionary and take the mean of the means from the grid. I'm not sure if my logic is totally sound here, but I'm hoping I'm on an okay track. Would GEE be able to do this, and if so, is there a way to create a function to simplify this task?

This code doesn't work for obvious reasons... system time out and memory limits.

var sam_mean = fit_year_ndvi.clip(sam).reduceRegion({
  reducer: ee.Reducer.mean(),
  geometry: sam,
  scale: 1000,
  maxPixels: 1e12
});

Here is my link: https://code.earthengine.google.com/b8486d4ef347cde7555614254b143ec7

Here is my asset link: https://code.earthengine.google.com/?asset=users/anna_odell/continents

1 Answer 1

1

My thought was trying to place some type of grid that could create smaller regions and then make a dictionary and take the mean of the means from the grid.

This should not be necessary — Earth Engine will already subdivide your reduceRegion operation to compute it efficiently. However, you might need more time to complete it. The solution to this is to run the operation as a batch (export) job. If your final result is just the number and not some more complex data, you can put it inside a feature to make it exportable:

var collection_for_export = ee.FeatureCollection([
  ee.Feature(null, {'sam_mean': sam_mean})
]);
Export.table.toDrive({
  collection: collection_for_export,
  fileFormat: 'CSV',
});

I also notice that you have:

var sam_mean = fit_year_ndvi.clip(sam).reduceRegion({
  geometry: sam,
  ...

The .clip(sam) is unnecessary because reduceRegion already operates only on the specified region, and clipping it separately will do extra computation without any benefit.

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.