2

I'm trying to assign bins to a raster containing values between -1 and 1 in GEE. The bins would be 0.41<x<0.60, 0.61<x<0.80 for example. Is there a function for this?

The only function I can find is image.remap which works for individual values rather than ranges.

3
  • Let me understand, values between 0.41 and 0.6 would be in one category, and values between 0.61 and 0.8 in another? what about the rest? Commented Apr 9, 2018 at 1:41
  • @RodrigoE.Principe That's correct- the map i'm trying to make uses the differenced normalised burn ratio, but I only want pixels to be displayed if they are burned. The bins denote different burn severities.
    – JamesNoble
    Commented Apr 9, 2018 at 13:58
  • Check this: gis.stackexchange.com/questions/274762/…
    – aldo_tapia
    Commented Apr 9, 2018 at 14:33

1 Answer 1

3
var thresholds = ee.Image([0.4, 0.6, 0.8]);
var zones = image.lt(thresholds).reduce('sum');
Map.addLayer(zones, {min: 0, max: 3}, 'zones');

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.