[R-sig-Geo] Extracting mean spectra from RasterLayer

ASANTOS alexandresantosbr at yahoo.com.br
Sat Jul 13 16:54:08 CEST 2013


Dear list member,

        I make a simple simulation of landsat band and I intended to 
extracting the mean spectra from a band3.DOS4refl objec create after 
atmospheric and radiometric simulation, for this I make:

require(raster)
require(sp)
require(rgdal)
require(landsat)
#
#Create raster
r <- raster(nc=1000, nr=1000)
set.seed(20130622)
stackIm1 <- stack(lapply(1, function(x) setValues(r, 
round(runif(ncell(r))* 255))))## Simulation band
#
# define projection system
r.geo <- CRS("+proj=utm +zone=23 +south +datum=WGS84 +units=m +no_defs") 
# geographical datum WGS84
proj4string(stackIm1) <- r.geo
#
#Create geotiff
writeRaster(stackIm1, 
filename="stackIm1.tif",format="GTiff",overwrite=TRUE, bylayer=TRUE)
#
# Atmospheric and radiometric correction
dia<-125#Day order 06/05/2010
isun<-23.45*sin(360*((284+dia)/365)) #Sun inclination
#
#
# Read tif object created
r1<-raster(c("stackIm1.tif"))
r1.grid<- as(r1, 'SpatialGridDataFrame')
#
#That SHV (45) "very clear day" is then used in DOS() to end the 
corrected SHV values for the remaining bands
#
# Hypothetical band 1
band1.DOS <- DOS(sat = 5, SHV = 45, SHV.band = 1, Grescale = 0.765827, 
Brescale = -2.29, sunelev = isun, edist = ESdist("2010-05-06"))
band1.DOS <- band1.DOS[["DNfinal.mean"]]## Coefficients results
#
## Simulation band 3 correction
band3.DOS4refl<-radiocorr(r1.grid, Grescale=0.120354, Brescale=-0.49, 
sunelev=isun, satzenith = 0, edist=ESdist("2010-05-06"), Esun=220.0, 
Lhaze = band1.DOS[3,1], method = "DOS4")
image(band3.DOS4refl)

but I ask, if there are any function for extracting mean spectra from 
band3.DOS4refl object?

Thanks

-- 
======================================================================
Alexandre dos Santos
Proteção Florestal
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial
Cáceres - MT                      CEP: 78.200-000
Fone: (+55) 65 8132-8112 (TIM)   (+55) 65 9686-6970 (VIVO)

         alexandre.santos at cas.ifmt.edu.br



More information about the R-sig-Geo mailing list