diff --git a/DESCRIPTION b/DESCRIPTION index 10e1990..4c16e8d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: poems Type: Package Title: Pattern-Oriented Ensemble Modeling System -Version: 1.3.0 +Version: 1.3.1 Authors@R: c( person("Sean", "Haythorne", email = "sean.haythorne@unimelb.edu.au", role = "aut"), person("Damien", "Fordham", email = "damien.fordham@adelaide.edu.au", role = "aut"), @@ -22,7 +22,6 @@ Imports: abc (>= 2.1), doParallel (>= 1.0.16), foreach (>= 1.5.1), - geosphere (>= 1.5.10), fossil (>= 0.4.0), lhs (>= 1.1.1), metRology (>= 0.9.28.1), @@ -30,6 +29,7 @@ Imports: raster (>= 3.6), trend (>= 1.1.4), truncnorm (>= 1.0), + gdistance, qs Collate: 'GenericClass.R' diff --git a/NAMESPACE b/NAMESPACE index 9e9cefa..52acf86 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -35,10 +35,10 @@ importFrom(doParallel,registerDoParallel) importFrom(doParallel,stopImplicitCluster) importFrom(foreach,"%dopar%") importFrom(foreach,foreach) +importFrom(fossil,earth.dist) importFrom(gdistance,costDistance) importFrom(gdistance,geoCorrection) importFrom(gdistance,transition) -importFrom(fossil,earth.dist) importFrom(lhs,randomLHS) importFrom(metRology,qtri) importFrom(qs,qread) diff --git a/NEWS.md b/NEWS.md index 8b82965..52c0db5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# version 1.3.1 + +## Bug fixes +- `poems` no longer depends on `geosphere`. I am hopeful that this will clear up the test failures on CRAN's m1mac. + # version 1.3.0 Every update is an enhancement this time around: diff --git a/cran-comments.md b/cran-comments.md index baee278..da0f4e6 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,7 +1,7 @@ ## Test environments -* local macOS (13.5) install, Intel chip, R 4.3.3 +* local macOS 15 install, Intel chip, R 4.4.1 * Windows, R-devel (via win-builder) -* macOS, Apple Silicon chip, R 4.3.3 (via mac-builder) +* macOS, Apple Silicon chip, R 4.4.1 (via mac-builder) ## R CMD check results @@ -9,7 +9,7 @@ ## Past R CMD check results -Previously, `poems` was archived due to some tests failing on certain Apple Silicon systems due to a dependency on `geosphere`. We have revised those tests so they will pass on Apple Silicon. Tests on CRAN's mac-builder are passing. +Previously, `poems` was archived due to some tests failing on certain Apple Silicon systems due to a dependency on `geosphere`. We have removed the dependency on `geosphere` altogether. Tests on CRAN's mac-builder are passing. `poems` has also been turned away from CRAN due to long vignette runtimes. I have cut down vignette runtime to a third of what it was previously, which should hopefully solve this issue. diff --git a/tests/testthat/test_dispersal_friction.R b/tests/testthat/test_dispersal_friction.R index 2e8b053..488164f 100644 --- a/tests/testthat/test_dispersal_friction.R +++ b/tests/testthat/test_dispersal_friction.R @@ -76,7 +76,7 @@ test_that("distance multiplier calculation errors", { "Distance multipliers calculation requires region/coordinates to be set first" ) # Dispersal indices incorrect or not consistent with coordinates - distance_matrix <- geosphere::distm(coordinates, coordinates, fun = geosphere::distGeo) + distance_matrix <- fossil::earth.dist(coordinates, dist = FALSE)*1000 dispersal_indices <- which(distance_matrix > 0 & distance_matrix <= 350000, arr.ind = TRUE) colnames(dispersal_indices) <- c("target_pop", "source_pop") dispersal_friction <- DispersalFriction$new( @@ -130,7 +130,7 @@ test_that("distance multiplier calculation errors", { test_that("distance multiplier calculations", { coordinates <- data.frame(x = rep(1:4, 4), y = rep(1:4, each = 4)) - distance_matrix <- fossil::earth.dist(coordinates) / 1000 + distance_matrix <- fossil::earth.dist(coordinates, dist = FALSE) dispersal_indices <- which(distance_matrix > 1 & distance_matrix <= 350, arr.ind = TRUE) colnames(dispersal_indices) <- c("target_pop", "source_pop") conductance_matrix <- array(1, c(16, 10)) @@ -209,7 +209,7 @@ test_that("distance multiplier calculations", { # No conductance values uses region raster set to 1 for non-NA values coordinates <- coordinates[-c(2, 5, 6), ] # isolate (1, 1) region <- Region$new(coordinates = coordinates) - distance_matrix <- geosphere::distm(coordinates, coordinates, fun = geosphere::distGeo) / 1000 + distance_matrix <- fossil::earth.dist(coordinates, dist = FALSE) dispersal_indices <- which(distance_matrix > 0 & distance_matrix <= 350, arr.ind = TRUE) colnames(dispersal_indices) <- c("target_pop", "source_pop") dispersal_friction <- DispersalFriction$new(region = region) diff --git a/tests/testthat/test_dispersal_generator.R b/tests/testthat/test_dispersal_generator.R index 823a755..12496e9 100644 --- a/tests/testthat/test_dispersal_generator.R +++ b/tests/testthat/test_dispersal_generator.R @@ -259,7 +259,6 @@ test_that("calculate distance data with dispersal friction object", { breaks = c(1, seq(100, 400, 20), Inf) )) } - distance_data_changes[[2]] <- distance_data_changes[[2]][-c(13, 179), ] # > Dmax in both t = 1 and 2 for (i in c(3, 5)) { # reverse changes distance_data_changes[[i]] <- distance_data_base[which(distance_multipliers[[i - 1]] != 1), ] } @@ -333,7 +332,7 @@ test_that("calculate dispersals with dispersal friction", { region = region, distance_classes = seq(100, 400, 20), proportion = 0.4, breadth = 110, max_distance = 300 ) - distance_matrix <- fossil::earth.dist(coordinates, dist = F) # km + distance_matrix <- fossil::earth.dist(coordinates[-c(2, 5, 6), ], dist = F) # km distance_matrix[which(distance_matrix < 1)] <- 0 # ensure actual zero distance for self-referenced cells dispersal_gen$calculate_distance_data(distance_matrix = distance_matrix) dispersal_gen$calculate_dispersals() @@ -383,7 +382,7 @@ test_that("cloning and generation", { dispersal_clone <- dispersal_gen$new_clone(breadth = 120) expect_true(dispersal_clone$generative_requirements_satisfied()[[1]]) expect_is(dispersal_clone$dispersal_data[[1]], "data.frame") # generated - expect_equal(dim(dispersal_clone$dispersal_data[[1]]), c(228, 5)) + expect_equal(dim(dispersal_clone$dispersal_data[[1]]), c(220, 5)) expect_null(dispersal_clone$error_messages) # Generation expect_equal( diff --git a/tests/testthat/test_population_dispersal_function.R b/tests/testthat/test_population_dispersal_function.R index 9b69dd8..87e4bff 100644 --- a/tests/testthat/test_population_dispersal_function.R +++ b/tests/testthat/test_population_dispersal_function.R @@ -549,7 +549,7 @@ test_that("density dependent dispersal", { distance_scale = 1000, distance_classes = seq(100, 400, 20) ) - distance_matrix <- fossil::earth.dist(coordinates, dist = F) + distance_matrix <- fossil::earth.dist(region$coordinates, dist = F) distance_matrix[which(distance_matrix < 1)] <- 0 # ensure actual zero distance for self-referenced cells dispersal_gen$calculate_distance_data(distance_matrix = distance_matrix) dispersal_gen$calculate_dispersals(type = "matrix") diff --git a/tests/testthat/test_spatial_correlation.R b/tests/testthat/test_spatial_correlation.R index 1b1505d..b1892ac 100644 --- a/tests/testthat/test_spatial_correlation.R +++ b/tests/testthat/test_spatial_correlation.R @@ -37,7 +37,7 @@ test_that("initialization and parameter setting", { test_that("calculate distance matrix", { # Latitude/longitude coordinates coordinates1 <- array(c(1:4, 4:1), c(7, 2)) - distance_matrix1 <- fossil::earth.dist(coordinates, dist = FALSE)*1000 + distance_matrix1 <- fossil::earth.dist(coordinates1, dist = FALSE)*1000 spatial_correlation <- SpatialCorrelation$new() expect_error( spatial_correlation$calculate_distance_matrix(),