From dcddaee7f58415c0c60708087ec35a1cbb374611 Mon Sep 17 00:00:00 2001 From: hollorol Date: Sun, 10 Feb 2019 09:39:38 +0100 Subject: [PATCH] Adding csv functionality to saveAllmusoPlots --- RBBGCMuso/R/plotMuso.R | 4 ++-- RBBGCMuso/man/saveAllMusoPlots.Rd | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RBBGCMuso/R/plotMuso.R b/RBBGCMuso/R/plotMuso.R index d54f2da..36d7fac 100644 --- a/RBBGCMuso/R/plotMuso.R +++ b/RBBGCMuso/R/plotMuso.R @@ -327,7 +327,7 @@ compareMuso <- function(settings=NULL,parameters, variable=1, calibrationPar=NUL saveAllMusoPlots <- function(settings=NULL, plotName = ".png", - silent = TRUE, type = "line", + silent = TRUE, type = "line", outFile = "annual.csv", colour = NULL, skipSpinup = FALSE){ if(is.null(settings)){ @@ -348,7 +348,7 @@ saveAllMusoPlots <- function(settings=NULL, plotName = ".png", } musoYData <- getyearlyout(settings) - + write.csv(musoYData,paste0(settings$outputNames[[2]],outFile)) for(i in seq_along(annualVarCodes)){ outPlot <- ggplot(data = musoYData, mapping = aes_string(x = "year", y = paste0("var_",annualVarCodes[i])))+ geom_bar(stat = "identity")+ labs(y = musoMapping(annualVarCodes[i])) + theme_classic() + diff --git a/RBBGCMuso/man/saveAllMusoPlots.Rd b/RBBGCMuso/man/saveAllMusoPlots.Rd index 6132d6a..79b184b 100644 --- a/RBBGCMuso/man/saveAllMusoPlots.Rd +++ b/RBBGCMuso/man/saveAllMusoPlots.Rd @@ -5,7 +5,8 @@ \title{saveAllMusoPlots} \usage{ saveAllMusoPlots(settings = NULL, plotName = ".png", silent = TRUE, - type = "line", colour = NULL, skipSpinup = FALSE) + 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.}