I am new to GEE so the answer to this question may be simple to most of you. I am looking for a way to reclassify pixel values in all of the images in an image collection. I'm working with the Monthly History data from the Global Surface Water dataset and targeting the months March-May. As it currently is, water pixels have a value of 2, non-water pixels are 1, and non-sampled pixels (no data) are 0. I would like to reclassify such that water = 1, not water = 0, and everything else is masked. My code is below:
var dataset = ee.ImageCollection('JRC/GSW1_2/MonthlyHistory')
.filterBounds(roi)
.map(function(image){return image.clip(roi)})
.filter(ee.Filter.calendarRange(3, 5, 'month'));
print(dataset);
This is the part that doesn't work...
var reclassified = function(img) {
return img.remap(([2, 1], [1, 0]), 'water');
};
var new_ds = dataset.map(reclassified)
print(new_ds);