lindsayplatt / episodic-river-salinization-model

Modeling code in a targets pipeline for understanding characteristics of rivers that experience episodic salinization from winter road salting events.
1 stars 0 forks source link

NHDPlusV21_NationalData_Seamless_Geodatabase_Lower48_07.7z mismatched nodes #27

Closed hdugan closed 1 week ago

hdugan commented 1 week ago

Periodically, flowline nodes are mismatched in NHDPlusV21_NationalData_Seamless_Geodatabase_Lower48_07.7z

For example, comid 15671767 should join to comid 15671815 but ToNode and FromNode do not match. Therefore our code does not return any upstream comids.

 get_sorted(p6_huc_flowlines_network_tbl, outlets = 15671815, split=TRUE) %>% 
    dplyr::select(nhd_comid = terminalID, 
                  nhd_comid_upstream = comid)

However, identify_upstream_comids(comid_in = 15671815) does work. I don't know how this dataretrieval code works (ie. how is it doing it's mapping?) This uses:

navigate_nldi(
  list(featureSource = "comid",
       featureID = 15671765),
  mode = "upstreamTributaries",
  distance_km = 1000) %>% 
  pluck('UT_flowlines', 'nhdplus_comid') %>%
  as.integer()

Potentially ~10,000 mismatched nodes?

hdugan commented 1 week ago

This was obvious when mapping some watersheds (big gaps). Fig4_predict_map_15634575

hdugan commented 1 week ago

Solved: When loading the flowline gdb, we filtered for Area > 0. There are some very small segments with Area = 0. Keeping these in and re-running.