Skip to main content
edited title
Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

is 'is in listlist' for Image in Google Earth Engine

edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Source Link
Sara
  • 411
  • 3
  • 11

is in list for Image in Google Earth Engine

I am using the MCD12Q1.006 MODIS Land Cover Type Yearly Global 500m dataset. I want to mask out non-forest types. I am using LC_Type1 and keeping only the pixels with values 1-6. I am currently doing it this way:

var maskForest = function(image){
  var forestMask = image.gte(1).and(image.lte(6))
  return image.updateMask(forestMask)
}
var forest = landCover.select('LC_Type1').map(maskForest)

But since I may also want pixels with value 10 (for example) I wonder if there is a method like series.isin([1,2,3,4,5,6]) in pandas, python, instead of using a lot of and, or.