Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
reference-hydrofabric
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Water Mission Area
nhgf
reference-hydrofabric
Commits
8b7cd770
Commit
8b7cd770
authored
2 years ago
by
Blodgett, David L.
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' into 'main'
WB inlet and Outlet fix See merge request
!155
parents
55880515
3d246372
No related branches found
No related tags found
1 merge request
!155
WB inlet and Outlet fix
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
workspace/02_NHD_navigate.Rmd
+2
-1
2 additions, 1 deletion
workspace/02_NHD_navigate.Rmd
workspace/06-2_aggregate_cats.Rmd
+1
-3
1 addition, 3 deletions
workspace/06-2_aggregate_cats.Rmd
workspace/R/NHD_navigate.R
+11
-7
11 additions, 7 deletions
workspace/R/NHD_navigate.R
with
14 additions
and
11 deletions
workspace/02_NHD_navigate.Rmd
+
2
−
1
View file @
8b7cd770
...
@@ -209,7 +209,8 @@ if(all(is.na(tmp_POIs$Type_WBOut))) {
...
@@ -209,7 +209,8 @@ if(all(is.na(tmp_POIs$Type_WBOut))) {
# Waterbody list that strictly meet the size criteria
# Waterbody list that strictly meet the size criteria
wb_lst <- st_drop_geometry(WBs_VPU_all) %>%
wb_lst <- st_drop_geometry(WBs_VPU_all) %>%
dplyr::filter(FTYPE %in% c("LakePond", "Reservoir") & AREASQKM >= (min_da_km/2)) %>%
dplyr::filter(FTYPE %in% c("LakePond", "Reservoir") & AREASQKM >= (min_da_km/2)) %>%
dplyr::select(COMID)
dplyr::select(COMID) %>%
filter(!COMID == 166410600)
if (file.exists(data_paths$resops_NID_CW)){
if (file.exists(data_paths$resops_NID_CW)){
# ResOpsUS locations in the VPU waterbody set
# ResOpsUS locations in the VPU waterbody set
...
...
This diff is collapsed.
Click to expand it.
workspace/06-2_aggregate_cats.Rmd
+
1
−
3
View file @
8b7cd770
...
@@ -64,14 +64,12 @@ if(needs_layer(out_agg_gpkg, agg_cats_layer)){
...
@@ -64,14 +64,12 @@ if(needs_layer(out_agg_gpkg, agg_cats_layer)){
type = rep("terminal", length(missing_outlets))))
type = rep("terminal", length(missing_outlets))))
write_sf(filter(reconciled, ID %in% missing_outlets), out_agg_gpkg, "missing_outlets")
write_sf(filter(reconciled, ID %in% missing_outlets), out_agg_gpkg, "missing_outlets")
outlets
_terms_fixed
<- outlets %>%
outlets <- outlets %>%
left_join(select(st_drop_geometry(reconciled), ID, toID), by = "ID") %>%
left_join(select(st_drop_geometry(reconciled), ID, toID), by = "ID") %>%
mutate(type = ifelse(type == "terminal" & !is.na(toID), "outlet", type)) %>%
mutate(type = ifelse(type == "terminal" & !is.na(toID), "outlet", type)) %>%
select(-toID)
select(-toID)
}
}
agg_cats <- aggregate_catchments(flowpath = reconciled,
agg_cats <- aggregate_catchments(flowpath = reconciled,
divide = divides,
divide = divides,
outlets = outlets,
outlets = outlets,
...
...
This diff is collapsed.
Click to expand it.
workspace/R/NHD_navigate.R
+
11
−
7
View file @
8b7cd770
...
@@ -998,13 +998,18 @@ WB_event <- function(WBs, nhd_wb, type){
...
@@ -998,13 +998,18 @@ WB_event <- function(WBs, nhd_wb, type){
inlet_ls
<-
inlet_FL
%>%
inlet_ls
<-
inlet_FL
%>%
group_by
(
LevelPathI
)
%>%
group_by
(
LevelPathI
)
%>%
summarize
(
do_union
=
T
)
st_cast
(
"POINT"
)
%>%
summarize
(
do_union
=
F
)
%>%
st_cast
(
"LINESTRING"
)
inlet_pnts
<-
sf
::
st_intersection
(
inlet_ls
,
WBs_layer
)
%>%
inlet_pnts
<-
sf
::
st_intersection
(
inlet_ls
,
WBs_layer
)
%>%
#group_by("LINESTRING") %>%
st_cast
(
"POINT"
)
%>%
st_cast
(
"POINT"
)
%>%
group_by
(
LevelPathI
)
%>%
st_as_sf
()
filter
(
row_number
()
==
min
(
row_number
()))
%>%
#mutate(row_id = row_number()) %>%
ungroup
()
#group_by(LevelPathI) %>%
#filter(row_id == min(row_id)) %>%
#ungroup()
wb_events
<-
get_flowline_index
(
nhd_wb
,
inlet_pnts
)
%>%
wb_events
<-
get_flowline_index
(
nhd_wb
,
inlet_pnts
)
%>%
inner_join
(
select
(
st_drop_geometry
(
nhd_wb
),
COMID
,
WBAREACOMI
,
LevelPathI
),
by
=
"COMID"
)
%>%
inner_join
(
select
(
st_drop_geometry
(
nhd_wb
),
COMID
,
WBAREACOMI
,
LevelPathI
),
by
=
"COMID"
)
%>%
...
@@ -1195,11 +1200,10 @@ wbin_POIcreation <- function(nhd, WBs_VPU, data_paths, crs, split_layer){
...
@@ -1195,11 +1200,10 @@ wbin_POIcreation <- function(nhd, WBs_VPU, data_paths, crs, split_layer){
tmp_POIs
,
"WBIn"
)
tmp_POIs
,
"WBIn"
)
wb_inlet_events
<-
filter
(
wb_inlet_events
,
!
COMID
%in%
wb_inlet_POIs
$
COMID
)
wb_inlet_events
<-
filter
(
wb_inlet_events
,
!
COMID
%in%
wb_inlet_POIs
$
COMID
)
if
(
nrow
(
wb_inlet_POIs
)
!=
nrow
(
wb_inlet_events
)){
if
(
nrow
(
wb_inlet_events
)
>
0
){
tmp_POIs
<-
data.table
::
rbindlist
(
list
(
tmp_POIs
,
tmp_POIs
<-
data.table
::
rbindlist
(
list
(
tmp_POIs
,
select
(
wb_inlet_events
,
COMID
,
Type_WBIn
=
WBAREACOMI
,
nexus
)
%>%
select
(
wb_inlet_events
,
COMID
,
Type_WBIn
=
WBAREACOMI
,
nexus
)),
fill
=
TRUE
)
%>%
filter
(
!
COMID
%in%
tmp_POIs
$
COMID
)),
fill
=
TRUE
)
%>%
st_as_sf
()
st_as_sf
()
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment