Skip to content

Commit

Permalink
Merge pull request #7 from adamhsparks/example_data
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhsparks authored Dec 4, 2024
2 parents 00dc20b + a8ffd36 commit b694b34
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion R/get_agfd.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ get_agfd <- function(fixed_prices = TRUE,
#' @autoglobal
#' @noRd
print.read.abares.agfd.nc.files <- function(x, ...) {
cli::cli_h1("\nLocally Available ABARES AGFD NetCDF Files\n")
cli::cli_h1("Locally Available ABARES AGFD NetCDF Files")
cli::cli_ul(basename(x))
cat("\n")
invisible(x)
Expand Down
4 changes: 2 additions & 2 deletions R/get_soil_thickness.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ print.read.abares.soil.thickness.files <- function(x, ...) {
cli::cli_text("To see the full metadata, call
{.fn print_soil_thickness_metadata} on a soil thickness object in your R
session.")
cat("\n")
cli::cat_line()
invisible(x)
}

Expand Down Expand Up @@ -184,6 +184,6 @@ print_soil_thickness_metadata <- function(x) {
cli::cli_h1("Soil Thickness for Australian areas of intensive agriculture of Layer 1 (A Horizon - top-soil)\n")
cli::cli_h2("Dataset ANZLIC ID ANZCW1202000149")
cli::cli_text(x$metadata)
cat("\n")
cli::cat_line()
invisible(x)
}
2 changes: 1 addition & 1 deletion R/inspect_cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ inspect_cache <- function(recursive = FALSE) {
)
))
} else {
cli::cli_h1("\nLocally Available {{read.abares}} Cached Files\n")
cli::cli_h1("Locally Available {{read.abares}} Cached Files")
cli::cli_ul(basename(f))
}
}
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
},
"SystemRequirements": null
},
"fileSize": "327.717KB",
"fileSize": "327.685KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-get_aagis_regions.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ test_that("get_aagis_regions caches", {
expect_true(file.exists(
file.path(.find_user_cache(), "aagis_regions_dir/aagis.gpkg")
))
expect_true(!file.exists(
expect_false(file.exists(
file.path(.find_user_cache(), "aagis_regions_dir/aagis_zip")
))
expect_true(!file.exists(file.path(
expect_false(file.exists(file.path(
.find_user_cache(), "aagis_asgs16v1_g5a.*"
)))
})
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-get_abares_trade.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test_that("get_abares_trade caches", {
expect_true(file.exists(
file.path(.find_user_cache(), "abares_trade_dir/abares_trade.rds")
))
expect_true(!file.exists(
expect_false(file.exists(
file.path(.find_user_cache(), "abares_trade_dir/abares_trade.zip")
))
})
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-get_abares_trade_regions.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test_that("get_abares_trade_regions caches", {
expect_true(file.exists(
file.path(.find_user_cache(), "abares_trade_dir/abares_trade_regions.rds")
))
expect_true(!file.exists(
expect_false(file.exists(
file.path(.find_user_cache(), "abares_trade_dir/abares_trade_regions.csv")
))
})
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-get_agfd.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ test_that("get_agfd, fixed = TRUE works", {
agfd_nc <- list.files(agfd_nc_dir, full.names = TRUE)

nc_files <- function(agfd_nc_dir) {
cli::cli_h1("\nLocally Available ABARES AGFD NetCDF Files\n")
cli::cli_h1("Locally Available ABARES AGFD NetCDF Files")
cli::cli_ul(basename(list.files(agfd_nc_dir)))
cat("\n")
cli::cat_line()
}
print_out <- capture.output(nc_files)

Expand All @@ -32,9 +32,9 @@ test_that("get_agfd, fixed = FALSE works", {
agfd_nc <- list.files(agfd_nc_dir, full.names = TRUE)

nc_files <- function(agfd_nc_dir) {
cli::cli_h1("\nLocally Available ABARES AGFD NetCDF Files\n")
cli::cli_h1("Locally Available ABARES AGFD NetCDF Files")
cli::cli_ul(basename(list.files(agfd_nc_dir)))
cat("\n")
cli::cat_line()
}
print_out <- capture.output(nc_files)

Expand Down Expand Up @@ -88,9 +88,9 @@ test_that("print.read.abares.agfd.nc.files returns a properly formatted list",
skip_if_offline()
skip_on_ci()
print_out <- function(x) {
cli::cli_h1("\nLocally Available ABARES AGFD NetCDF Files\n")
cli::cli_h1("Locally Available ABARES AGFD NetCDF Files")
cli::cli_ul(basename(x))
cat("\n")
cli::cat_line()
}

x <- get_agfd(cache = TRUE)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-get_soil_thickness.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ test_that("print.read.abares.thickness.files prints metadata", {
cli::cli_text("To see the full metadata, call
{.fn print_soil_thickness_metadata} on a soil thickness object in your R
session.")
cat("\n")
cli::cat_line()
}
print_out <- capture.output(out_text())

Expand All @@ -101,7 +101,7 @@ test_that("print_soil_thickness_metadata prints full metadata", {
)
cli::cli_h2("Dataset ANZLIC ID ANZCW1202000149")
cli::cli_text(x$metadata)
cat("\n")
cli::cat_line()
}

x <- get_soil_thickness(cache = TRUE)
Expand Down
9 changes: 5 additions & 4 deletions tests/testthat/test-read_agfd_stars.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


test_that("read_agfd_stars() returns a stars object", {
skip_if_offline()
skip_on_ci()
Expand All @@ -7,8 +8,8 @@ test_that("read_agfd_stars() returns a stars object", {

expect_type(x, "list")
expect_s3_class(x[[1]], "stars")
expect_identical(
names(x),
expect_named(
x,
c(
"f2022.c1991.p2022.t2022.nc",
"f2022.c1992.p2022.t2022.nc",
Expand Down Expand Up @@ -45,8 +46,8 @@ test_that("read_agfd_stars() returns a stars object", {
"f2022.c2023.p2022.t2022.nc"
)
)
expect_identical(
names(x[[1]]),
expect_named(
x[[1]],
c(
"farmno",
"R_total_hat_ha",
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-read_agfd_terra.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ test_that("read_agfd_terra() returns a terra object", {

expect_type(x, "list")
expect_s4_class(x[[1]], "SpatRaster")
expect_identical(
names(x),
expect_named(
x,
c(
"f2022.c1991.p2022.t2022.nc",
"f2022.c1992.p2022.t2022.nc",
Expand Down Expand Up @@ -45,8 +45,8 @@ test_that("read_agfd_terra() returns a terra object", {
"f2022.c2023.p2022.t2022.nc"
)
)
expect_identical(
names(x[[1]]),
expect_named(
x[[1]],
c(
"farmno",
"R_total_hat_ha",
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-read_agfd_tidync.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ test_that("read_agfd_tidync() returns a tidync object", {

expect_type(x, "list")
expect_s3_class(x[[1]], "tidync")
expect_identical(
names(x),
expect_named(
x,
c(
"f2022.c1991.p2022.t2022.nc",
"f2022.c1992.p2022.t2022.nc",
Expand Down

0 comments on commit b694b34

Please sign in to comment.