I am processing Landsat 8 images to detect water quality parameters in R. I am using NDWI to masking the images. The raster layer I obtained from NDWI has negative values which I wanted to remove. Can anyone help me to do this?
Suppose you have a raster titled LandCover (used the name LC here). You can assign NA values to your RasterLayer for negative values.
LC[LC < 0] <- NA
This will set a lower bound to the values.