-1

I'm working with the Google Earth Engine API and the dataset SPL4SMGP.007 SMAP L4 Global 3-hourly 9-km Surface and Root Zone Soil Moisture. I'm trying to get the minimum and maximum value for the band sm_surface, after calculating the mean value for an observation period between 2015-2020.

When trying to calculate the max/min with reduceRegion, I'm getting the following error:

EEException: User memory limit exceeded

I was thinking that my observation area is just to big, but even when I'm not trying to calculate the min/max globally, but just for one country, I still get this user memory limit exceeded error. Because I did the same thing with other datasets with an even better spatial resolution, I think that it has maybe something to do with this specific dataset ?

You can find my code below.

    # Load Data
    smap = ee.ImageCollection('NASA/SMAP/SPL4SMGP/007')

    # Observation Period
    smap_2015_2020 = smap.filterDate('2015-04-01', '2021-01-01')

    # Select bands
    sm_surface = smap_2015_2020.select('sm_surface')

    # Get mean
    sm_surface_mean = sm_surface.mean()

    # Load the dataset for country boundaries
    countries = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level0')

    nation = "Austria"

    # Filter for country "Austria"
    region = countries.filter(ee.Filter.eq('ADM0_NAME', nation))

    # Calculating min/max
    max_sm_surface_reg = sm_surface_mean.reduceRegion(
        reducer=ee.Reducer.max(), 
        geometry=region, 
        scale=11000, 
        maxPixels=1e7,
    )

    min_sm_surface_reg = sm_surface_mean.reduceRegion(
        reducer=ee.Reducer.min(),
        geometry=region,
        scale=11000,
        maxPixels=1e7
    )

    # With the following code, I get "EEException: User memory limit exceeded"
    max_sm_surface_info = max_sm_surface_reg.getInfo()
    max_sm_surface_info

    min_sm_surface_info = min_sm_surface_reg.getInfo()
    min_sm_surface_info
1
  • I think it's unrelated to the dataset but the way you try to use it. The smap_2015_2020 has 16816 that you try to reduce on each pixel. which will always exceed your user memory, can you try to map a reducer on your imagecollection instead ? Commented May 28 at 9:57

1 Answer 1

0

Since you're reducing 16.816 images (!), I recommend setting the min and max values in a Feature and exporting it to Drive. Something like this:

result = region.set({
    'min': min_sm_surface_reg.get('sm_surface'),
    'max': max_sm_surface_reg.get('sm_surface'),
})

# Export the result to a CSV file.
task = ee.batch.Export.table.toDrive(...)
task.start()
2
  • Your method works when setting "nation" to smaller countries like Austria. My goal is to get the min/max values for any country a user might choose. If I'm setting "nation" to a bigger country like "Australia" for example, I still get the User memory error. Is there any other way to calculate the min/max values without running into that problem?
    – Maine
    Commented Jun 16 at 12:12
  • Try not to use the getInfo(), and don't try to print the max_sm_surface_info and min_sm_surface_info variables. Commented Jun 17 at 13:18

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.