adding more filtering options and bugfixing in plotMuso.
This commit is contained in:
parent
5ced44441e
commit
1aaa21348e
@ -1,9 +1,9 @@
|
||||
Package: RBBGCMuso
|
||||
Title: An R package for BiomeBGC-MuSo ecosystem modelling
|
||||
Version: 0.6.0.0-2
|
||||
Version: 0.6.0.0-3
|
||||
Authors@R: person("Roland", "Hollo's", , "hollorol@gmail.com", role = c("aut", "cre"))
|
||||
Description: What the package does (one paragraph).
|
||||
Depends: R (>= 2.10)
|
||||
Depends: R (>= 3.3.2)
|
||||
License: GPL-2
|
||||
LazyData: true
|
||||
NeedsCompilation: no
|
||||
|
||||
@ -46,7 +46,8 @@ plotMuso <- function(settings=NULL,
|
||||
colour="blue",
|
||||
skipSpinup=TRUE,
|
||||
fromData=FALSE,
|
||||
timeFrame="day",
|
||||
timeFrame="day",
|
||||
selectYear=NULL,
|
||||
groupFun=mean,
|
||||
dpi=300){
|
||||
|
||||
@ -98,6 +99,10 @@ plotMuso <- function(settings=NULL,
|
||||
tibble::rownames_to_column("date") %>%
|
||||
mutate(date2=date,date=as.Date(date,"%d.%m.%Y")) %>%
|
||||
tidyr::separate(date2,c("day","month","year"),sep="\\.")
|
||||
if(!is.null(selectYear)){
|
||||
musoData <- musoData %>% dplyr::filter(year == get("selectYear"))
|
||||
}
|
||||
|
||||
if(timeFrame!="day"){
|
||||
musoData <- tryCatch(groupByTimeFrame(data=musoData, timeFrame = timeFrame, groupFun = groupFun),
|
||||
error=function(e){stop("The timeFrame or the gropFun is not found")})
|
||||
@ -108,6 +113,11 @@ plotMuso <- function(settings=NULL,
|
||||
mutate(date2=date,date=as.Date(date,"%d.%m.%Y"),
|
||||
yearDay=rep(1:365,numberOfYears), cum_yieldC_HRV=cum_yieldC_HRV*22.22) %>%
|
||||
tidyr::separate(date2,c("day","month","year"),sep="\\.")
|
||||
if(!is.null(selectYear)){
|
||||
musoData <- musoData %>% dplyr::filter(year == get("selectYear"))
|
||||
}
|
||||
|
||||
|
||||
if(timeFrame!="day"){
|
||||
musoData <- tryCatch(groupByTimeFrame(data=musoData, timeFrame = timeFrame, groupFun = groupFun),
|
||||
error=function(e){stop("The timeframe or the gropFun is not found")})
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#' @return An effect plot
|
||||
#' @export
|
||||
|
||||
musoQuickEffect <- function(settings = NULL,calibrationPar = NULL, startVal, endVal, nSteps = 1, fileTochange="epc", outVar, parName = "parVal"){
|
||||
musoQuickEffect <- function(settings = NULL,calibrationPar = NULL, startVal, endVal, nSteps = 1, fileToChange="epc", outVar, parName = "parVal"){
|
||||
|
||||
if(is.character(outVar)){
|
||||
varNames <- as.data.frame(musoMappingFind(outVar))
|
||||
@ -37,7 +37,7 @@ musoQuickEffect <- function(settings = NULL,calibrationPar = NULL, startVal, en
|
||||
|
||||
parVals <- seq(startVal, endVal, length = (nSteps + 1))
|
||||
a <- do.call(rbind,lapply(parVals, function(parVal){
|
||||
calResult <- tryCatch(calibMuso(settings = settings,calibrationPar = calibrationPar, parameters = parVal, outVars = outVarIndex, silent = TRUE), error = function(e){NA})
|
||||
calResult <- tryCatch(calibMuso(settings = settings,calibrationPar = calibrationPar, parameters = parVal, outVars = outVarIndex, silent = TRUE,fileToChange = fileToChange), error = function(e){NA})
|
||||
if(all(is.na(calResult))){
|
||||
b <- cbind(rep(NA,365),parVal)
|
||||
rownames(b) <- tail(musoDate(startYear = settings$startYear, numYears = settings$numYears),365)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user