layer to change nodata values

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

layer to change nodata values

Hari Sharma
Hi all,
> I downloaded global water surface layer from Pekel et al., 2016. The data (band values) has 0 to 255. 0 = 0 water, 1 = 1%, 2= 2%….100=100% water and after then 255 (which is no data according to paper). I want to keep this values from 0 to 100 only in the raster and want to change values 255 into nodata. How can I make r code? I have following code but I am not sure it is good not?

a <- raster(“waterlayer.tif)
max <- 100
a[a >= max] <- NA

Hari Sharma

        [[alternative HTML version deleted]]

R-sig-Geo mailing list
[hidden email]