From 90c7bc90404a0f285bcd6c7fc0a100f296f679ac Mon Sep 17 00:00:00 2001
From: David Blodgett <dblodgett@usgs.gov>
Date: Sat, 3 Dec 2022 20:43:36 -0600
Subject: [PATCH] rebuilt enhd files aith this bug fix for #118

---
 workspace/R/utils.R | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/workspace/R/utils.R b/workspace/R/utils.R
index 7ed0a6f..f7303cd 100644
--- a/workspace/R/utils.R
+++ b/workspace/R/utils.R
@@ -203,7 +203,11 @@ clean_net <- function(net, net_new, nwm) {
   
   # NOTE: just being explicit about this for clarity.
   candidate <- select(net_new, comid, tocomid, nwm_tocomid) %>%
-    filter(!comid %in% avoid)
+    filter(!comid %in% avoid) %>%
+    # only use nwm changes where they are reconnecting the network
+    # this is key since enhd changed the flow direction of some divergences
+    # and those changes would be lost if we do not use this filter
+    filter(tocomid == 0 & nwm_tocomid != 0)
   
   mismatch <- candidate[candidate$tocomid != candidate$nwm_tocomid, ]
   
-- 
GitLab