Skip to content
Snippets Groups Projects
Commit a92670cc authored by Christoph Schürz's avatar Christoph Schürz
Browse files

Minor fix for list of sims in plot_variable_at_harvkill

parent 2768dde9
No related branches found
No related tags found
No related merge requests found
......@@ -38,20 +38,20 @@ plot_variable_at_harvkill <- function(sim_verify, variable, years = 1900:2100) {
is_list_sim <- "mgt_out" %in% names(sim_verify[[1]])
if(is_single_sim){
years <- years[years >= min(sim_verify$basin_wb_day$yr)]
tbl_harv <- prepare_var_at_harvkill(sim_verify$mgt_out, years, variable)
} else if (is_list_sim){
years <- years[years >= min(sim_verify[[1]]$basin_wb_day$yr)]
df <- NULL
nn <- c()
for(n in names(sim_verify)){
mgt_out <- sim_verify[[n]][["mgt_out"]]
tbl_harv <- prepare_var_at_harvkill(mgt_out, years, variable)
tbl_harv$name <- n
tbl_harv$simulation <- n
nn <- c(nn, n)
if(is.null(df)){df <- tbl_harv} else {df <- bind_rows(df, tbl_harv)}
}
tbl_harv <- df %>%
mutate(name = factor(name, levels = nn))
mutate(simulation = factor(simulation, levels = nn))
} else {
stop('Incorrect input for sim_verify')
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment