What is the best method to change the negative values (or values greater than some number) in every band of a multiband image to zero?
closed as off-topic by PolyGeo♦ Jun 10 at 18:05
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
Think you could do that like this (https://code.earthengine.google.com/af976bcd1dbd1c64ec8a73f4d9aabf65):
// create an image for this example var image = imageCollection.first() // select boundary value, could also be zero var value = 888.8 // create mask, gt mean greater-than, can also use lt(), lte() etc. var mask = image.gt(2) // create new image var new_image = mask.multiply(value).add(image.multiply(mask.not())) Map.addLayer(image) Map.addLayer(new_image)