0

I am trying to query properties (~10) from Earth Engine datasets (Temperature, Precipitation, GLDAS outputs, etc.) for a given coordinate point and time range in my dataset (90,000 points). I’ve done this in a map() function, and then I filter out any null values for properties that have no value at that point.

Running this code is taking an extremely long time and it keeps reattempting. I have tried using a smaller dataset ~20,000 rows and also just using a single property ex. Temperature. However, this still takes a very long time and keeps reattempting.

I was told that using a join vs. a map-filter approach would be better. However, I’m not sure how to implement this in my use case. It seems like I could join collections based on time and place, but I'm not sure how to implement that. Most of the join examples I've seen online use only 2 collections, whereas I'm using more.

How can I implement ee.Join in my code?

Code Link: https://code.earthengine.google.com/7cff87028ed482dd439f5d9c93d05ca6

Asset Link: https://code.earthengine.google.com/?asset=projects/ee-akhilapram/assets/final-water-data-copy-4

function properties(feature) {
  var date = ee.Date(feature.get('Time'));
  
  var lst = lst_main.filterDate(date, date.advance(feature.get('Time difference'), 'months')).mean();
  var precip = precip_main.filterDate(date, date.advance(feature.get('Time difference'), 'months')).mean();
  var wind_speed = wind_speed_main.filterDate(date, date.advance(feature.get('Time difference'), 'months')).mean();
  var et = et_main.filterDate(date, date.advance(feature.get('Time difference'), 'months')).mean();
  var rzsm = rzsm_main.filterDate(date, date.advance(feature.get('Time difference'), 'months')).mean();
  var bfgr = bfgr_main.filterDate(date, date.advance(feature.get('Time difference'), 'months')).mean();
  var pcsw = pcsw_main.filterDate(date, date.advance(feature.get('Time difference'), 'months')).mean();
  var swe = swe_main.filterDate(date, date.advance(feature.get('Time difference'), 'months')).mean();
  var ssr = ssr_main.filterDate(date, date.advance(feature.get('Time difference'), 'months')).mean();
  var sm = sm_main.filterDate(date, date.advance(feature.get('Time difference'), 'months')).mean();
  var elevation = elevation_main;
  
  var comb = lst.addBands(precip).addBands(wind_speed).addBands(et).addBands(rzsm).addBands(bfgr).addBands(pcsw).addBands(swe).addBands(ssr).addBands(sm).addBands(elevation);
  return feature.set(comb.reduceRegion(ee.Reducer.first(), feature.geometry(), 1000));
}

data = data.map(properties);
data = data.filter(ee.Filter.notNull(ee.List(['LST_Day_1km', 'precipitationCal', 'Wind_f_inst', 'Evap_tavg', 'RootMoist_inst', 'Qsb_acc', 'CanopInt_inst', 'SWE_inst', 'Qs_acc', 'SoilMoi100_200cm_inst', 'elevation'])));
4
  • For code review there is the Code Review Stack Exchange. Commented Jan 22, 2022 at 23:07
  • 2
    I'm not really looking for a code review, just some advice on how to implement ee.Join Commented Jan 22, 2022 at 23:46
  • That sounds like a you're seeking a code review of working but slow code. Commented Jan 22, 2022 at 23:52
  • 2
    I'm not sure if members of Code Review are familiar with GEE and the coding practices Commented Jan 23, 2022 at 0:01

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.