fix missing documentation

This commit is contained in:
Hollos Roland 2020-02-12 19:37:41 +01:00
parent 03d7af6252
commit 9a1bc5442e
20 changed files with 181 additions and 62 deletions

View File

@ -29,6 +29,7 @@ Imports:
gridExtra,
lubridate,
ecmwfr,
openxlsx,
ncdf4,
tcltk
LinkingTo: Rcpp

View File

@ -69,6 +69,7 @@ importFrom(ggplot2,theme_classic)
importFrom(ggplot2,xlab)
importFrom(ggplot2,ylab)
importFrom(gridExtra,grid.arrange)
importFrom(jsonlite,write_json)
importFrom(limSolve,xsample)
importFrom(lubridate,leap_year)
importFrom(magrittr,'%<>%')
@ -80,6 +81,7 @@ importFrom(ncdf4,ncdim_def)
importFrom(ncdf4,ncvar_def)
importFrom(ncdf4,ncvar_get)
importFrom(ncdf4,ncvar_put)
importFrom(openxlsx,read.xlsx)
importFrom(rmarkdown,pandoc_version)
importFrom(rmarkdown,render)
importFrom(scales,percent)

View File

@ -3,12 +3,15 @@
#' This function updates the Biome-BGCMuSo output code-variable matrix. Within Biome-BGCMuSo the state variables and fluxes are marked by integer numbers. In order to provide meaningful variable names (e.g. 3009 means Gross Primary Production in Biome-BGCMuSo v5) a conversion table is needed which is handled by this function.
#' @author Roland HOLLOS
#' @param excelName Name of the excelfile which contains the parameters
#' @importFrom openxlsx read.xlsx
#' @importFrom jsonlite write_json
#' @return The output code-variable matrix, and also the function changes the global variable
#' @export
updateMusoMapping<-function(excelName, dest="./", version=getOption("RMuso_version")){
updateMusoMapping <- function(excelName, dest="./", version=getOption("RMuso_version")){
expandRangeRows <- function (ind) {
toExpand <- excelDF[ind,]
rangeString <- gsub(".*?(\\d*\\-\\d*).*","\\1",toExpand[2])
interval <- as.numeric(strsplit(rangeString,split="-")[[1]])
result <- do.call(rbind,lapply(interval[1]:interval[2],function(x){
@ -34,12 +37,10 @@ updateMusoMapping<-function(excelName, dest="./", version=getOption("RMuso_versi
nonRangeMatrix[,1] <- trimws(nonRangeMatrix[,1])
names(nonRangeMatrix) <- c("names","codes","units","descriptions")
outMatrix <- rbind.data.frame(do.call(rbind.data.frame,lapply(rangeRows,expandRangeRows)),
nonRangeMatrix[,c(2,1,3,4)]
)
nonRangeMatrix[,c(2,1,3,4)])
outMatrix <- outMatrix[order(outMatrix[,1]),]
rownames(outMatrix)<- NULL
write_json(outMatrix, file.path(dest,sprintf("varTable%s.json",version)), pretty=TRUE)
}
#' musoMapping

View File

@ -4,9 +4,16 @@
\alias{alignData}
\title{alignData}
\usage{
alignData(mdata, dataCol, modellSettings = NULL, startDate = NULL,
endDate = NULL, formatString = "\%Y-\%m-\%d", leapYear = TRUE,
continious = FALSE)
alignData(
mdata,
dataCol,
modellSettings = NULL,
startDate = NULL,
endDate = NULL,
formatString = "\%Y-\%m-\%d",
leapYear = TRUE,
continious = FALSE
)
}
\description{
This function align the data to the model and the model to the data

View File

@ -4,8 +4,14 @@
\alias{changemulline}
\title{This is the function which is capable to change multiple specific lines to others using their row numbers.}
\usage{
changemulline(filePaths, calibrationPar, contents, fileOut, fileToChange,
modifyOriginal = FALSE)
changemulline(
filePaths,
calibrationPar,
contents,
fileOut,
fileToChange,
modifyOriginal = FALSE
)
}
\description{
The function uses the previous changspecline function to operate.

View File

@ -4,8 +4,12 @@
\alias{checkMeteoBGC}
\title{checkMeteoBGC}
\usage{
checkMeteoBGC(settings = NULL, skip = 4, numericReport = FALSE,
type = "normal")
checkMeteoBGC(
settings = NULL,
skip = 4,
numericReport = FALSE,
type = "normal"
)
}
\arguments{
\item{settings}{The output of setupMuso}

View File

@ -4,9 +4,15 @@
\alias{compareMuso}
\title{compareMuso}
\usage{
compareMuso(settings = NULL, parameters, variable = 1,
calibrationPar = NULL, fileToChange = "epc", skipSpinup = TRUE,
timeFrame = "day")
compareMuso(
settings = NULL,
parameters,
variable = 1,
calibrationPar = NULL,
fileToChange = "epc",
skipSpinup = TRUE,
timeFrame = "day"
)
}
\arguments{
\item{settings}{RBBGCMuso uses variables that define the entire simulation environment. Those environment variables include the name of the INI files, the name of the meteorology files, the path to the model executable and its file name, the entire output list, the entire output variable matrix, the dependency rules for the EPC parameters etc. Using the runMuso function RBBGCMuso can automatically create those environment variables by inspecting the files in the working directory (this happens through the setupMuso function). It means that by default model setup is performed automatically in the background and the user has nothing to do. With this settings parameter we can force runMuso to skip automatic environment setup as we provide the environment settings to runMuso. In a typical situation the user can skip this option.}

View File

@ -4,10 +4,19 @@
\alias{getMeteoData1BGC}
\title{getMeteoData1BGC}
\usage{
getMeteoData1BGC(startYear = 2017, endYear = 2017, lon = 18.8,
lat = 47.3, timeOut = 7200, monthList = sprintf("\%02d", 1:12),
dayList = sprintf("\%02d", 1:31), hourList = sprintf("\%02d:00",
0:23), destDir = NULL, apiFile = NULL, fileDir = NULL)
getMeteoData1BGC(
startYear = 2017,
endYear = 2017,
lon = 18.8,
lat = 47.3,
timeOut = 7200,
monthList = sprintf("\%02d", 1:12),
dayList = sprintf("\%02d", 1:31),
hourList = sprintf("\%02d:00", 0:23),
destDir = NULL,
apiFile = NULL,
fileDir = NULL
)
}
\arguments{
\item{startYear}{Start year of the downloading data. It shall be greater than 1978.}

View File

@ -4,8 +4,14 @@
\alias{musoDate}
\title{musoDate}
\usage{
musoDate(startYear, endYears = NULL, numYears, combined = TRUE,
leapYearHandling = FALSE, prettyOut = FALSE)
musoDate(
startYear,
endYears = NULL,
numYears,
combined = TRUE,
leapYearHandling = FALSE,
prettyOut = FALSE
)
}
\description{
This function generates MuSo compatibla dates for the data

View File

@ -4,12 +4,26 @@
\alias{musoMonte}
\title{musoMonte}
\usage{
musoMonte(settings = NULL, parameters = NULL, inputDir = "./",
outLoc = "./calib", iterations = 10, preTag = "mont-",
outputType = "moreCsv", fun = mean, varIndex = 1, outVars = NULL,
silent = TRUE, skipSpinup = TRUE, debugging = FALSE,
keepEpc = FALSE, constrains = NULL, skipZero = TRUE,
postProcString = NULL, ...)
musoMonte(
settings = NULL,
parameters = NULL,
inputDir = "./",
outLoc = "./calib",
iterations = 10,
preTag = "mont-",
outputType = "moreCsv",
fun = mean,
varIndex = 1,
outVars = NULL,
silent = TRUE,
skipSpinup = TRUE,
debugging = FALSE,
keepEpc = FALSE,
constrains = NULL,
skipZero = TRUE,
postProcString = NULL,
...
)
}
\arguments{
\item{settings}{A list of environmental variables for the Monte Carlo experiment. These settings are generated by the setupMuso function. By default the settings parameter is generated automatically.}

View File

@ -4,9 +4,16 @@
\alias{musoQuickEffect}
\title{musoQuickEffect}
\usage{
musoQuickEffect(settings = NULL, calibrationPar = NULL, startVal,
endVal, nSteps = 1, fileToChange = "epc", outVar,
parName = "parVal")
musoQuickEffect(
settings = NULL,
calibrationPar = NULL,
startVal,
endVal,
nSteps = 1,
fileToChange = "epc",
outVar,
parName = "parVal"
)
}
\arguments{
\item{settings}{RBBGCMuso uses variables that define the entire simulation environment. Those environment variables include the name of the INI files, the name of the meteorology files, the path to the model executable and its file name, the entire output list, the entire output variable matrix, the dependency rules for the EPC parameters etc. Using the runMuso function RBBGCMuso can automatically create those environment variables by inspecting the files in the working directory (this happens through the setupMuso function). It means that by default model setup is performed automatically in the background and the user has nothing to do. With this settings parameter we can force runMuso to skip automatic environment setup as we provide the environment settings to runMuso. In a typical situation the user can skip this option.}

View File

@ -4,8 +4,7 @@
\alias{musoRand}
\title{musoRand}
\usage{
musoRand(parameters, iterations = 3000, fileType = "epc",
constrains = NULL)
musoRand(parameters, iterations = 3000, fileType = "epc", constrains = NULL)
}
\arguments{
\item{parameters}{This is a dataframe (heterogeneous data-matrix), where the first column is the name of the parameter, the second is a numeric vector of the rownumbers of the given variable in the input EPC file, and the last two columns describe the minimum and the maximum of the parameter (i.e. the parameter ranges), defining the interval for the randomization.}

View File

@ -4,13 +4,26 @@
\alias{musoSensi}
\title{musoSensi}
\usage{
musoSensi(monteCarloFile = NULL, parameters = NULL, settings = NULL,
inputDir = "./", outLoc = "./calib", outVars = NULL,
iterations = 30, preTag = "mont-", outputType = "moreCsv",
fun = mean, varIndex = 1, outputFile = "sensitivity.csv",
plotName = "sensitivity.png", plotTitle = "Sensitivity",
skipSpinup = TRUE, skipZero = TRUE, postProcString = NULL,
dpi = 300)
musoSensi(
monteCarloFile = NULL,
parameters = NULL,
settings = NULL,
inputDir = "./",
outLoc = "./calib",
outVars = NULL,
iterations = 30,
preTag = "mont-",
outputType = "moreCsv",
fun = mean,
varIndex = 1,
outputFile = "sensitivity.csv",
plotName = "sensitivity.png",
plotTitle = "Sensitivity",
skipSpinup = TRUE,
skipZero = TRUE,
postProcString = NULL,
dpi = 300
)
}
\arguments{
\item{parameters}{This is a dataframe (heterogen data-matrix), which first column is the name of the parameters, the second is a numeric vector of the rownumbers of the given variable in the epc-fie, the last two column consist the endpont of the parameter-ranges, where the parameters will be randomized.}

View File

@ -4,14 +4,27 @@
\alias{optiMuso}
\title{optiMuso}
\usage{
optiMuso(measuredData, parameters = NULL, startDate = NULL,
endDate = NULL, formatString = "\%Y-\%m-\%d",
leapYearHandling = TRUE, dataVar, outLoc = "./calib",
preTag = "cal-", settings = NULL, outVars = NULL,
iterations = 30, skipSpinup = TRUE, constrains = NULL,
plotName = "calib.jpg", likelihood = function(x, y) {
exp(-sqrt(mean((x - y)^2))) }, continious, modelVar = 3009,
postProcString = NULL)
optiMuso(
measuredData,
parameters = NULL,
startDate = NULL,
endDate = NULL,
formatString = "\%Y-\%m-\%d",
leapYearHandling = TRUE,
dataVar,
outLoc = "./calib",
preTag = "cal-",
settings = NULL,
outVars = NULL,
iterations = 30,
skipSpinup = TRUE,
constrains = NULL,
plotName = "calib.jpg",
likelihood = function(x, y) { exp(-sqrt(mean((x - y)^2))) },
continious,
modelVar = 3009,
postProcString = NULL
)
}
\arguments{
\item{parameters}{b}

View File

@ -4,9 +4,14 @@
\alias{paramSweep}
\title{paramSweep}
\usage{
paramSweep(inputDir = "./", parameters = NULL, outputDir = NULL,
iterations = 10, outVar = "daily_gpp",
htmlOutName = "paramsweep.html")
paramSweep(
inputDir = "./",
parameters = NULL,
outputDir = NULL,
iterations = 10,
outVar = "daily_gpp",
htmlOutName = "paramsweep.html"
)
}
\arguments{
\item{inputDir}{The directory which contains the MuSo model's ini files}

View File

@ -4,8 +4,13 @@
\alias{randEpc}
\title{randEpc}
\usage{
randEpc(parameterFile = "parameters.csv", location = "./epcDir",
sourceEpc = "maize.epc", iterations = 1000, constrains = NULL)
randEpc(
parameterFile = "parameters.csv",
location = "./epcDir",
sourceEpc = "maize.epc",
iterations = 1000,
constrains = NULL
)
}
\arguments{
\item{parameterFile}{parameters.csv file location}

View File

@ -4,11 +4,19 @@
\alias{readObservedData}
\title{readMeasuredMuso}
\usage{
readObservedData(inFile, naString = NULL, sep = ",",
leapYearHandling = TRUE, convert.var = NULL, convert.scalar = 1,
readObservedData(
inFile,
naString = NULL,
sep = ",",
leapYearHandling = TRUE,
convert.var = NULL,
convert.scalar = 1,
convert.fun = (function(x) { x * convert.scalar }),
convert.file = NULL, filterCol = NULL, filterVal = 1,
selVar = NULL)
convert.file = NULL,
filterCol = NULL,
filterVal = 1,
selVar = NULL
)
}
\description{
MuSo data reader

View File

@ -4,9 +4,15 @@
\alias{saveAllMusoPlots}
\title{saveAllMusoPlots}
\usage{
saveAllMusoPlots(settings = NULL, plotName = ".png", silent = TRUE,
type = "line", outFile = "annual.csv", colour = NULL,
skipSpinup = FALSE)
saveAllMusoPlots(
settings = NULL,
plotName = ".png",
silent = TRUE,
type = "line",
outFile = "annual.csv",
colour = NULL,
skipSpinup = FALSE
)
}
\arguments{
\item{settings}{RBBGCMuso uses variables that define the entire simulation environment. Those environment variables include the name of the INI files, the name of the meteorology files, the path to the model executable and its file name, the entire output list, the entire output variable matrix, the dependency rules for the EPC parameters etc. Using the runMuso function RBBGCMuso can automatically create those environment variables by inspecting the files in the working directory (this happens through the setupMuso function). It means that by default model setup is performed automatically in the background and the user has nothing to do. With this settings parameter we can force runMuso to skip automatic environment setup as we provide the environment settings to runMuso. In a typical situation the user can skip this option.}

View File

@ -4,8 +4,15 @@
\alias{stampAndDir}
\title{stampAndCopy}
\usage{
stampAndDir(outputLoc, names, stampDir, wrongDir, type = "output",
errorsign, logfiles)
stampAndDir(
outputLoc,
names,
stampDir,
wrongDir,
type = "output",
errorsign,
logfiles
)
}
\arguments{
\item{outputLoc}{This is the location of the output files.}

View File

@ -4,10 +4,10 @@
\alias{updateMusoMapping}
\title{updateMusoMapping}
\usage{
updateMusoMapping(output_map_init="output_map_init.c")
updateMusoMapping(excelName, dest = "./", version = getOption("RMuso_version"))
}
\arguments{
\item{output_map_init}{The output code-variable bindings are described in output_map_init.c file that is part of the Biome-BGCMuSo source code. Using this function the user can read the output_map_init.c file and pass it to RBBGCMuso for further work.}
\item{excelName}{Name of the excelfile which contains the parameters}
}
\value{
The output code-variable matrix, and also the function changes the global variable