Skip to content

Commit

Permalink
export output host pools from all runs
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJones687 committed Jan 29, 2024
1 parent 0f6e559 commit 05f36f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
6 changes: 4 additions & 2 deletions R/pops_multirun.R
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,8 @@ pops_multirun <- function(infected_file_list,
north_distance_to_quarantine,
south_distance_to_quarantine,
east_distance_to_quarantine,
west_distance_to_quarantine
west_distance_to_quarantine,
output_host_pools_runs
)

names(outputs) <-
Expand All @@ -695,7 +696,8 @@ pops_multirun <- function(infected_file_list,
"north_distance_to_quarantine",
"south_distance_to_quarantine",
"east_distance_to_quarantine",
"west_distance_to_quarantine"
"west_distance_to_quarantine",
"output_host_pools_runs"
)

if (config$write_outputs %in% config$output_write_list) {
Expand Down
20 changes: 10 additions & 10 deletions tests/testthat/test-pops-multirun.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ test_that("Multirun model outputs work", {
use_initial_condition_uncertainty,
use_host_uncertainty)

expect_equal(length(data), 17)
expect_equal(length(data), 18)
expect_equal(terra::as.matrix(data$median_run[[1]], wide = TRUE),
terra::as.matrix(terra::rast(infected_file_list), wide = TRUE))
# expect_equal(terra::as.matrix(data$susceptible_run[[1]], wide = TRUE),
Expand Down Expand Up @@ -284,7 +284,7 @@ test_that("Multirun model outputs work", {
soil_starting_pest_file = "",
start_with_soil_populations = FALSE)

expect_equal(length(data), 17)
expect_equal(length(data), 18)
expect_equal(terra::as.matrix(data$median_run[[1]], wide = TRUE),
terra::as.matrix(terra::rast(infected_file_list), wide = TRUE))
# expect_equal(terra::as.matrix(data$susceptible_run[[1]], wide = TRUE),
Expand Down Expand Up @@ -375,7 +375,7 @@ test_that("Multirun model outputs work", {
network_filename,
network_movement)

expect_equal(length(data), 17)
expect_equal(length(data), 18)
expect_equal(terra::as.matrix(data$median_run[[1]], wide = TRUE),
terra::as.matrix(terra::rast(infected_file_list), wide = TRUE))
# expect_equal(terra::as.matrix(data$susceptible_run[[1]], wide = TRUE),
Expand Down Expand Up @@ -463,7 +463,7 @@ test_that("Multirun model outputs work", {
network_filename,
network_movement)

expect_equal(length(data), 17)
expect_equal(length(data), 18)
expect_equal(terra::as.matrix(data$median_run[[1]], wide = TRUE),
terra::as.matrix(terra::rast(infected_file_list), wide = TRUE))
# expect_equal(terra::as.matrix(data$susceptible_run[[1]], wide = TRUE),
Expand Down Expand Up @@ -653,7 +653,7 @@ test_that("Multirun model outputs work with mask", {
soil_starting_pest_file = "",
start_with_soil_populations = FALSE)

expect_equal(length(data), 17)
expect_equal(length(data), 18)
expect_equal(terra::as.matrix(data$median_run[[1]], wide = TRUE),
terra::as.matrix(terra::rast(infected_file_list), wide = TRUE))
expect_equal(data$number_infecteds[[1]], 1)
Expand Down Expand Up @@ -754,7 +754,7 @@ test_that("Multirun model outputs work with mask", {
soil_starting_pest_file = "",
start_with_soil_populations = FALSE)

expect_equal(length(data), 17)
expect_equal(length(data), 18)
expect_equal(data$west_rate[[1]], 0)
expect_equal(data$west_rate[[2]], 0)
expect_equal(data$east_rate[[1]], 0)
Expand Down Expand Up @@ -849,7 +849,7 @@ test_that("Multirun model outputs work with mask", {
soil_starting_pest_file = "",
start_with_soil_populations = FALSE)

expect_equal(length(data), 17)
expect_equal(length(data), 18)
expect_equal(data$west_rate[[1]], 0)
expect_equal(data$west_rate[[2]], 0)
expect_equal(data$east_rate[[1]], 0)
Expand Down Expand Up @@ -945,7 +945,7 @@ test_that("Multirun model outputs work with mask", {
soil_starting_pest_file = "",
start_with_soil_populations = FALSE)

expect_equal(length(data), 17)
expect_equal(length(data), 18)
expect_equal(data$west_rate[[1]], 0)
expect_equal(data$west_rate[[2]], 0)
expect_equal(data$east_rate[[1]], 0)
Expand Down Expand Up @@ -1041,7 +1041,7 @@ test_that("Multirun model outputs work with mask", {
soil_starting_pest_file = "",
start_with_soil_populations = FALSE)

expect_equal(length(data), 17)
expect_equal(length(data), 18)
expect_equal(data$west_rate[[1]], 0)
expect_equal(data$west_rate[[2]], 0)
expect_equal(data$east_rate[[1]], 0)
Expand Down Expand Up @@ -1216,7 +1216,7 @@ test_that("Multirun model outputs work with writing all simulations and random s
soil_starting_pest_file,
start_with_soil_populations)

expect_equal(length(data), 17)
expect_equal(length(data), 18)
expect_equal(terra::as.matrix(data$median_run[[1]], wide = TRUE),
terra::as.matrix(terra::rast(infected_file_list), wide = TRUE))
expect_equal(data$number_infecteds[[1]], 1)
Expand Down

0 comments on commit 05f36f7

Please sign in to comment.