Skip to content
Snippets Groups Projects
Commit 1d1c1003 authored by Bock, Andy's avatar Bock, Andy
Browse files

Mods to event handling

parent 93a25616
No related branches found
No related tags found
1 merge request!160Mods to addType
......@@ -22,6 +22,7 @@ knitr::opts_chunk$set(
source("R/utils.R")
source("R/NHD_navigate.R")
source("R/hyrefactor_funs.R")
source("../hyfabric/R/poi_creation.R")
# increase timeout for data downloads
options(timeout=600)
......@@ -150,7 +151,7 @@ if(all(is.na(tmp_POIs$Type_TE))) {
# Derive TE POIs
tmp_POIs <- POI_creation(st_drop_geometry(TE_COMIDs), filter(nhd, dend == 1), "TE") %>%
addType(., tmp_POIs, "TE")
addType(., tmp_POIs, "TE")
# As a fail-safe, write out list of TE plants not assigned a POI
if(nrow(filter(TE_COMIDs, !COMID %in% tmp_POIs$COMID)) > 0) {
......@@ -184,7 +185,7 @@ if(all(is.na(tmp_POIs$Type_Term))) {
select(COMID, LevelPathI)
tmp_POIs <- POI_creation(terminal_POIs, nhd, "Term") %>%
addType(., tmp_POIs, "Term")
addType(., tmp_POIs, "Term")
write_sf(tmp_POIs, temp_gpkg, nav_poi_layer)
} else {
......@@ -301,7 +302,7 @@ if(all(is.na(tmp_POIs$Type_Conf))) {
select(COMID, Type_Conf)
tmp_POIs <- POI_creation(conf_COMIDs, filter(nhd, minNet == 1), "Conf") %>%
addType(., tmp_POIs, "Conf")
addType(., tmp_POIs, "Conf")
write_sf(nhd, nav_gpkg, nhd_flowline)
write_sf(tmp_POIs, temp_gpkg, nav_poi_layer)
......@@ -327,7 +328,7 @@ if(all(is.na(tmp_POIs$Type_NID))) {
# Derive NID POIs
tmp_POIs <- POI_creation(NID_COMIDs, filter(nhd, dend ==1), "NID") %>%
addType(., tmp_POIs, "NID", bind = FALSE)
addType(., tmp_POIs, "NID", nexus = TRUE, bind = FALSE)
# Write out geopackage layer representing POIs for given theme
write_sf(tmp_POIs, temp_gpkg, nav_poi_layer)
......@@ -343,10 +344,8 @@ mapview(filter(tmp_POIs, Type_NID != ""), layer.name = "NID POIs", col.regions =
# Derive or load Waterbody POIs ----------------------
if(all(is.na(tmp_POIs$Type_WBIn))) {
wbout_COMIDs <- filter(tmp_POIs, !is.na(Type_WBOut))
wb_layers <- wbin_POIcreation(nhd, WBs_VPU, data_paths, crs, split_layer, wbout_COMIDs)
tmp_POIs <- addType(wb_layers$POIs, tmp_POIs, "WBIn")
wb_layers <- wbin_POIcreation(nhd, WBs_VPU, data_paths, crs, split_layer, tmp_POIs)
tmp_POIs <- wb_layers$POIs
if(!all(is.na(wb_layers$events))) {
wb_inlet_events <- select(wb_layers$events, -c(id, offset, Hydroseq, ToMeas)) %>%
......@@ -482,7 +481,7 @@ if(all(is.na(tmp_POIs$Type_Travel))) {
unique()
tmp_POIs <- POI_creation(select(tt_POIs, COMID, Type_Travel), nhd, "Travel") %>%
addType(., tmp_POIs, "Travel")
addType(., tmp_POIs, "Travel")
write_sf(tmp_POIs, temp_gpkg, nav_poi_layer)
}else{
......
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