0

Can someone explain what ".lt" is in the code below, and how it works?

var hydrosheds = ee.Image('WWF/HydroSHEDS/03VFDEM');
var terrain = ee.Algorithms.Terrain(hydrosheds);
var slope = terrain.select('slope');
var before1 = before.mask(slope.lt(5));
var after1 = after.mask(slope.lt(5);
Map.addLayer(after1, {palette:"red"},'flooded areas - red',1);
1
  • 3
    lt = less than. So in your example: Mask everything where the slope is more than 5. Also look at the Earth Engine documentation. You will find everything there.
    – JonasV
    Commented Nov 11, 2020 at 10:08

1 Answer 1

0

lt means LowerThan, so basically you've masked any slope which is higher than 5 (degrees I'm assuming). If you ever have a doubt on what a function does, click on the 'Docs' tab on GEE and type in the name of the function you're unsure about, a short description comes out.

2
  • Thank you so much for your clear explanation Commented Nov 25, 2020 at 6:25
  • You are welcome! Could you accept the answer so I may gain points? ^^
    – M. Nicolas
    Commented Feb 4, 2021 at 20:42

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.