Skip to content
Snippets Groups Projects
Commit fc5fe2b0 authored by Blodgett, David L.'s avatar Blodgett, David L.
Browse files

remove unneeded attributes, fixes #126. add missing flowlines from burn line...

remove unneeded attributes, fixes #126. add missing flowlines from burn line event, fixes #125 fixes #123. Remove duplicate comid rows, fixes #124.
parent 07a0090c
No related branches found
No related tags found
1 merge request!171Clean up and fix issues in reference flowline creation
......@@ -27,8 +27,8 @@ fix_headwaters <- function(nhd_rds, out_gpkg, new_atts = NULL,
ble <- sf::st_zm(sf::st_as_sf(ble))
nhd <- sf::st_zm(nhd)
sf::st_geometry(nhd)[!sf::st_is_empty(sf::st_geometry(ble)) & (nhd$StartFlag == 1 | nhd$Divergence == 2)] <-
sf::st_geometry(ble)[!sf::st_is_empty(sf::st_geometry(ble)) & (nhd$StartFlag == 1 | nhd$Divergence == 2)]
sf::st_geometry(nhd)[!sf::st_is_empty(sf::st_geometry(ble)) & (nhd$StartFlag == 1)] <-
sf::st_geometry(ble)[!sf::st_is_empty(sf::st_geometry(ble)) & (nhd$StartFlag == 1)]
if(!is.null(new_atts)) {
new_atts <- data.table::fread(new_atts,
......@@ -109,6 +109,12 @@ fix_headwaters <- function(nhd_rds, out_gpkg, new_atts = NULL,
nhd <- select(nhd, -override_tocomid)
# remove remnant attributes
nhd <- select(nhd, -FromNode, -ToNode, -StartFlag -StreamCalc, -Divergence, -DnMinorHyd)
warning("naive duplication!")
nhd <- nhd[!duplicated(nhd$COMID), ]
sf::write_sf(nhd, out_gpkg, "reference_flowlines")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment