vignettes/articles/migrating_from_nhdplusTools.Rmd
migrating_from_nhdplusTools.RmdThis guide helps users switching from nhdplusTools to hydrogeofetch + hydroloom.
hydrogeofetch fetches and prepares NHD data. hydroloom does network analysis and spatial indexing. Users who did both now load both packages.
Functions that remain in hydrogeofetch unchanged:
get_nhdplus(), subset_nhdplus(),
get_vaa(), prepare_nhdplus(),
get_tocomid(), plot_nhdplus(),
navigate_nldi(), get_nldi_basin(), all
download functions, and get_drainage_area_estimates().
Before:
library(nhdplusTools)
comids <- get_UT(flowlines, start_comid)After:
library(hydroloom)
comids <- navigate_hydro_network(flowlines, start_comid, "UT")get_UM() and get_DM() had extra behavior:
they called align_nhdplus_names(), filtered the network,
and supported sort/include arguments returning
a COMID vector. To reproduce:
library(hydroloom)
library(hydrogeofetch)
network <- align_nhdplus_names(flowlines)
main_us <- network[network$COMID %in%
navigate_hydro_network(network, start_comid, "UM"), ]
# sort by Hydroseq if needed:
main_us <- main_us[order(main_us$Hydroseq), ]
# exclude start if needed:
main_us <- main_us[main_us$COMID != start_comid, ]
main_us$COMIDBefore:
idx <- get_flowline_index(flowlines, points, search_radius = 200)After:
idx <- hydroloom::index_points_to_lines(flowlines, points, search_radius = 200)Note: the old get_flowline_index() accepted
"download_nhdplusv2" as the first argument to auto-download
flowlines. With hydroloom, fetch the data first with
get_nhdplus(), then index.
Before:
library(nhdplusTools)
result <- st_compatibalize(x, y)After:
library(hydroloom)
result <- st_compatibalize(x, y)