geotopGOF: GEOtop Goodnes of fit

Description Usage Arguments See Also Examples

View source: R/geotop.gof.R

Description

GEOtop Goodnes of fit

Usage

1
2
3
4
5
6
geotopGOF(x = NULL, geotop.model = NULL, approx.list = list(),
  sim = NULL, obs, layer = c("z0005", "z0020"), obs_field = "mean",
  gof.mes = NULL, gof.expected.value.for.optim = NULL, weights = NULL,
  output_simulation = FALSE, names_par = NULL,
  useSoilIntegratedValues = FALSE, temporary.runpath = FALSE,
  multiaggr = TRUE, ...)

Arguments

x

vector with parameters to calibrate. See param in geotopZProfile or geotopExec

geotop.model

a list with arguments for geotopZProfile. It is used if sim is NULL.

approx.list

list of arguments for approxfunDataFrame (optional) or integratefunDataFrame (in this case rember to specify the zrange argument).

sim

simulated data as a object returned by geotopZProfile

obs

observed data

layer

layers corresponding to soil depth at whch GOF indices are calculated

obs_field

obs field used in the observation data frame. Deafault is "mean", it is used in case varaiables are measured with different sensors at the same depth and location.

gof.mes

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

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}.

weights

vector of weights to assing to each layer, in case of a weigeted-averaged goodness-of-fit measure over all layers. It is NULL (Default) the gooness-of-fit measures are separately calculated for each layer. If it is "uniform", the weights are uniformly distributed in all layers.

output_simulation

logical value. If it is TRUE, function returns a list with the GOF values and the simulated time series

names_par

names of x

useSoilIntegratedValues

logical values. Default is FALSE. If it is TRUE output is integrated with a soil thckness through integratefunDataFrame.

temporary.runpath

logical value. If it TRUE GEOtop is running in a temporary sub-directory, see geotopExec. Default is FALSE.

...

further aguments for gof .

See Also

geotopZProfile,gof

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
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' 
##### '/Ubsers/ecor/local/bin/geotop_zh'
runpath <- "/home/ecor/temp/geotopOptim_tests"

vars <- "SoilLiqContentProfileFile"

sim <- geotopZProfile(bin=bin,simpath=simpath,runpath=runpath,
clean=TRUE,variable=vars,data.frame=TRUE,level=1,zformatter=zformatter,intern=TRUE)

gof <- geotopGOF(obs=obs_SWC,sim=sim[[vars[1]]],layer=c("z0005","z0020"))

gof

### Use geotopGOF with an internal GEOtop simulation

## create a list with arguments for geotopZProfile

x <- param <- c(N=1.4,Alpha=0.0021,ThetaRes=0.05) 

geotop.model <- list(bin=bin,simpath=simpath,runpath=runpath,
clean=TRUE,variable=vars,data.frame=TRUE,level=1,zformatter=zformatter,intern=TRUE)

gof_geotop <- geotopGOF(x=x,obs=obs_SWC,geotop.model=geotop.model,layer=c("z0005","z0020"),gof.mes="KGE")

gof_geotop_ <- geotopGOF(x=x,obs=obs_SWC,geotop.model=geotop.model,layer=c("z0005","z0020"),gof.mes="KGE",useSoilIntegratedValues=TRUE,approx.list=list(zrange=c(0,500),rescaleWithDz=TRUE))

#

ecor/geotopOptim documentation built on May 13, 2017, 1:03 p.m.