diff --git a/h2/components/functions/func_graph_plots.R b/h2/components/functions/func_graph_plots.R index 4a5c104..c93ffa8 100644 --- a/h2/components/functions/func_graph_plots.R +++ b/h2/components/functions/func_graph_plots.R @@ -15,7 +15,7 @@ graph_plots <- function(r6) { } else if(r6$save == FALSE) { {ggplot(r6$no_save_output) + - geom_line(aes(x = year, y = value, color = ssp)) + + geom_line(aes(x = year, y = value, color = Scenario)) + labs(x = "Year", y = r6$no_save_output$variable[1], title = paste0("Run Name: Unsaved Run\n", "Variable: ", r6$no_save_output$variable[1]))} %>% plotly::ggplotly() %>% diff --git a/h2/components/modules/mod_run.R b/h2/components/modules/mod_run.R index 89c63f0..63ac8ad 100644 --- a/h2/components/modules/mod_run.R +++ b/h2/components/modules/mod_run.R @@ -8,14 +8,7 @@ run_ui <- function(id) { tabPanel(class = "params", "Standard Scenarios", chooseSliderSkin(skin = "Flat", color = "#375a7f"), selectInput(ns("ssp_path"), label="Select SSP:", - choices = list("SSP 1-1.9"="input/hector_ssp119.ini", - "SSP 1-2.6"="input/hector_ssp126.ini", - "SSP 2-4.5"="input/hector_ssp245.ini", - "SSP 3-7.0"="input/hector_ssp370.ini", - "SSP 4-3.4"="input/hector_ssp434.ini", - "SSP 4-6.0"="input/hector_ssp460.ini", - "SSP 5-3.4OS"="input/hector_ssp534-over.ini", - "SSP 5-8.5"="input/hector_ssp585.ini"), + choices = scenarios, selected = "input/hector_ssp245.ini"), sliderInput(ns("time"), label="Select dates:", min = 1750, max = 2300, value = c(1900,2100), sep="", width = "90%", step=5), @@ -127,14 +120,14 @@ run_server <- function(id, r6) { if (r6$save == TRUE) { r6$output[[r6$run_name()]] <- fetchvars(core(), r6$time()[1]:r6$time()[2], vars = list(r6$selected_var())) %>% - mutate(run = r6$run_name(), Scenario = input$ssp_path) + mutate(run = r6$run_name(), Scenario = names(which(scenarios == input$ssp_path, arr.ind = FALSE))) updateSwitchInput(session = session, "savetoggle", value = FALSE) } else if (r6$save == FALSE) { r6$no_save_output <- fetchvars(core(), r6$time()[1]:r6$time()[2], vars = list(r6$selected_var())) %>% - mutate(ssp = input$ssp_path) + mutate(Scenario = names(which(scenarios == input$ssp_path, arr.ind = FALSE))) } diff --git a/h2/global.r b/h2/global.r index 4b70015..58fe4b1 100644 --- a/h2/global.r +++ b/h2/global.r @@ -47,6 +47,15 @@ HectorInputs <- R6Class( ) ) +scenarios <- list("SSP 1-1.9"="input/hector_ssp119.ini", + "SSP 1-2.6"="input/hector_ssp126.ini", + "SSP 2-4.5"="input/hector_ssp245.ini", + "SSP 3-7.0"="input/hector_ssp370.ini", + "SSP 4-3.4"="input/hector_ssp434.ini", + "SSP 4-6.0"="input/hector_ssp460.ini", + "SSP 5-3.4OS"="input/hector_ssp534-over.ini", + "SSP 5-8.5"="input/hector_ssp585.ini") + title <- list("CO2_concentration" = "Atmospheric CO2", "atmos_co2" = "Atmospheric Carbon Pool", "ffi_emissions" = "FFI Emissions",