BandMath: BandMath

Description Usage Arguments Value Author(s) Examples

View source: R/AdvancedFunctions.R

Description

Compute the mathematic combination of n bands according to a specified formula and to a specified band convlution (average or gaussian)

Usage

1
BandMath(wl, spectrum, expr, bands, fun = "mean")

Arguments

wl

numeric vector: wavelength vector

spectrum

numeric vector or dataframe: spectrum to analyze

expr

expression containing the arithmetic operations between bands. Incremental alphabetich letter are used.

bands

numeric data.frame: center wavelength and fwhm of each bands to be used. Each row of the data.frame is called incremettally considering alphabetic letters. First row a, ..., 26th row z.

fun

function for the band value calculation (e.g. mean, gaussian)

Value

numeric vector or value containing the spectral index selected.

Author(s)

Tommaso Julitta, Mirco Migliavacca, Thomas Wutzler

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  





data("FloX_data")


data("up_coeffa")


data("dw_coeff")


data("wl_FloX")





#Get Target Radiance 


L<-GetRadiance(DNSignal=FloX_data$L-FloX_data$dcL,IntegrationTime=FloX_data$IT_L/1000,RadCalCoeff=dw_coeff)


#Get Solar Radiance 


E<-GetRadiance(DNSignal=FloX_data$E-FloX_data$dcE,IntegrationTime=FloX_data$IT_E/1000,RadCalCoeff=up_coeff)


#Get Reflectance


Ref<-GetReflectance(UpwellingRadiance = L,DownwellingRadiance=E)





#Define Index expression


expressionND<-"(a-b)/(a+b)"


#Define Index band


ND_bands<-data.frame(cwl= c(780,680),fwhm=c(5,5,5,5))


#Compute index


ND<-BandMath(wl=wl_FloX,spectrum=Ref,expr=parse(text=expressionND),ND_bands,fun="mean")


ND_gaus<-BandMath(wl=wl_FloX,spectrum=Ref,expr=parse(text=expressionND),ND_bands,fun="gaussian")





#plot results    


x11()


par(mar=c(5,5,2,2))


plot(ND,pch=20,xlab="N. measurements",ylab="NDVI - 780nm & 680nm",ylim = c(-1,1),cex=3,col="dark green")


points(ND_gaus,pch=20,col="red")

tommasojulitta/FieldSpectroscopyDP documentation built on March 12, 2020, 1:42 p.m.