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

Merge branch 'main' into 'main'

updates to use new catchments

See merge request wma/nhgf/gfv2.0!129
parents ca94f002 2442e353
No related branches found
No related tags found
1 merge request!129updates to use new catchments
...@@ -39,7 +39,10 @@ out_rpu <- rep(list(list()), length(all_rpu_codes)) ...@@ -39,7 +39,10 @@ out_rpu <- rep(list(list()), length(all_rpu_codes))
names(out_rpu) <- all_rpu_codes names(out_rpu) <- all_rpu_codes
fline <- sf::read_sf(data_paths$ref_flowline) fline <- sf::read_sf(data_paths$ref_flowline)
catchment <- readRDS(staged_nhd$catchment)
fline <- sf::st_cast(fline, "LINESTRING")
catchment <- sf::read_sf(file.path(data_paths$nhdplus_dir, "reference_catchments.gpkg"))
for(VPU in vpu_codes) { for(VPU in vpu_codes) {
...@@ -77,6 +80,10 @@ for(VPU in vpu_codes) { ...@@ -77,6 +80,10 @@ for(VPU in vpu_codes) {
filter(RPUID %in% rpu_codes$rpuid) filter(RPUID %in% rpu_codes$rpuid)
cats <- catchment %>% cats <- catchment %>%
rename(FEATUREID = featureid,
AREASQKM = areasqkm,
RPUID = rpuid,
VPUID = vpuid) %>%
filter(FEATUREID %in% filter(FEATUREID %in%
unique(c(nhd$COMID, unique(c(nhd$COMID,
full_cat_table$FEATUREID[full_cat_table$RPUID %in% rpu_codes$rpuid]))) %>% full_cat_table$FEATUREID[full_cat_table$RPUID %in% rpu_codes$rpuid]))) %>%
......
...@@ -36,9 +36,6 @@ Load and filter source NHD Flowline network. ...@@ -36,9 +36,6 @@ Load and filter source NHD Flowline network.
cats <- read_sf(out_refac_gpkg, nhd_catchment) cats <- read_sf(out_refac_gpkg, nhd_catchment)
``` ```
Read POIs and add nhd outlets. Save to a non-spatial table. Read POIs and add nhd outlets. Save to a non-spatial table.
```{r refactor} ```{r refactor}
POIs <- read_sf(nav_gpkg, final_poi_layer) %>% POIs <- read_sf(nav_gpkg, final_poi_layer) %>%
......
...@@ -45,14 +45,6 @@ if(needs_layer(out_refac_gpkg, divide_layer)) { ...@@ -45,14 +45,6 @@ if(needs_layer(out_refac_gpkg, divide_layer)) {
distinct(.keep_all = T) distinct(.keep_all = T)
cats <- st_transform(read_sf(out_refac_gpkg, nhd_catchment), crs) cats <- st_transform(read_sf(out_refac_gpkg, nhd_catchment), crs)
st_precision(cats) <- 30 # meters
cats <- sf::st_simplify(cats, dTolerance = 0) %>%
st_cast("MULTIPOLYGON")
cats <- nhdplusTools:::check_valid(cats)
# Write out catchments to use in 06_non_dend
write_sf(cats, out_refac_gpkg, nhd_catchment)
divides <- reconcile_catchment_divides(catchment = cats, divides <- reconcile_catchment_divides(catchment = cats,
fline_ref = refactored, fline_ref = refactored,
......
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