Skip to content

Commit

Permalink
Merge pull request #44 from DOI-USGS/pkgdown
Browse files Browse the repository at this point in the history
Pkgdown
  • Loading branch information
dblodgett-usgs committed Aug 26, 2024
2 parents 5558acc + 19bdd66 commit 6579240
Show file tree
Hide file tree
Showing 209 changed files with 298 additions and 1,728 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ hydroloom 1.1.0
- Add support for upmain and downmain in `make_index_ids()` and `make_fromids()`.
- Add function tp create a "flownetwork" representation of the network with a `to_flownetwork` function.
- Improved handling / fix bugs with edge cases in `add_toids()`
- Improved error conditions when missing suggested packages.
- `navigate_hydro_network()` will now navigate from a diverted path to a main path where it previously only followed traditional tributaries..

hydroloom 1.0.1 and 1.0.2
==========
Expand Down
21 changes: 16 additions & 5 deletions R/navigation_network.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ required_atts_navigate <- function(mode, distance) {
DM = c(id, levelpath, dn_levelpath,
topo_sort, dn_topo_sort),
UT = c(id, levelpath,
topo_sort, dn_topo_sort, dn_minor_topo_sort),
topo_sort, dn_topo_sort),
DD = c(id, levelpath, dn_levelpath,
topo_sort, dn_topo_sort, dn_minor_topo_sort))

Expand Down Expand Up @@ -116,6 +116,15 @@ navigate_hydro_network.hy <- function(x, start, mode, distance = NULL) {
"DD" = get_DD
)

if(mode == "UT") {
if(dn_minor_topo_sort %in% names(x)) {
required_atts <- c(required_atts, dn_minor_topo_sort)
} else {
# TODO: for a future release, remove this and add dn_minor_topo_sort to required at top of this file
warning(dn_minor_topo_sort, " will be a required attribute for UT navigation in a future release.")
}
}

fun(select(st_drop_geometry(x), all_of(required_atts)),
start, distance)

Expand All @@ -141,12 +150,14 @@ get_UT <- function(x, id, distance) {
all <- filter(x, .data$pathlength_km <= stop_pathlength_km)$id
}

incoming_div <- filter(x, !id %in% all &
dn_minor_topo_sort %in% x$topo_sort[x$id %in% all])
if(dn_minor_topo_sort %in% names(x)) {
incoming_div <- filter(x, !id %in% all &
dn_minor_topo_sort %in% x$topo_sort[x$id %in% all])

extra <- lapply(incoming_div$id, \(i) get_UT(x, i, distance))
extra <- lapply(incoming_div$id, \(i) get_UT(x, i, distance))

all <- c(all, unique(unlist(extra)))
all <- c(all, unique(unlist(extra)))
}

return(all)

Expand Down
10 changes: 4 additions & 6 deletions docs/404.html

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

8 changes: 4 additions & 4 deletions docs/CONTRIBUTING.html

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

Loading

0 comments on commit 6579240

Please sign in to comment.