1

I have downloaded Landsat 8 higher level surface reflectance product from USGS to genetare chlorophyll map in lake. But the individual bands contain some negative surface reflectance values. So, when I am applying the regression model, the logarithmic scale turns those values to NA. Does someone know what is causing those negative values in the surface reflectance bands? Is it possible to neglect those values ? I am processing my data in R.

1 Answer 1

2

Check product guide from Landsat 8 surface reflectance. Values range is from -2000 to 16000, but the valid range is from 0 to 10000, so you need to mask off pixels out of range. In R you can change this pixels to NA.

Suppose a random raster with values lower than 0 or greater than 10000:

library(raster)

r <- raster()
values(r) <- rnorm(n = ncell(r),mean = 5000, sd = 1500)

r
class       : RasterLayer 
dimensions  : 180, 360, 64800  (nrow, ncol, ncell)
resolution  : 1, 1  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
data source : in memory
names       : layer 
values      : -1551.911, 11077.55  (min, max)

To remove those values, select them and change to NA:

r[r > 10000 | r < 0] <- NA

r
class       : RasterLayer 
dimensions  : 180, 360, 64800  (nrow, ncol, ncell)
resolution  : 1, 1  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
data source : in memory
names       : layer 
values      : 39.23503, 9998.751  (min, max)
3
  • Many thanks for your help and sorry for my ignorance. Can you please tell me what does the code 'values(r) <- rnorm(n = ncell(r),mean = 5000, sd = 1500)' do? Can I only use the code 'r[r > 10000 | r < 0] <- NA' for masking off the pixels ?
    – D.Banerjee
    Jul 25, 2017 at 13:37
  • values(r) <- rnorm(n = ncell(r),mean = 5000, sd = 1500) is to create a reproducible example. For a real LaSRC scene just load each band with raster() function or use stackMeta() function from RStoolbox package to load all bands in an unique multi-layer raster using .xml metadata file. So, you can use only r[r > 10000 | r < 0] <- NA
    – aldo_tapia
    Jul 25, 2017 at 13:43
  • Correct link: prd-wret.s3-us-west-2.amazonaws.com/assets/palladium/production/… Table 7-1
    – piegames
    Mar 14, 2019 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.