daily output list
This commit is contained in:
parent
1f9343c158
commit
0ef9ac9413
@ -7,6 +7,7 @@ export(cleanupMuso)
|
||||
export(compareMuso)
|
||||
export(copyMusoExampleTo)
|
||||
export(corrigMuso)
|
||||
export(getDailyOutputList)
|
||||
export(getMeteoData1BGC)
|
||||
export(getyearlycum)
|
||||
export(getyearlymax)
|
||||
|
||||
@ -142,6 +142,13 @@ calibMuso <- function(settings=NULL, calibrationPar=NULL,
|
||||
settings$numData <- round(settings$numData*outputVarChanges[[2]])
|
||||
}
|
||||
|
||||
# if(modifyOriginal){
|
||||
# suppressWarnings(dir.create())
|
||||
# sapply(c(iniInput,epc),)
|
||||
#
|
||||
# }
|
||||
|
||||
|
||||
if(!skipSpinup) {
|
||||
|
||||
##Run the model for the spinup run.
|
||||
|
||||
27
RBBGCMuso/R/getOutPutList.R
Normal file
27
RBBGCMuso/R/getOutPutList.R
Normal file
@ -0,0 +1,27 @@
|
||||
#' getDailyOutputList
|
||||
#'
|
||||
#' bla bla
|
||||
#' @param settings bla
|
||||
#' @export
|
||||
|
||||
|
||||
getDailyOutputList <- function(settings=NULL){
|
||||
if(is.null(settings)){
|
||||
settings<- setupMuso()
|
||||
}
|
||||
settings$dailyOutputTable
|
||||
}
|
||||
|
||||
#' getAnnualOutputList
|
||||
#'
|
||||
#' bla bla
|
||||
#' @param settings bla
|
||||
#' @export
|
||||
|
||||
|
||||
getDailyOutputList <- function(settings=NULL){
|
||||
if(is.null(settings)){
|
||||
settings<- setupMuso()
|
||||
}
|
||||
settings$annualOutputTable
|
||||
}
|
||||
@ -32,7 +32,11 @@ updateMusoMapping<-function(output_map_init="output_map_init.c"){
|
||||
musoMapping <- function(code,
|
||||
mapData=getOption("RMuso_varTable")[[as.character(getOption("RMuso_version"))]]){
|
||||
if(is.null(mapData)){
|
||||
return(unlist(mMapping[which(mMapping[,1]==code),2])) #mMapping is package-scoped system variable generated by udateMusoMapping
|
||||
return(unlist(tryCatch(mMapping[which(mMapping[,1]==code),2],error = function(e){
|
||||
|
||||
stop(sprintf("The code %s in inifile is not valid muso output variable code",code))
|
||||
|
||||
}))) #mMapping is package-scoped system variable generated by udateMusoMapping
|
||||
} else {
|
||||
return(unlist(mapData[which(mapData[,1]==code),2]))
|
||||
}
|
||||
|
||||
@ -159,6 +159,8 @@ setupMuso <- function(executable=NULL,
|
||||
error = function(e){
|
||||
stop("Cannot read indexes of output variables from the normal ini file, please make sure you have not skiped a line after the flag: \"DAILY_OUTPUT\"")
|
||||
})
|
||||
|
||||
dailyVarCodes<-unlist(lapply(dailyVarCodes, function(x) unlist(strsplit(x,"[\ \t]"))[1]))
|
||||
dailyVarnames<-unlist(lapply(dailyVarCodes, function(x) musoMapping(unlist(strsplit(x,"[\ \t]"))[1])))
|
||||
|
||||
outIndex<-grep("ANNUAL_OUTPUT",iniFiles[[2]])+1
|
||||
@ -268,6 +270,10 @@ setupMuso <- function(executable=NULL,
|
||||
}
|
||||
epcFiles <- tryCatch(sapply(iniFiles,function(x){(searchBellow(x,"EPC_FILE"))}),error = function(e){""})
|
||||
metInput <- tryCatch(sapply(iniFiles,function(x){(searchBellow(x,"MET_INPUT"))}),error = function(e){""})
|
||||
dailyOutputTable <- cbind.data.frame(seq_along(dailyVarCodes),dailyVarCodes,outputVars[[1]])
|
||||
colnames(dailyOutputTable) <- c("index","code","name")
|
||||
annualOutputTable <- cbind.data.frame(seq_along(annualVarCodes),annualVarCodes,outputVars[[2]])
|
||||
colnames(dailyOutputTable) <- c("index","code","name")
|
||||
|
||||
settings = list(executable = executable,
|
||||
calibrationPar = calibrationPar,
|
||||
@ -293,7 +299,9 @@ setupMuso <- function(executable=NULL,
|
||||
outputVars=outputVars,
|
||||
soilFile=soilFiles,
|
||||
dailyVarCodes= gsub("\\s.*","",dailyVarCodes),
|
||||
annualVarCodes = gsub("\\s.*","",annualVarCodes)
|
||||
annualVarCodes = gsub("\\s.*","",annualVarCodes),
|
||||
dailyOutputTable=dailyOutputTable,
|
||||
annualOutputTable=annualOutputTable
|
||||
)
|
||||
|
||||
# if(getOption("RMuso_version")==6){
|
||||
@ -324,6 +332,9 @@ setupMuso <- function(executable=NULL,
|
||||
# writeLines(iniFiles[[2]],iniInput[[2]])
|
||||
# }
|
||||
# }
|
||||
|
||||
suppressWarnings(dir.create(file.path(inputLoc,"bck")))
|
||||
# sapply(iniFiles,epc)
|
||||
return(settings)
|
||||
|
||||
}
|
||||
|
||||
27
RBBGCMuso/getOutPutList.R
Normal file
27
RBBGCMuso/getOutPutList.R
Normal file
@ -0,0 +1,27 @@
|
||||
#' getDailyOutputList
|
||||
#'
|
||||
#' bla bla
|
||||
#' @param settings bla
|
||||
#' @export
|
||||
|
||||
|
||||
getDailyOutputList <- function(settings=NULL){
|
||||
if(is.null(settings)){
|
||||
settings<- setupMuso()
|
||||
}
|
||||
settings$dailyOutputTable
|
||||
}
|
||||
|
||||
#' getAnnualOutputList
|
||||
#'
|
||||
#' bla bla
|
||||
#' @param settings bla
|
||||
#' @export
|
||||
|
||||
|
||||
getDailyOutputList <- function(settings=NULL){
|
||||
if(is.null(settings)){
|
||||
settings<- setupMuso()
|
||||
}
|
||||
settings$annualOutputTable
|
||||
}
|
||||
18
RBBGCMuso/man/getDailyOutputList.Rd
Normal file
18
RBBGCMuso/man/getDailyOutputList.Rd
Normal file
@ -0,0 +1,18 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/getOutPutList.R
|
||||
\name{getDailyOutputList}
|
||||
\alias{getDailyOutputList}
|
||||
\title{getDailyOutputList}
|
||||
\usage{
|
||||
getDailyOutputList(settings = NULL)
|
||||
|
||||
getDailyOutputList(settings = NULL)
|
||||
}
|
||||
\arguments{
|
||||
\item{settings}{bla}
|
||||
}
|
||||
\description{
|
||||
bla bla
|
||||
|
||||
bla bla
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user