Expected ASTER signatures of Deception Spectra (Madrid20170407)

knitr::opts_chunk$set(fig.path = "figure/Spectra2AST_")
                     
require(ggplot2)
require(directlabels)
#source("/media/alobo/LaCie2T1/Rutils/RLRS/sensrespv4.R")
source("sensrespv4.R") #alobo function

1. Data

1.1 Load Relative Spectral Response of ASTER

#done by A.Lobo in astRSRS_Log.R
#(LaCie2T1/Rsensors/ASTER)
load("astRSR_VNIR.rda")
load("astRSR_SWIR.rda")

make one single data frame:

astRSR <- rbind(astRSR_VNIR,astRSR_SWIR)
head(astRSR)
##   Band Wavelength    RSR
## 1    1      0.480 0.0000
## 2    1      0.484 0.0069
## 3    1      0.488 0.0078
## 4    1      0.492 0.0073
## 5    1      0.496 0.0107
## 6    1      0.500 0.0580
astRSR$Wavelength <- astRSR$Wavelength*1000 #as required by sensrespv4() below

1.2 Read Spectra

(average by site)

#done by A.Lobo in import_mediciones20170406_log.R 
#(Decepcion/SpectrometryDecepcion/SpectMadrid20170407/2017_04_06_MedicionesAgustinLobo)
load("meanrefbysite.rda")
head(meanrefbysite)
##      site Wavelength Reflectance
## 1 D1_1inf        350  0.04403669
## 2 D1_1inf        351  0.03872558
## 3 D1_1inf        352  0.03675610
## 4 D1_1inf        353  0.04136302
## 5 D1_1inf        354  0.04967281
## 6 D1_1inf        355  0.04370849

2. Calculate expected ASTER signatures

ASTsignatures <- data.frame(site=NA,Band=NA,Wavelength=NA, Reflectance=NA)
for (i in unique(meanrefbysite$site)) {
    sel <- meanrefbysite[meanrefbysite$site==i,-1]
    delme <- sensrespv4(rsr=astRSR,espectro=sel,bandcent=NULL,norm=FALSE)
    colnames(delme) <- names(ASTsignatures)[-1]
    delme <- data.frame(site=i,delme)
    delme[1,]
    ASTsignatures <- rbind(ASTsignatures,delme)
}
ASTsignatures <- ASTsignatures[-1,]
head(ASTsignatures,11)
##       site Band Wavelength Reflectance
## 2  D1_1inf    1   556.2980  0.10813705
## 3  D1_1inf    2   660.9832  0.12512574
## 4  D1_1inf    3   806.7995  0.13369674
## 5  D1_1inf    4  1655.8807  0.15909562
## 6  D1_1inf    5  2166.9492  0.18061359
## 7  D1_1inf    6  2207.7280  0.18113381
## 8  D1_1inf    7  2265.5416  0.18518089
## 9  D1_1inf    8  2334.5589  0.19124775
## 10 D1_1inf    9  2397.4873  0.19509196
## 11   D1_25    1   556.2980  0.06890385
## 12   D1_25    2   660.9832  0.07558558
save(ASTsignatures,file="ASTsignaturesMadrid20170407.rda")

3. Plots

ggplot(data=meanrefbysite) +
    geom_line(aes(x=Wavelength, y=Reflectance,group=site,color=site),size=1) +
    geom_line(data=ASTsignatures,aes(x=Wavelength, y=Reflectance,group=site,color=site)) +
    geom_point(data=ASTsignatures,aes(x=Wavelength, y=Reflectance,group=site,color=site),size=3) +
    theme(legend.position="none") +
    facet_wrap(~site)

plot of chunk unnamed-chunk-6

p <- ggplot(data=meanrefbysite) +
    geom_line(aes(x=Wavelength, y=Reflectance,group=site,color=site)) +
    geom_line(data=ASTsignatures,aes(x=Wavelength, y=Reflectance,group=site,color=site)) +
    geom_point(data=ASTsignatures,aes(x=Wavelength, y=Reflectance,group=site,color=site),size=3)
direct.label(p, method=list(last.points,cex=0.75,'last.bumpup'))
## Error: 'ggproto' is not an exported object from 'namespace:ggplot2'