Skip to content

Commit

Permalink
fix tests, roxygenize v0.15.4
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondben committed Jul 29, 2024
1 parent cd9cd75 commit f537aaf
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bowerbird
Type: Package
Title: Keep a Collection of Sparkly Data Resources
Version: 0.15.3
Version: 0.15.4
Authors@R: c(person("Ben", "Raymond", email = "ben.raymond@aad.gov.au", role = c("aut", "cre")),
person("Michael", "Sumner", role = "aut"),
person("Miles", "McBain", email = "miles.mcbain@gmail.com", role = c("rev", "ctb")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export(bb_handler_rget)
export(bb_handler_wget)
export(bb_install_wget)
export(bb_modify_source)
export(bb_oceandata_cleanup)
export(bb_rget)
export(bb_rget_default_downloads)
export(bb_settings)
Expand Down
2 changes: 1 addition & 1 deletion R/oceandata.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ bb_handler_oceandata_inner <- function(config, verbose = FALSE, local_dir_only =
out <- file.path(out, "L3BIN")
}
## time period, if it's specified in the search string
tp <- stringr::str_detect(src$method[[1]]$search, paste0("\\.", oceandata_alltp$abbrev, "\\."))
tp <- stringr::str_detect(search, paste0("\\.", oceandata_alltp$abbrev, "\\."))
if (sum(tp, na.rm = TRUE) == 1) {
out <- file.path(out, oceandata_alltp$time_period[which(tp)])
}
Expand Down
20 changes: 20 additions & 0 deletions man/bb_oceandata_cleanup.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions tests/testthat/test_oceandata.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test_that("bb_handler_oceandata works",{
data_group="Sea surface temperature")
temp_root <- tempdir()
ocf <- bb_add(bb_config(local_file_root=temp_root),ods)
expect_true(grepl("oceandata.sci.gsfc.nasa.gov/MODIST/Mapped$",bb_data_source_dir(ocf)))
expect_true(grepl("oceandata.sci.gsfc.nasa.gov/MODIST/Mapped/Monthly/9km$",bb_data_source_dir(ocf)))
bb_sync(ocf, confirm_downloads_larger_than = NULL)
fnm <- "oceandata.sci.gsfc.nasa.gov/MODIST/Mapped/Monthly/9km/par/TERRA_MODIS.20000301_20000331.L3m.MO.PAR.par.9km.nc" ## relative file name
expect_true(file.exists(file.path(temp_root,fnm)))
Expand Down Expand Up @@ -59,7 +59,7 @@ test_that("other oceandata handler tests", {
user = "", password = "", warn_empty_auth = FALSE)
temp_root <- tempdir()
ocf <- bb_add(bb_config(local_file_root = temp_root), ods)
expect_true(grepl("oceandata.sci.gsfc.nasa.gov/MODISA/L3BIN$", bb_data_source_dir(ocf)))
expect_true(grepl("oceandata.sci.gsfc.nasa.gov/MODISA/L3BIN/Daily$", bb_data_source_dir(ocf)))

ods <- bb_source(name="Oceandata VIIRS Level-3 binned daily RRS",
id="VIIRS_L3b_DAY_SNPP_RRS",
Expand All @@ -70,7 +70,7 @@ test_that("other oceandata handler tests", {
method=list("bb_handler_oceandata", search = "SNPP_VIIRS*L3b.DAY.RRS.nc", sensor = "viirs", dtype = "L3b"),
user = "", password = "", warn_empty_auth = FALSE)
ocf <- bb_add(bb_config(local_file_root = temp_root), ods)
expect_true(grepl("oceandata.sci.gsfc.nasa.gov/VIIRS/L3BIN$", bb_data_source_dir(ocf)))
expect_true(grepl("oceandata.sci.gsfc.nasa.gov/VIIRS/L3BIN/Daily$", bb_data_source_dir(ocf)))

ods <- bb_source(name="Oceandata MODIS Aqua Level-3 mapped daily 4km chl-a",
id="MODISA_L3m_DAY_CHL_chlor_a_4km",
Expand All @@ -81,7 +81,7 @@ test_that("other oceandata handler tests", {
method=list("bb_handler_oceandata",search="AQUA_MODIS*L3m.DAY.CHL.chlor_a.4km.nc", sensor = "aqua", dtype = "L3m"),
user = "", password = "", warn_empty_auth = FALSE)
ocf <- bb_add(bb_config(local_file_root = temp_root), ods)
expect_true(grepl("oceandata.sci.gsfc.nasa.gov/MODISA/Mapped$", bb_data_source_dir(ocf)))
expect_true(grepl("oceandata.sci.gsfc.nasa.gov/MODISA/Mapped/Daily/4km$", bb_data_source_dir(ocf)))

ods <- bb_source(name="Oceandata SeaWiFS Level-3 binned daily RRS",
id="SeaWiFS_L3b_DAY_RRS",
Expand All @@ -92,7 +92,7 @@ test_that("other oceandata handler tests", {
method=list("bb_handler_oceandata",search="SEASTAR_SEAWIFS_GAC*L3b.DAY.RRS.nc", sensor = "seawifs", dtype = "L3b"),
user = "", password = "", warn_empty_auth = FALSE)
ocf <- bb_add(bb_config(local_file_root = temp_root), ods)
expect_true(grepl("oceandata.sci.gsfc.nasa.gov/SeaWiFS/L3BIN$", bb_data_source_dir(ocf)))
expect_true(grepl("oceandata.sci.gsfc.nasa.gov/SeaWiFS/L3BIN/Daily$", bb_data_source_dir(ocf)))
})

test_that("bb_handler_oceandata works when no files match",{
Expand Down

0 comments on commit f537aaf

Please sign in to comment.