Skip to content

Commit 0b6bf91

Browse files
Clear the two standing R CMD check NOTEs
Import the .data and .env pronouns from rlang, which code used unqualified, and move sf from Imports to Suggests: no R code calls it, and cd_crop() only checks inherits(aoi, "sf") before terra::vect(), which loads sf itself. Tests that read their AOI with sf::st_read() now skip without sf. Fixes #111 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GignjoKpZADXywTf6pAMgj
1 parent da4b8c1 commit 0b6bf91

5 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎DESCRIPTION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Suggests:
3333
Kendall,
3434
knitr,
3535
rmarkdown,
36+
sf,
3637
testthat (>= 3.0.0),
3738
tidyterra,
3839
withr,
@@ -44,7 +45,6 @@ Imports:
4445
jsonlite,
4546
rappdirs,
4647
rlang,
47-
sf,
4848
stringr,
4949
terra,
5050
tibble

‎NAMESPACE‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ export(cd_stac_catalog)
2424
export(cd_summary)
2525
export(cd_trend)
2626
export(cd_variables)
27+
importFrom(rlang,.data)
28+
importFrom(rlang,.env)

‎R/cd-package.R‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#' @keywords internal
2+
#' @importFrom rlang .data .env
23
"_PACKAGE"

‎tests/testthat/test-cd_crop.R‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
test_that("cd_crop returns cropped SpatRaster from sf AOI", {
2+
skip_if_not_installed("sf")
23
href <- system.file("extdata", "example_climate.tif", package = "cd")
34
aoi <- sf::st_read(
45
system.file("extdata", "example_aoi.gpkg", package = "cd"),
@@ -23,6 +24,7 @@ test_that("cd_crop accepts SpatVector AOI", {
2324
})
2425

2526
test_that("cd_crop preserves band names", {
27+
skip_if_not_installed("sf")
2628
href <- system.file("extdata", "example_climate.tif", package = "cd")
2729
aoi <- sf::st_read(
2830
system.file("extdata", "example_aoi.gpkg", package = "cd"),
@@ -34,6 +36,7 @@ test_that("cd_crop preserves band names", {
3436
})
3537

3638
test_that("cd_crop with cache = TRUE passes a local href straight through", {
39+
skip_if_not_installed("sf")
3740
href <- system.file("extdata", "example_climate.tif", package = "cd")
3841
aoi <- sf::st_read(
3942
system.file("extdata", "example_aoi.gpkg", package = "cd"),

‎tests/testthat/test-cd_extract.R‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
test_that("cd_extract returns expected structure", {
2+
skip_if_not_installed("sf")
23
catalog <- cd_catalog(
34
system.file("extdata", "example_catalog.json", package = "cd")
45
)
@@ -17,6 +18,7 @@ test_that("cd_extract returns expected structure", {
1718
})
1819

1920
test_that("cd_extract values are numeric and non-NA", {
21+
skip_if_not_installed("sf")
2022
catalog <- cd_catalog(
2123
system.file("extdata", "example_catalog.json", package = "cd")
2224
)
@@ -31,6 +33,7 @@ test_that("cd_extract values are numeric and non-NA", {
3133
})
3234

3335
test_that("cd_extract filters by years", {
36+
skip_if_not_installed("sf")
3437
catalog <- cd_catalog(
3538
system.file("extdata", "example_catalog.json", package = "cd")
3639
)
@@ -45,6 +48,7 @@ test_that("cd_extract filters by years", {
4548
})
4649

4750
test_that("cd_extract cache = TRUE matches cache = FALSE for local COGs", {
51+
skip_if_not_installed("sf")
4852
catalog <- cd_catalog(
4953
system.file("extdata", "example_catalog.json", package = "cd")
5054
)
@@ -59,6 +63,7 @@ test_that("cd_extract cache = TRUE matches cache = FALSE for local COGs", {
5963
})
6064

6165
test_that("cd_extract filters by variables", {
66+
skip_if_not_installed("sf")
6267
catalog <- cd_catalog(
6368
system.file("extdata", "example_catalog.json", package = "cd")
6469
)

0 commit comments

Comments
 (0)