Skip to content

Commit

Permalink
Revert "Fixes requested issues by reviewer - installation instruction…
Browse files Browse the repository at this point in the history
…s, unit information and limits, readme"

This reverts commit fb53d67.
  • Loading branch information
evanoffPNNL committed Nov 9, 2020
1 parent fb53d67 commit 7a92878
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 67 deletions.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,3 @@ _The map scenario interface to `hectorui` that allows the user to parameterize i
## Contributing to `hectorui`

We welcome contributions to `hectorui` from the development community. Please contact us if you want to collaborate! The `hectorui` GitHub repository is accessible here: [`hector-ui` GitHub Repository](https://github.com/JGCRI/hectorui)

For more information about contributing, please contact Chris Vernon at chris.vernon@pnnl.gov

## Installing Locally

To install hectorui as an R package for local use, please follow these steps in your R command line:

- library(devtools)
- devtools::install_github("JGCRI/hectorui")
61 changes: 11 additions & 50 deletions inst/shinyApp/parameters.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contains parameter related functions and observers

#' Assign Parameters from model to core
#' Assign Parameters from numeric components to core
#'
#' @return no return value
#' @export
Expand Down Expand Up @@ -161,90 +161,51 @@ setParameters <- function()
if(length(hcores) > 0)
{
newVals <- vector()
pass_check <- TRUE
# Run through variables and make sure none are left empty and update the top level scope paramsList variable
# and the hector core with any changed values
tryCatch(
{
for(i in 1:length(hcores))
{
if(!is.na(input$input_aero) && input$input_aero <= 1 && input$input_aero > 0)
if(!is.na(input$input_aero))
{
hector::setvar(hcores[[i]], dates = NA, var = globalParameters['aero'], values = c(as.double(input$input_aero)), unit = "unitless")
paramsList['alpha'] <<- as.double(input$input_aero)
}
else
{
shinyalert::shinyalert("Input Error:", "Aeroscale Forcing value out of bounds. Please use (0,1) as limits.", type = "error")
pass_check <- FALSE
}
if(!is.na(input$input_beta) && input$input_beta > 0 && input$input_beta <= 5)
if(!is.na(input$input_beta))
{
hector::setvar(hcores[[i]], dates = NA, var = globalParameters['beta'], values = c(as.double(input$input_beta)), unit = "unitless")
paramsList['beta'] <<- as.double(input$input_aero)
}
else
{
shinyalert::shinyalert("Input Error:", "CO2 Fertilization Factor value out of bounds. Please use (0,5) as limits.", type = "error")
pass_check <- FALSE
}
if(!is.na(input$input_diff) && input$input_diff > 0)
if(!is.na(input$input_diff))
{
hector::setvar(hcores[[i]], dates = NA, var = globalParameters['diff'], values = c(as.double(input$input_diff)), unit = "cm2/s")
paramsList['diff'] <<- as.double(input$input_aero)
}
else
{
shinyalert::shinyalert("Input Error:", "Ocean Heat Diffusivity value out of bounds. Please use (>0) as limits.", type = "error")
pass_check <- FALSE
}
if(!is.na(input$input_ecs) && input$input_ecs >=1 && input$input_ecs <= 6)
if(!is.na(input$input_ecs))
{
hector::setvar(hcores[[i]], dates = NA, var = globalParameters['ecs'], values = c(as.double(input$input_ecs)), unit = "degC")
paramsList['S'] <<- as.double(input$input_aero)
}
else
{
shinyalert::shinyalert("Input Error:", "ECS value out of bounds. Please use (1,6) as limits.", type = "error")
pass_check <- FALSE
}
if(!is.na(input$input_pco2) && input$input_pco2 >= 250 && input$input_pco2 <= 300)
if(!is.na(input$input_pco2))
{
hector::setvar(hcores[[i]], dates = NA, var = globalParameters['pco2'], values = c(as.double(input$input_pco2)), unit = "ppmv CO2")
paramsList['C'] <<- as.double(input$input_aero)
}
else
{
shinyalert::shinyalert("Input Error:", "Preindustrial CO2 value out of bounds. Please use (250, 300) as limits.", type = "error")
pass_check <- FALSE
}
if(!is.na(input$input_q10) && input$input_q10 > 0 && input$input_q10 <= 10)
if(!is.na(input$input_q10))
{
hector::setvar(hcores[[i]], dates = NA, var = globalParameters['q10'], values = c(as.double(input$input_q10)), unit = "unitless")
paramsList['q10_rh'] <<- as.double(input$input_aero)
}
else
{
shinyalert::shinyalert("Input Error:", "Q10 value out of bounds. Please use (0, 10) as limits.", type = "error")
pass_check <- FALSE
}
if(!is.na(input$input_volc) && input$input_volc > 0 && input$input_volc <= 1)
if(!is.na(input$input_volc))
{
hector::setvar(hcores[[i]], dates = NA, var = globalParameters['volc'], values = c(as.double(input$input_volc)), unit = "unitless")
paramsList['volscl'] <<- as.double(input$input_aero)
}
else
{
shinyalert::shinyalert("Input Error:", "Volcanic Forcing value out of bounds. Please use (0,1) as limits.", type = "error")
pass_check <- FALSE
}
}
if(pass_check == TRUE)
{
resetCore()
if(length(hcores) > 0)
loadGraph()
}
resetCore()
if(length(hcores) > 0)
loadGraph()
},
warning = function(war)
{
Expand Down
2 changes: 1 addition & 1 deletion inst/shinyApp/ui.r
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ library(shinyBS)
tags$tr(width = "100%",
tags$td(width = "8%", align = "center", popify(div(class="paramDivs", icon("info-circle", "fa-1x")), title = "CO2 fertilization factor", content = "Setting this value will change the CO2 Forcing Factor for any active Hector cores.", placement = "top" )),
tags$td(width = "68%", div("CO2 fertilization factor (unitless)")),
tags$td(width = "24%", numericInput("input_beta", width = 80, label = NULL, value = NA, step = 0.01, min = 0.01, max = 4.99))
tags$td(width = "24%", numericInput("input_beta", width = 80, label = NULL, value = NA, step = 0.01, min = 0.01))
),
tags$tr(width = "100%",
tags$td(width = "8%", align = "center", popify(div(class="paramDivs", icon("info-circle", "fa-1x")), title = "Ocean heat diffusivity", content = "Setting this value will change the Ocean Heat Diffusivity for any active Hector cores.", placement = "top" )),
Expand Down
7 changes: 0 additions & 7 deletions paper/paper.bib
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,3 @@ @article{van2011rcp2
year={2011},
publisher={Springer}
}
@Manual{,
title = {shiny: Web Application Framework for R},
author = {Winston Chang and Joe Cheng and JJ Allaire and Yihui Xie and Jonathan McPherson},
year = {2020},
note = {R package version 1.4.0.2},
url = {https://CRAN.R-project.org/package=shiny},
}

0 comments on commit 7a92878

Please sign in to comment.