Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pkgdown #44

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading