# NOT RUN {
## lower-level implementation example
## see ?fRTM for the typical mode of simulation
## e.g. fRTM(rho~prospectd+foursail)
## 1) get parameters
params<-getDefaults(rho~prospectd+foursail)
## getDefaults("foursail") will also work
bestpars<-params$foursail$best
## ensure the vector is named
names(bestpars) <- rownames(params$foursail)
## 2) get leaf reflectance and transmission
rt<-fRTM(rho+tau~prospectd)
## 3) get soil reflectance to model background reflectance
data(soil)
## a linear mixture soil model
bgRef<- bestpars["psoil"]*soil[,"drySoil"] + (1-bestpars["psoil"])*soil[,"wetSoil"]
## 4) run 4SAIL
foursail(rt[,"rho"],rt[,"tau"],bgRef,bestpars)
# }
Run the code above in your browser using DataLab