Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
Comparing every element of two lists of dictionaries

in Google Earth Engine I have two list of dictionaries. I would like to have a new list of dictionaries containing {date: ..., prec_mm: .... , moisture: ....}, when moisture value is available. Else I want a null value.

I don't know how to check every element of the list (regardless the index of the elements) and how to write the entire list at the end.

var prec = [                                                                       
  {data:20150801, prec_mm:11.2},                                                 
  {data:20150802, prec_mm:0},   
  {data:20150803, prec_mm:0},   
  {data:20150804, prec_mm:0},   
  {data:20150805, prec_mm:0},   
  {data:20150806, prec_mm:0},   
  {data:20150807, prec_mm:0},   
  {data:20150808, prec_mm:0},   
  {data:20150809, prec_mm:0},   
  {data:20150810, prec_mm:0},
  {data:20150811, prec_mm:2.2},
  {data:20150812, prec_mm:0},
  {data:20150813, prec_mm:0},
  {data:20150814, prec_mm:0.6},
  {data:20150815, prec_mm:11.2},
  {data:20150816, prec_mm:3.4},
  {data:20150817, prec_mm:0},
  ];
  
  
var moisture = [
  {data:20150801, moisture:0.1},                                                 
  {data:20150802, moisture:0},  
  {data:20150803, moisture:0.2},
  {data:20150804, moisture:null},
  {data:20150810, moisture:0.05},   
  {data:20150816, moisture:0.3},
  {data:20150817, moisure:null}
]

for(var i=0; i<prec.length; i++){
  var final = []
  if (prec[i].data == moisture[i].data) {
    final.push(prec[i].data, prec[i].prec_mm, moisture[i].moisture) 
    print(final) 
      }
  else if (prec[i].data != moisture[i].data) {
    final.push(prec[i].data, prec[i].prec_mm, null)
    print(final)} 
};

Thanks in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!