1

I have created a cumulative cost layer for the U.S. of distance to rivers based on the National Hydrologic Dataset. My source data is a 30 meter resolution image of all rivers with values equal to the Stream Order number and all non-streams equal to zero. My cost data is this same layer remapped so that all of the U.S. is equal to 1. The cumulative cost image runs fine and I can display it by:

Map.addLayer(cumulativeCost, {min: 0, max: 5e4}, 'accumulated cost');

When I try to export it, I create a geometry of a small section of the U.S., about the size of the state of Washington, and run:

Export.image.toDrive({
  image: cumulativeCost,
  description: 'CostAllRivers1',
  scale: 30,
  region: geometry,
  maxPixels: 1e13});

In the Tasks tab, I receive the error "Error: Number of pixels requested from Image.load exceeds the maximum allowed (2^31)" and in the Console tab I receive "accumulated cost: Tile error: User memory limit exceeded."

I cannot find these errors listed in the documentation, and it happens even when I make the geometry super small. I get the same error if I try to export the cumulativeCost image to an asset. Can anyone help?

I saw mention of using Export as helping with computation time-out errors, but I don't know how to implement this with my cumulative cost function.

From https://developers.google.com/earth-engine/debugging

Bad — don't do this!

var ridiculousComputation = ee.Image(1).reduceRegion({
  reducer: 'count',
  geometry: ee.Geometry.Rectangle([-180, -90, 180, 90], null, false),
  scale: 100,
  maxPixels: 1e11
});

// Error: Computation timed out.
print(ridiculousComputation);

What this error means is that Earth Engine waited about five minutes before stopping the computation. Exporting allows Earth Engine to perform the computation in an environment with longer allowable running times (but not more memory). As the return value from reduceRegion() is a dictionary, you can use the dictionary to set the properties of a feature with null geometry:

Good — use Export!

Export.table.toDrive({
  collection: ee.FeatureCollection([
    ee.Feature(null, ridiculousComputation)
  ]),
  description: 'ridiculousComputation',
  fileFormat: 'CSV'
});

Lara

  • If you can help, let me know who you are and I will share my cost and source assets with you so you can create a reproducible example. – Lara Oct 11 '18 at 16:41
1

You might be able to specify a smaller shardSize for the Export.Image, to get it to use smaller tiles.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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