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
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 ?