1

I'm having trouble converting a server-side object which contains a number into a client-side value effectively. I'm using GEE python API. getInfo() function takes a lot of time to process.

# Get the sum of pixel values in the entire image
sum_value = multiplied_image.reduceRegion(
  reducer=ee.Reducer.sum(),
  geometry=geom,
  scale=100  # Set the appropriate scale for your analysis
)

# Sum_value is an Earth Engine object
sum_value = sum_value.get('sm_rootzone')

# Convert to client-side number using ee.Number
sum_value_client = ee.Number(sum_value).getInfo()
# print(sum_value_client)

# Append the results to the data list
data.append([Date_pre, layer, sum_value_client]

1 Answer 1

1

How long is too long? Without the rest of your code it's difficult to assess whether this can be improved. You might also find that using the batch environment is a better solution for your analysis. Read more about it here:

https://developers.google.com/earth-engine/guides/processing_environments

Your goal would then be to create and start an export task:

https://developers.google.com/earth-engine/guides/exporting_tables

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.