diff --git a/DESCRIPTION b/DESCRIPTION index 79f3f5c..586b4af 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -33,6 +33,7 @@ Suggests: Kendall, knitr, rmarkdown, + sf, testthat (>= 3.0.0), tidyterra, withr, @@ -44,7 +45,6 @@ Imports: jsonlite, rappdirs, rlang, - sf, stringr, terra, tibble diff --git a/NAMESPACE b/NAMESPACE index 7b9540f..46cc800 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -24,3 +24,5 @@ export(cd_stac_catalog) export(cd_summary) export(cd_trend) export(cd_variables) +importFrom(rlang,.data) +importFrom(rlang,.env) diff --git a/R/cd-package.R b/R/cd-package.R index 0cc9deb..baa5ada 100644 --- a/R/cd-package.R +++ b/R/cd-package.R @@ -1,2 +1,3 @@ #' @keywords internal +#' @importFrom rlang .data .env "_PACKAGE" diff --git a/tests/testthat/test-cd_crop.R b/tests/testthat/test-cd_crop.R index d81c1d0..3a0d8a1 100644 --- a/tests/testthat/test-cd_crop.R +++ b/tests/testthat/test-cd_crop.R @@ -1,4 +1,5 @@ test_that("cd_crop returns cropped SpatRaster from sf AOI", { + skip_if_not_installed("sf") href <- system.file("extdata", "example_climate.tif", package = "cd") aoi <- sf::st_read( system.file("extdata", "example_aoi.gpkg", package = "cd"), @@ -23,6 +24,7 @@ test_that("cd_crop accepts SpatVector AOI", { }) test_that("cd_crop preserves band names", { + skip_if_not_installed("sf") href <- system.file("extdata", "example_climate.tif", package = "cd") aoi <- sf::st_read( system.file("extdata", "example_aoi.gpkg", package = "cd"), @@ -34,6 +36,7 @@ test_that("cd_crop preserves band names", { }) test_that("cd_crop with cache = TRUE passes a local href straight through", { + skip_if_not_installed("sf") href <- system.file("extdata", "example_climate.tif", package = "cd") aoi <- sf::st_read( system.file("extdata", "example_aoi.gpkg", package = "cd"), diff --git a/tests/testthat/test-cd_extract.R b/tests/testthat/test-cd_extract.R index 3eb56d8..85dea0b 100644 --- a/tests/testthat/test-cd_extract.R +++ b/tests/testthat/test-cd_extract.R @@ -1,4 +1,5 @@ test_that("cd_extract returns expected structure", { + skip_if_not_installed("sf") catalog <- cd_catalog( system.file("extdata", "example_catalog.json", package = "cd") ) @@ -17,6 +18,7 @@ test_that("cd_extract returns expected structure", { }) test_that("cd_extract values are numeric and non-NA", { + skip_if_not_installed("sf") catalog <- cd_catalog( system.file("extdata", "example_catalog.json", package = "cd") ) @@ -31,6 +33,7 @@ test_that("cd_extract values are numeric and non-NA", { }) test_that("cd_extract filters by years", { + skip_if_not_installed("sf") catalog <- cd_catalog( system.file("extdata", "example_catalog.json", package = "cd") ) @@ -45,6 +48,7 @@ test_that("cd_extract filters by years", { }) test_that("cd_extract cache = TRUE matches cache = FALSE for local COGs", { + skip_if_not_installed("sf") catalog <- cd_catalog( system.file("extdata", "example_catalog.json", package = "cd") ) @@ -59,6 +63,7 @@ test_that("cd_extract cache = TRUE matches cache = FALSE for local COGs", { }) test_that("cd_extract filters by variables", { + skip_if_not_installed("sf") catalog <- cd_catalog( system.file("extdata", "example_catalog.json", package = "cd") )