Skip to content

Commit 082c7e9

Browse files
Merge pull request #473 from DOI-USGS/hydrogeofetch
Hydrogeofetch
2 parents 2164354 + 4587c4f commit 082c7e9

600 files changed

Lines changed: 549021 additions & 17218 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.Rbuildignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@ CLAUDE.md
2929
dev
3030
.claude
3131
inst/build
32-
vignettes/drainage_area_figures
3332
PLAN.md
33+
^tests/testthat/fixtures$
34+
^vignettes/articles$
35+
^\.kiro$

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ CLAUDE.md
2323
dev
2424
vignettes/*.html
2525
vignettes/*_figures/
26+
vignettes/articles/*.html
27+
vignettes/articles/*_figures/
28+
vignettes/articles/*_files/
29+
.kiro/

.gitlab-ci.yml

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,60 @@ variables:
22
_R_CHECK_CRAN_INCOMING_: "false"
33
_R_CHECK_FORCE_SUGGESTS_: "true"
44
_R_CHECK_DONTTEST_EXAMPLES_: "false"
5-
APT_PKGS: "p7zip-full"
5+
_R_CHECK_RD_XREFS_: "false"
66

7-
before_script:
8-
- wget --no-check-certificate -O /usr/local/share/ca-certificates/DOIRootCA2.crt https://raw.githubusercontent.com/dblodgett-usgs/hydrogeoenv/master/linux/DOIRootCA2.cer
9-
- chmod 644 /usr/local/share/ca-certificates/DOIRootCA2.crt && update-ca-certificates
10-
- apt-get update
11-
- apt-get install -y --no-install-recommends ${APT_PKGS}
12-
- apt-get install -y --no-install-recommends qpdf pandoc
13-
- export PATH="/usr/local/lib/R/site-library/littler/examples/:${PATH}"
14-
- echo "options(Ncpus = $(nproc --all))" >> /usr/local/lib/R/etc/Rprofile.site
15-
- install2.r devtools
16-
- r -e 'devtools::install_dev_deps()'
7+
stages:
8+
- check
9+
- build
10+
- verify
1711

18-
test:
19-
stage: test
12+
workflow:
13+
rules:
14+
- if: $CI_COMMIT_BRANCH =~ /^rc\//
15+
16+
.r-base:
2017
tags:
2118
- chs-shared
2219
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/rocker/geospatial:latest
20+
before_script:
21+
- wget --no-check-certificate -O /usr/local/share/ca-certificates/DOIRootCA2.crt https://raw.githubusercontent.com/dblodgett-usgs/hydrogeoenv/master/linux/DOIRootCA2.cer
22+
- chmod 644 /usr/local/share/ca-certificates/DOIRootCA2.crt && update-ca-certificates
23+
- apt-get update
24+
- apt-get install -y --no-install-recommends p7zip-full qpdf pandoc curl
25+
- export PATH="/usr/local/lib/R/site-library/littler/examples/:${PATH}"
26+
- echo "options(Ncpus = $(nproc --all))" >> /usr/local/lib/R/etc/Rprofile.site
27+
- r -e 'pak::local_install_dev_deps()'
28+
29+
check:
30+
extends: .r-base
31+
stage: check
32+
script:
33+
- R CMD build --no-build-vignettes --no-manual .
34+
- R CMD check --no-tests --no-examples --no-vignettes --no-manual *.tar.gz
35+
artifacts:
36+
paths:
37+
- "*.Rcheck"
38+
when: always
39+
40+
build:
41+
extends: .r-base
42+
stage: build
43+
script:
44+
- R CMD build .
45+
- PKG_FILE=$(ls *.tar.gz)
46+
- PKG_NAME=$(echo "$PKG_FILE" | sed 's/_.*//')
47+
- PKG_VERSION=$(echo "$PKG_FILE" | sed 's/.*_\(.*\)\.tar\.gz/\1/')
48+
- 'curl --silent --show-error --write-out "\nHTTP status: %{http_code}\n" --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "$PKG_FILE" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PKG_NAME}/${PKG_VERSION}/${PKG_FILE}"'
49+
artifacts:
50+
paths:
51+
- "*.tar.gz"
52+
53+
verify:
54+
extends: .r-base
55+
stage: verify
2356
script:
24-
- r -e 'devtools::check(check_dir = ".")'
25-
- r -e 'capture.output(print(covr::coverage_to_list(covr::package_coverage(type = "all")), width = 20), file = "covr.txt", split = TRUE)'
57+
- R CMD check --as-cran --no-manual *.tar.gz
2658
artifacts:
2759
paths:
2860
- "*.Rcheck"
29-
- "covr.txt"
61+
when: always

DESCRIPTION

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
Package: nhdplusTools
1+
Package: hydrogeofetch
22
Type: Package
3-
Title: NHDPlus Tools
4-
Version: 1.5.0
3+
Title: Hydrologic Geospatial Fabric Extraction Tool Chain
4+
Version: 2.0.0
55
Authors@R: c(person(given = "David",
66
family = "Blodgett",
77
role = c("aut", "cre"),
88
email = "dblodgett@usgs.gov",
99
comment = c(ORCID = "0000-0001-9489-1710")),
1010
person(given = "Mike",
1111
family = "Johnson",
12-
role = "aut",
12+
role = "ctb",
1313
comment = c(ORCID = "0000-0002-5288-8350")),
1414
person(given = "Marc",
1515
family = "Weber",
@@ -23,18 +23,19 @@ Authors@R: c(person(given = "David",
2323
family = "Koenig",
2424
role = "ctb",
2525
comment = c(ORCID = "0000-0002-7790-330X")))
26-
Description: Tools for traversing and working with National Hydrography Dataset Plus (NHDPlus) data. All methods implemented in 'nhdplusTools' are available in the NHDPlus documentation available from the US Environmental Protection Agency <https://www.epa.gov/waterdata/basic-information>.
26+
Description: Tools for traversing and working with National Hydrography Dataset Plus (NHDPlus) data. All methods implemented in 'hydrogeofetch' are available in the NHDPlus documentation available from the US Environmental Protection Agency <https://www.epa.gov/waterdata/basic-information>. Previously published as 'nhdplusTools'.
2727
URL: https://doi-usgs.github.io/nhdplusTools/ https://github.com/doi-usgs/nhdplusTools/
2828
BugReports: https://github.com/doi-usgs/nhdplusTools/issues/
2929
Depends:
3030
R (>= 4.1)
31-
Imports: hydroloom, dataRetrieval, dplyr, sf, units, magrittr, jsonlite, httr, xml2, R.utils, utils, tidyr, methods, maptiles, mapsf, fst, arrow, tools, zip, pbapply, memoise, digest
32-
Suggests: testthat, knitr, rmarkdown, ggmap, ggplot2, lwgeom, gifski, leaflet, httptest, future, future.apply, StreamCatTools, terra
31+
Imports: hydroloom, dataRetrieval, dplyr, sf, units, jsonlite, httr2, xml2, utils, data.table, methods, arrow, tools, zip, memoise, digest
32+
Suggests: testthat, knitr, rmarkdown, ggmap, ggplot2, lwgeom, gifski, leaflet, httptest2, StreamCatTools, terra, maptiles, mapsf
3333
License: CC0
3434
Encoding: UTF-8
35-
RoxygenNote: 7.3.3
3635
VignetteBuilder: knitr
3736
Config/testthat/parallel: true
3837
Config/testthat/edition: 3
3938
LazyData: true
39+
LazyDataCompression: xz
4040
Language: en-US
41+
Config/roxygen2/version: 8.0.0

NAMESPACE

Lines changed: 12 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Generated by roxygen2: do not edit by hand
22

3-
export(add_plus_network_attributes)
3+
export(add_mainstems)
44
export(align_nhdplus_names)
5-
export(calculate_arbolate_sum)
6-
export(calculate_total_drainage_area)
7-
export(disambiguate_flowline_indexes)
5+
export(check_mainstems)
86
export(discover_geoconnex_reference)
97
export(discover_nhdplus_id)
108
export(download_nhd)
@@ -13,72 +11,53 @@ export(download_nhdplusv2)
1311
export(download_rf1)
1412
export(download_vaa)
1513
export(download_wbd)
16-
export(fix_flowdir)
1714
export(get_3dhp)
18-
export(get_DD)
19-
export(get_DM)
20-
export(get_UM)
21-
export(get_UT)
2215
export(get_boundaries)
2316
export(get_catchment_characteristics)
2417
export(get_characteristics_metadata)
2518
export(get_drainage_area_estimates)
2619
export(get_elev_along_path)
27-
export(get_flowline_index)
2820
export(get_gagesII)
2921
export(get_geoconnex_reference)
3022
export(get_hr_data)
3123
export(get_huc)
32-
export(get_hydro_location)
33-
export(get_levelpaths)
3424
export(get_nhdarea)
3525
export(get_nhdphr)
3626
export(get_nhdplus)
3727
export(get_nhdplushr)
3828
export(get_nldi_basin)
3929
export(get_nldi_feature)
4030
export(get_nldi_index)
41-
export(get_node)
4231
export(get_nwis)
43-
export(get_partial_length)
44-
export(get_path_lengths)
45-
export(get_path_members)
46-
export(get_pathlength)
47-
export(get_pfaf)
4832
export(get_raindrop_trace)
49-
export(get_sorted)
5033
export(get_split_catchment)
51-
export(get_streamlevel)
52-
export(get_streamorder)
53-
export(get_terminal)
5434
export(get_tocomid)
5535
export(get_vaa)
5636
export(get_vaa_names)
5737
export(get_vaa_path)
5838
export(get_waterbodies)
59-
export(get_waterbody_index)
6039
export(get_wb_outlet)
6140
export(get_xs_point)
6241
export(get_xs_points)
63-
export(make_node_topology)
42+
export(hydrogeofetch_cache_settings)
43+
export(hydrogeofetch_data_dir)
6444
export(make_standalone)
6545
export(map_nhdplus)
66-
export(navigate_network)
6746
export(navigate_nldi)
68-
export(nhdplusTools_cache_settings)
69-
export(nhdplusTools_data_dir)
7047
export(nhdplus_path)
7148
export(plot_nhdplus)
7249
export(prepare_nhdplus)
73-
export(rename_geometry)
7450
export(rescale_catchment_characteristics)
75-
export(rescale_measures)
76-
export(st_compatibalize)
7751
export(subset_nhdplus)
7852
export(subset_rpu)
7953
export(subset_vpu)
54+
export(update_mainstems)
8055
importFrom(arrow,open_dataset)
56+
importFrom(arrow,read_csv_arrow)
8157
importFrom(arrow,s3_bucket)
58+
importFrom(arrow,write_parquet)
59+
importFrom(data.table,as.data.table)
60+
importFrom(data.table,dcast)
8261
importFrom(dataRetrieval,findNLDI)
8362
importFrom(digest,digest)
8463
importFrom(dplyr,across)
@@ -87,6 +66,7 @@ importFrom(dplyr,any_of)
8766
importFrom(dplyr,arrange)
8867
importFrom(dplyr,bind_rows)
8968
importFrom(dplyr,collect)
69+
importFrom(dplyr,contains)
9070
importFrom(dplyr,desc)
9171
importFrom(dplyr,distinct)
9272
importFrom(dplyr,everything)
@@ -102,48 +82,25 @@ importFrom(dplyr,select)
10282
importFrom(dplyr,starts_with)
10383
importFrom(dplyr,summarize)
10484
importFrom(dplyr,ungroup)
105-
importFrom(fst,metadata_fst)
106-
importFrom(fst,read.fst)
10785
importFrom(graphics,par)
108-
importFrom(httr,GET)
109-
importFrom(httr,RETRY)
110-
importFrom(httr,content)
111-
importFrom(httr,progress)
112-
importFrom(httr,write_disk)
113-
importFrom(hydroloom,accumulate_downstream)
114-
importFrom(hydroloom,add_levelpaths)
115-
importFrom(hydroloom,add_pathlength)
116-
importFrom(hydroloom,add_pfafstetter)
117-
importFrom(hydroloom,add_streamlevel)
118-
importFrom(hydroloom,add_streamorder)
86+
importFrom(httr2,req_perform)
87+
importFrom(httr2,request)
11988
importFrom(hydroloom,add_toids)
12089
importFrom(hydroloom,disambiguate_indexes)
121-
importFrom(hydroloom,fix_flowdir)
12290
importFrom(hydroloom,get_hydro_location)
12391
importFrom(hydroloom,get_node)
124-
importFrom(hydroloom,get_partial_length)
125-
importFrom(hydroloom,hy)
12692
importFrom(hydroloom,index_points_to_lines)
127-
importFrom(hydroloom,index_points_to_waterbodies)
128-
importFrom(hydroloom,make_fromids)
129-
importFrom(hydroloom,make_index_ids)
130-
importFrom(hydroloom,navigate_connected_paths)
13193
importFrom(hydroloom,navigate_hydro_network)
13294
importFrom(hydroloom,navigate_network_dfs)
13395
importFrom(hydroloom,rename_geometry)
13496
importFrom(hydroloom,rescale_measures)
13597
importFrom(hydroloom,sort_network)
136-
importFrom(hydroloom,st_compatibalize)
13798
importFrom(jsonlite,fromJSON)
138-
importFrom(magrittr,`%>%`)
13999
importFrom(memoise,cache_filesystem)
140100
importFrom(memoise,cache_memory)
141101
importFrom(memoise,memoise)
142102
importFrom(methods,as)
143103
importFrom(methods,is)
144-
importFrom(pbapply,pbapply)
145-
importFrom(pbapply,pblapply)
146-
importFrom(pbapply,pboptions)
147104
importFrom(sf,"st_geometry<-")
148105
importFrom(sf,read_sf)
149106
importFrom(sf,st_area)
@@ -171,12 +128,8 @@ importFrom(sf,st_union)
171128
importFrom(sf,st_zm)
172129
importFrom(sf,write_sf)
173130
importFrom(stats,weighted.mean)
174-
importFrom(tidyr,contains)
175-
importFrom(tidyr,pivot_wider)
176-
importFrom(tidyr,replace_na)
177131
importFrom(tools,R_user_dir)
178132
importFrom(units,set_units)
179-
importFrom(utils,combn)
180133
importFrom(utils,download.file)
181134
importFrom(utils,read.delim)
182135
importFrom(utils,tail)

NEWS.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
hydrogeofetch 2.0.0
2+
==========
3+
4+
`hydrogeofetch` is the renamed successor to `nhdplusTools`. The package scope has grown beyond NHDPlus, and the new name reflects its broader role as a hydrologic geospatial data access and network tool chain. `nhdplusTools` will remain on CRAN as a deprecation shim until October 2028.
5+
6+
## New features
7+
8+
- New `add_mainstems()` joins geoconnex mainstem identifiers onto a table containing NHDPlusV2 (comid/featureid) or NHDPlusHR (nhdplusid) identifiers, using a cached lookup table from the [ref_rivers](https://github.com/internetofwater/ref_rivers) release. #469
9+
- New `check_mainstems()` checks whether mainstem identifiers have been superseded by a newer reference release; new `update_mainstems()` re-indexes points with a known mainstem id onto its replacement using `hydroloom::index_points_to_lines()`. #470
10+
11+
## Removed functions (moved to hydroloom)
12+
13+
Network analysis and spatial indexing functions that duplicated [hydroloom](https://doi-usgs.github.io/hydroloom/) have been removed. Users should call hydroloom directly. See the [hydroloom reference](https://doi-usgs.github.io/hydroloom/reference/) for full documentation, especially the [indexing](https://doi-usgs.github.io/hydroloom/reference/index.html#indexing-and-linear-referencing) and [navigation](https://doi-usgs.github.io/hydroloom/reference/index.html#network-navigation-and-accumulation) sections.
14+
15+
- `get_flowline_index()``hydroloom::index_points_to_lines()`
16+
- `get_waterbody_index()``hydroloom::index_points_to_waterbodies()`
17+
- `disambiguate_flowline_indexes()``hydroloom::disambiguate_indexes()`
18+
- `get_UT()`, `get_DD()``hydroloom::navigate_hydro_network(x, start, "UT")` / `"DD"`
19+
- `get_UM()`, `get_DM()``hydroloom::navigate_hydro_network(x, start, "UM")` / `"DM"` (note: the old wrappers also ran `align_nhdplus_names`, filtered, and supported `sort`/`include` arguments)
20+
- `navigate_network()` — workflow glue; use `navigate_nldi()` + `subset_nhdplus()` or hydroloom navigation directly
21+
- `get_sorted()``hydroloom::sort_network()`
22+
- `get_pathlength()``hydroloom::add_pathlength()`
23+
- `get_streamorder()``hydroloom::add_streamorder()`
24+
- `get_streamlevel()``hydroloom::add_streamlevel()`
25+
- `get_levelpaths()``hydroloom::add_levelpaths()`
26+
- `get_pfaf()``hydroloom::add_pfafstetter()`
27+
- `get_terminal()``hydroloom::sort_network(x, split = TRUE)`
28+
- `calculate_total_drainage_area()``hydroloom::accumulate_downstream(x, "area")`
29+
- `calculate_arbolate_sum()``hydroloom::accumulate_downstream(x, "length")`
30+
- `get_path_members()`, `get_path_lengths()``hydroloom::navigate_connected_paths()`
31+
- `make_node_topology()``hydroloom::make_node_topology()`
32+
- `add_plus_network_attributes()` → use hydroloom's `add_levelpaths()`, `add_pathlength()`, `accumulate_downstream()` etc. directly
33+
34+
## Removed re-exports
35+
36+
These hydroloom functions are no longer re-exported; call `hydroloom::fn()` directly:
37+
38+
- `st_compatibalize()`, `rename_geometry()`, `get_node()`, `fix_flowdir()`, `rescale_measures()`, `get_hydro_location()`, `get_partial_length()`
39+
40+
## Dependency changes
41+
42+
- Removed `pbapply` from Imports (no longer needed)
43+
- Removed `future`, `future.apply` from Suggests (no longer needed)
44+
145
nhdplusTools 1.5.0
246
==========
347

0 commit comments

Comments
 (0)