geotopPSO: GEOtop calibration through Particle Swam Optimization

Description Usage Arguments Details See Also Examples

Description

This function performs a calibration or a senisitivity analyisis of the GEOtop Distributed Hydrological Model through a Particle Swam Optimization or LH-OAT method respectively. This function is a wrapper of hydroPSO or lhoat. The use of either hydroPSO or lhoat is declared by the argument hydroPSOfun.

Usage

1
2
3
4
5
geotopPSO(fn = geotopGOF, gof.expected.value.for.optim = NA,
  gof.mes = "KGE", weights = "uniform", final.run = TRUE, upper, lower,
  ..., hydroPSOfun = c("hydroPSO", "lhoat"))

geotoplhoat(...)

Arguments

fn

function to optimize (minimize or maximize). Default is geotopGOF. See hydroPSO.

gof.expected.value.for.optim

expected value for Goodness-of-fit mesure, e.g. 0 or 1. It is used if this function is called by link{geotopPSO},link{hydroPSO} or link{optim}.

gof.mes

string(s) containing adopted numerical goodness-of-fit measure. If it is NULL (Default), all mesasures returned by gof are calculated.

final.run

logical value. It is TRUE (default), simulated time series with optimal set of parameteers are added in the list object returned by the function.

upper, lower

see upper and lowe in hydroPSO

...

further arguments for hydroPSO.

hydroPSOfun

used function name of hydroPSO package: hydroPSO or lhoat.

par

model parameters. See hydroPSO,geotopGOF and geotopExec

Details

The function fn, in case it is different from the default value geotopGOF , must always have the arguments gof.mes and gof.expected.value.for.optim.

See Also

hydroPSO,goflhoat

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
#' 
data(MuntatschiniB2)
## OBSERVATION PROCESSING

obs_SWC <- MuntatschiniB2[str_detect(names(MuntatschiniB2),"SWC")]
zvalues <-  as.numeric(unlist(lapply(X=str_split(names(obs_SWC), pattern="", 
				n = Inf),FUN=function (x) {
					out <- as.numeric(x)
				    out <- out[!is.na(out)]
					out <- paste(out,collapse="")
				return(out)
})))
zformatter = "z%04d"
names(obs_SWC) <- sprintf(zformatter,zvalues)
obs_SWC <- lapply(X=obs_SWC,FUN=function(x){

				if (length(dim(x))>1) {
					max <- apply(X=x,MARGIN=1,FUN=max,na.rm=TRUE)
					min <- apply(X=x,MARGIN=1,FUN=min,na.rm=TRUE)
					mean <- apply(X=x,MARGIN=1,FUN=mean,na.rm=TRUE)
					sd <- apply(X=x,MARGIN=1,FUN=sd,na.rm=TRUE)
				} else {
				
					mean <- as.vector(x)
				 	max <-  as.vector(x)
					min <-  as.vector(x)
					sd <- NA

				}
				out <- data.frame(min=min,mean=mean,max=max,sd=sd)

				out <- as.zoo(out)
             index(out) <- as.POSIXlt(index(x))

				return(out)

})
###########
###########


simpath <- system.file("Muntatschini_pnt_1_225_B2_004",package="geotopOptim")
bin <-   "/home/ecor/local/geotop/GEOtop/bin/geotop-2.0.0"
runpath <- "/home/ecor/temp/geotopOptim_tests"

vars <- "SoilLiqContentProfileFile"

### Use geotopGOF with an internal GEOtop simulation

## create a list with arguments for geotopGOF

x <- param <- c(N=1.4,Alpha=0.0021,ThetaRes=0.05,LateralHydrConductivity=0.021,NormalHydrConductivity=0.021) 
upper <- x*3

upper["LateralHydrConductivity"] <- 0.1
upper["NormalHydrConductivity"] <- 0.1

lower <- x/3
lower["N"] <- 1.1
lower["LateralHydrConductivity"] <- 0
lower["NormalHydrConductivity"] <- 0


geotop.model <- list(bin=bin,simpath=simpath,runpath=runpath,
clean=TRUE,variable=vars,data.frame=TRUE,level=1,zformatter=zformatter,intern=TRUE)
control <- list(maxit=4,npart=2) ## Maximim 4 iterations!! 

pso <- geotopPSO(par=x,obs=obs_SWC,geotop.model=geotop.model,layer=c("z0020"),gof.mes="KGE",lower=lower,upper=upper,control=control)

lhoat <- geotoplhoat(par=x,obs=obs_SWC,geotop.model=geotop.model,layer=c("z0020"),gof.mes="KGE",lower=lower,upper=upper,control=control)

ecor/geotopOptim documentation built on May 15, 2019, 8:54 p.m.