Skip to content

Commit

Permalink
Preparing release
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Schmidt-Walter committed Jun 25, 2019
1 parent 2862dad commit c3cc25e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
33 changes: 15 additions & 18 deletions R/mrunLWFB90.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#' @export
#'
#' @examples
#' # Set up lists containing model control options and model parameters:
#' #Set up lists containing model control options and model parameters:
#' param.b90 <- setparam_LWFB90()
#' options.b90 <- setoptions_LWFB90()
#'
Expand All @@ -53,50 +53,47 @@
#' options.b90$startdate <- as.Date("2002-01-01")
#' options.b90$enddate <- as.Date("2003-12-31")
#'
#' # choose the 'Coupmodel' shape option for the annual lai dynamic,
#' # with fixed budburst and leaf fall dates:
#' # choose the 'Coupmodel' shape option for the annual lai dynamic, with fixed budburst and leaf fall dates:
#' options.b90$lai.method <- 'Coupmodel'
#' options.b90$budburst.method <- 'fixed'
#' options.b90$leaffall.method <- 'fixed'
#'
#' # set up data.frame with variable parameters
#' #set up data.frame with variable parameters
#' n <- 5
#' vary_parms <- data.frame(shape.optdoy = runif(n,180,240),
#' shape.budburst = runif(n, 0.1,1),
#' winlaifrac = runif(n, 0,0.5),
#' budburstdoy = runif(n,100,150),
#' soil_materials.ths3 = runif(n, 0.3,0.5),
#' maxlai2 = runif(n,4,8))
#' soil_materials.ths3 = runif(n, 0.3,0.5), #' ths of material 3
#' maxlai2 = runif(n,4,8)) #' 2nd year lai
#'
#' # soil as soil_nodes and soil materials to param.b90, so ths3 can be looked up
#' param.b90[c("soil_nodes", "soil_materials")] <- soil_to_param(soil)
#' # set up maxlai with length 2, so maxlai2 of paramvar can be looked up
#' param.b90$maxlai <- c(5, 5)
#'
#' \dontrun{
#' # Make a Multirun-Simulation (this takes a while)
#' # Make a Multirun-Simulation
#' b90.multi <- mrunLWFB90(paramvar = vary_parms,
#' param.b90 = param.b90,
#' options.b90 = options.b90,
#' climate = slb1_meteo)
#' names(b90.multi)
#'
#' # extract results: EVAPDAY.ASC
#' #extract results: EVAPDAY.ASC
#' evapday <- data.table::rbindlist(lapply(b90.multi,
#' FUN = function(x) {x[["EVAPDAY.ASC"]]}),
#' idcol = "srun")
#' evapday$dates <- with(evapday, as.Date(paste(YR,MO,DA), "%Y %m %d"))
#'
#' with(evapday[evapday$srun == "RunNo.1", ],
#' plot(dates, cumsum(EVAP)))
#' # plot
#' srun_nms <- unique(evapday$srun)
#' with(evapday[evapday$srun == srun_nms[1], ],
#' plot(dates, cumsum(EVAP), type = "l")
#' )
#' for (i in 2:length(b90.multi)){
#' with(evapday[evapday$srun == srun_nms[i], ],
#' lines(dates, cumsum(EVAP)))
#' }
#'
#' # same simulation, but return goodnes-fit-measure only.
#' # prepare observations
#' observations <- slb1_mpot # daily water potential in different soil depths
#' # prepare data: names have to be found in simulation output.
#' names(observations)[2:6] <- c("psimi5", "psimi7", "psimi10", "psimi16","psimi21")
#'
#' @importFrom stats setNames
#' @importFrom utils txtProgressBar setTxtProgressBar
mrunLWFB90 <- function(paramvar,
Expand Down
14 changes: 10 additions & 4 deletions dev/Run examples/examples_all.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ vary_parms <- data.frame(shape.optdoy = runif(n,180,240),
shape.budburst = runif(n, 0.1,1),
winlaifrac = runif(n, 0,0.5),
budburstdoy = runif(n,100,150),
soil_materials.ths3 = runif(n, 0.3,0.5),
maxlai2 = runif(n,4,8))
soil_materials.ths3 = runif(n, 0.3,0.5), # ths of material 3
maxlai2 = runif(n,4,8)) # 2nd year lai

# soil as soil_nodes and soil materials to param.b90, so ths3 can be looked up
param.b90[c("soil_nodes", "soil_materials")] <- soil_to_param(soil)
Expand All @@ -85,9 +85,15 @@ evapday <- data.table::rbindlist(lapply(b90.multi,
idcol = "srun")
evapday$dates <- with(evapday, as.Date(paste(YR,MO,DA), "%Y %m %d"))

with(evapday[evapday$srun == "RunNo.1", ],
plot(dates, cumsum(EVAP))
srun_nms <- unique(evapday$srun)

with(evapday[evapday$srun == srun_nms[1], ],
plot(dates, cumsum(EVAP), type = "l")
)
for (i in 2:length(b90.multi)){
with(evapday[evapday$srun == srun_nms[i], ],
lines(dates, cumsum(EVAP)))
}

# ---- MakeStand ----

Expand Down
33 changes: 15 additions & 18 deletions man/mrunLWFB90.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c3cc25e

Please sign in to comment.