postProc in calibMuso

This commit is contained in:
hollorol 2019-02-19 16:16:15 +01:00
parent cfd6a1f7be
commit eb23330d13

View File

@ -41,7 +41,8 @@ optiMuso <- function(measuredData, parameters = NULL, startDate,
exp(-sqrt(mean((x-y)^2))) exp(-sqrt(mean((x-y)^2)))
}, },
continious, continious,
modelVar = 3009) modelVar = 3009,
postProcString = NULL)
{ {
dataCol <- grep(dataVar, colnames(measuredData)) dataCol <- grep(dataVar, colnames(measuredData))
@ -112,11 +113,16 @@ optiMuso <- function(measuredData, parameters = NULL, startDate,
write.csv(x=origModellOut, file=paste0(pretag,1,".csv")) write.csv(x=origModellOut, file=paste0(pretag,1,".csv"))
modellOut[1] <- likelihood(measuredData,origModellOut[modIndex,colNumb]) modellOut[1] <- likelihood(measuredData,origModellOut[modIndex,colNumb])
print("Running the model with the random epc values...", quote = FALSE) print("Running the model with the random epc values...", quote = FALSE)
if(!is.null(postProcString)){
colNumb <- length(settings$dailyVarCodes) + 1
}
for(i in 2:(iterations+1)){ for(i in 2:(iterations+1)){
tmp <- tryCatch(calibMuso(settings = settings, tmp <- tryCatch(calibMuso(settings = settings,
parameters = randValues[(i-1),], parameters = randValues[(i-1),],
silent= TRUE, silent= TRUE,
skipSpinup = skipSpinup)[modIndex,colNumb], error = function (e) NA) skipSpinup = skipSpinup, postProcString = postProcString)[modIndex,colNumb], error = function (e) NA)
modellOut[i]<- likelihood(measuredData,tmp) modellOut[i]<- likelihood(measuredData,tmp)
rmse[i] <- sqrt(mean((measuredData-tmp)^2)) rmse[i] <- sqrt(mean((measuredData-tmp)^2))