I'm trying to reclassify multiple bands from my raster. It is a land use raster of the Amazon basin by Mapbiomas. I need to reclassify all 36 bands at once.
## Reclassifying multiple bands raster values in Google Earth Engine
#Inport amazonia mapbiomas
AmazMapbiomas = (ee.Image('projects/mapbiomas-raisg/public/collection3/mapbiomas_raisg_panamazonia_collection3_integration_v2'))
#A list of pixel values to replace.
fromList = [1, 4, 5, 6, 10, 12, 14, 22, 24, 25, 26, 27, 29, 30, 33, 34]
# A corresponding list of replacement values (10 becomes 1, 20 becomes 2, etc).
toList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 11, 6, 8, 9, 10]
#list length check if is the same length
print(len(fromList))
print(len(toList))
## Replace pixel values in the image. If the image is multi-band, only the
#here I wanted to reclassify all 36 stalls, how can I do this at once?
AmazMapbiomasReclass = img.remap({
From: fromList,
to: toList,
defaultValue: 0,
bandName: 'all'
});