I have written a script in the Google Earth Engine to extract values from 5 images (all climate data) to a list of points which I have imported from a csv to a feature collection. In principle it works fine. However, it takes a lot of time not only to export the updated table (the points with the extracted values) but also just to print them. Even if it just a list of 6 points, it takes almost half an hour.

Can anyone explain me if I can resolve this and if not, why this is? I am a big fan of the Earth Engine, however I did not expect a problem like to occur.

Thanks in advance!

// Script to load set of points and extract data from global raster data Map.addLayer(Coords)

/// Call Image Collections ////////////////////////////////////////////////

// Modis Dataset Air Surface temperature
var ST_img_modis = ee.ImageCollection('MODIS/006/MOD11A1')
                  .filter(ee.Filter.date('2000-03-05', '2020-01-01'))

// ERA 5 Daily aggregates image collection
var img_era  = ee.ImageCollection("ECMWF/ERA5/DAILY")
                  .filter(ee.Filter.date('1980-01-01', '2020-01-01'))
// get air temperature and total daily precipitation
var AT_img_era = img_era.select(['mean_2m_air_temperature_mean']);
var P_img_era = img_era.select(['total_precipitation_mean']);

// FLDAS, Famine Land Data Assimilation System (by NASA) image collection
var img_fldas  = ee.ImageCollection("NASA/FLDAS/NOAH01/C/GL/M/V001")
                  .filter(ee.Filter.date('1982-01-01', '2020-01-01'))
// get soil (upper 10 cm) and air temperature
var SoilT_img_fldas = img_fldas.select(['SoilTemp00_10cm_tavg_mean']);
var Tair_img_fldas = img_fldas.select(['Tair_f_tavg_mean']);

print('ERA Air Temperature:',AT_img_era)
print('ERA Precipitation:',P_img_era)
print('FLDAS Soil Temperature:',SoilT_img_fldas)
print('FLDAS Air Temperature:',Tair_img_fldas)

/// Define Functions //////////////////////////////////////////////////////

var getData = function(feature){

  var modis_T = ST_img_modis.reduceRegions(feature, ee.Reducer.first(), null,  'EPSG:4326',[1,0,0,0,1,0]);
  modis_T = ee.Number(modis_T.first().get('first'));
  feature = feature.set('modis_T', modis_T);

  var era_AT = AT_img_era.reduceRegions(feature, ee.Reducer.first(), null,  'EPSG:4326',[1,0,0,0,1,0]);
  era_AT = ee.Number(era_AT.first().get('first'));
  feature = feature.set('era_AT', era_AT);

  var era_P = P_img_era.reduceRegions(feature, ee.Reducer.first(), null,  'EPSG:4326',[1,0,0,0,1,0]);
  era_P = ee.Number(era_P.first().get('first'));
  feature = feature.set('era_P', era_P);

  var fldas_SoilT = SoilT_img_fldas.reduceRegions(feature, ee.Reducer.first(), null,  'EPSG:4326',[1,0,0,0,1,0]);
  fldas_SoilT = ee.Number(fldas_SoilT.first().get('first'));
  feature = feature.set('fldas_SoilT', fldas_SoilT);

  var fldas_AirT = Tair_img_fldas.reduceRegions(feature, ee.Reducer.first(), null,  'EPSG:4326',[1,0,0,0,1,0]);
  fldas_AirT = ee.Number(fldas_AirT.first().get('first'));
  feature = feature.set('fldas_AirT', fldas_AirT);

  return feature

/// Map Function over Feature Collection //////////////////////////////////

var Coor_upd = Coords.map(getData);

// Export

The Coords file looks like this:

  • How fast or slow this script will execute depends on your Coords, which you didn't include in the script. – Daniel Wiell Apr 10 at 13:56
  • Thanks for the suggestion, I added the file as text. – IgnaceP Apr 10 at 14:01

It's difficult to judge the performance of EE. There are a lot of factors at play, many which are completely opaque for us users. What is fast one day can be very slow another. How much load EE is experiencing at the time you run your task certainly do seem to matter a lot.

I ran your script a couple of times. It took one or two minutes. Maybe it was faster than for you due to caching - EE might have some of this data closer at hand, if it was recently accessed. But I did change the coordinates, to prevent this.

Even if your output from this contains very little data, a whole lot of imagery is involved in producing these outputs. I find my 1-2 minutes a reasonable processing time. You might just have been unlucky with your 30 minutes.

| improve this answer | |
  • Allright, this already clears things up, thank you very much! – IgnaceP Apr 10 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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