Skip to content

Commit

Permalink
Merge pull request #39 from USEPA/feature_newScalarTests
Browse files Browse the repository at this point in the history
Feature new scalar tests
  • Loading branch information
knoiva-indecon authored Oct 18, 2023
2 parents 6dfd21f + 8a231be commit f28d17b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
7 changes: 6 additions & 1 deletion R/configTests.R
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ general_config_test <- function(
rm("name_i")
}
### Add to return list
saveList[["scaledImpactPlots" ]] <- list(data=scaledData, plots=scaledPlots)
saveList[["scaledImpactsPlots"]] <- list(data=scaledData, plots=scaledPlots)
rm("scaledData", "scaledPlots")
###### Save Outputs ######
### Save the workbook
Expand Down Expand Up @@ -651,6 +651,9 @@ make_scaled_impact_plots <- function(
theme = NULL
)
){
###### Get from FrEDI Namespace ######
addListNames <- utils::getFromNamespace("addListNames", "FrEDI")

### Other values
# years <- c("NA", "2010", "2090")
years <- df0[["impactYear"]] |> unique()
Expand Down Expand Up @@ -762,6 +765,8 @@ save_scaled_impact_figures <- function(
units = "in",
createDir = TRUE ### Whether to create directory if it doesn't exist
){
### Get from FrEDI Namespace
check_and_create_path <- utils::getFromNamespace("check_and_create_path", "FrEDI")
### Create directory if it doesn't exist
fdir <- fpath; rm("fpath")
fdir <- fdir |> file.path(byState |> ifelse("images-state", "images"))
Expand Down
12 changes: 12 additions & 0 deletions R/configTests_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ get_region_plotInfo <- function(
###### Initialize Return List ######
list0 <- list()

###### Get from FrEDI Namespace ######
fun_limitsByGroup <- utils::getFromNamespace("fun_limitsByGroup", "FrEDI")
get_column_values <- utils::getFromNamespace("get_column_values", "FrEDI")

###### Grouping Columns ######
### Add state to grouping
if(byState){
Expand Down Expand Up @@ -274,6 +278,10 @@ create_scaledImpact_plot <- function(
print_msg <- !silent
if(print_msg){ "Running create_scaledImpact_plot()..." |> message()}

###### Get from FrEDI Namespace ######
get_colScale <- utils::getFromNamespace("get_colScale", "FrEDI")
addListNames <- utils::getFromNamespace("addListNames", "FrEDI")

###### Data ######
df0 <- data |> filter(sector == sector0)
df0 <- df0 |> filter(impactType == impType0)
Expand Down Expand Up @@ -518,6 +526,10 @@ create_scaledImpact_plots <- function(
do_slr <- "slr" %in% (modelType |> tolower())
# modelType |> print(); do_gcm |> print(); do_slr |> print()

###### Get from FrEDI Namespace ######
get_colScale <- utils::getFromNamespace("get_colScale", "FrEDI")
addListNames <- utils::getFromNamespace("addListNames", "FrEDI")

###### Format Data ######
### Filter to sector and convert to data frame
# data |> glimpse()
Expand Down
4 changes: 2 additions & 2 deletions scripts/configureFrediData.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ list_reshapeData <- list_loadData |> reshapeData(silent=T)
returnList[["reshapedDataList"]] <- list_reshapeData

###### 3. Configure Data ######
list_systemData0 <- list_reshapeData |> createSystemData(save=F, silent=T, outPath= dataOutDir |> file.path("tmp_sysdata.rda"))
list_systemData0 <- list_reshapeData |> createSystemData(save=save, silent=T, outPath=dataOutDir |> file.path("tmp_sysdata.rda"))
### Add to list
returnList[["systemDataList"]] <- list_systemData0

###### 4. Run General Tests on Data ######
test_general_config <- general_config_test(
reshapedData = list_reshapeData,
configuredData = list_systemData0,
save = TRUE,
save = save,
overwrite = TRUE,
xlsxName = "generalConfig_testResults.xlsx",
fredi_config = fredi_config
Expand Down

0 comments on commit f28d17b

Please sign in to comment.