Skip to content

Commit

Permalink
Merge pull request #362 from dblodgett-usgs/main
Browse files Browse the repository at this point in the history
remove web responses with 0 rows - fixes #361
  • Loading branch information
dblodgett-usgs authored Oct 10, 2023
2 parents 20cafb6 + bdf1f5f commit 02c4889
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: nhdplusTools
Type: Package
Title: NHDPlus Tools
Version: 1.0.0
Version: 1.0.1
Authors@R: c(person(given = "David",
family = "Blodgett",
role = c("aut", "cre"),
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
nhdplusTools 1.0.1
==========

- fixed bug with large nhdplus downloads with empty tiles. #361

nhdplusTools 1.0.0
==========

Expand Down
6 changes: 6 additions & 0 deletions R/geoserver_tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ unify_types <- function(out) {
}
}
}

rows <- sapply(out, nrow)

if(any(rows > 0))
out <- out[rows > 0]

out
}

Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test_02_subset_extras.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,14 @@ test_that("extras", {
expect_equal(nhdplusTools:::get_empty("MULTIPOINT"), sf::st_multipoint())
expect_error(nhdplusTools:::get_empty("BORKED"), "unexpected geometry type")
})

test_that("unify_types", {

check <- list(data.frame(), data.frame(one = 1, two = "2"), data.frame(one = "1", two = 2))

out <- nhdplusTools:::unify_types(check)

expect_equal(out,
list(structure(list(one = 1, two = 2), row.names = c(NA, -1L), class = "data.frame"),
structure(list(one = 1, two = 2), row.names = c(NA, -1L), class = "data.frame")))
})
2 changes: 2 additions & 0 deletions tests/testthat/test_get_vaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

test_that("vaa examples", {
skip_on_cran()
testthat::skip_on_os("linux")

vaa_names <- get_vaa_names()

Expand Down Expand Up @@ -35,6 +36,7 @@ test_that("vaa examples", {
test_that("catchment chars", {

skip_on_cran()
testthat::skip_on_os("linux")

httptest::without_internet({
suppressMessages(expect_warning(w <- get_characteristics_metadata(cache = FALSE)))
Expand Down

0 comments on commit 02c4889

Please sign in to comment.