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

MR cleanup, vpu/VPU to vpu_codes

parent e42149ba
No related branches found
No related tags found
1 merge request!169Updates through 07_merge
......@@ -13,26 +13,23 @@ rpu_vpu_out <- readr::read_csv("cache/rpu_vpu_out.csv",
col_types = c("c", "c", "i" , "i"), show_col_types = FALSE)
if(nchar(Sys.getenv("HYDREG")) > 1) {
VPU <- Sys.getenv("HYDREG")
vpu_codes <- Sys.getenv("HYDREG")
}
if(!exists("rpu_code")) {
if(exists("VPU")) {
vpu <- VPU
rpu_codes <- rpu_vpu[rpu_vpu$vpuid %in% vpu, ]
if(exists("vpu_codes")) {
rpu_codes <- rpu_vpu[rpu_vpu$vpuid %in% vpu_codes, ]
rpu_code <- rpu_codes$rpuid[1]
} else {
vpu <- get_rpu_dependent_vars()
rpu_code <- vpu$r
vpu <- vpu$v
rpu_codes <- rpu_vpu[rpu_vpu$vpuid %in% vpu, ]
vpu_codes <- VPU <- vpu
vpu_codes <- get_rpu_dependent_vars()
rpu_code <- vpu_codes$r
vpu_codes <- vpu_codes$v
rpu_codes <- rpu_vpu[rpu_vpu$vpuid %in% vpu_codes, ]
}
}
if(!exists("vpu")) {
vpu <- get_rpu_dependent_vars(rpu_code)$v
vpu_codes <- VPU <- vpu
if(!exists("vpu_codes")) {
vpu_codes <- get_rpu_dependent_vars(rpu_code)$v
}
if(!nchar(out_agg_gpkg <- Sys.getenv("OUT_GPKG")) > 5)
......@@ -48,7 +45,7 @@ if(!nchar(lookup_table_file <- Sys.getenv("LOOKUP_TABLE")) > 5)
lookup_table_file <- file.path("cache", paste0(rpu_code, "_lookup.csv"))
if(!nchar(vpu_lookup_table_file <- Sys.getenv("VPU_LOOKUP_TABLE")) > 5)
vpu_lookup_table_file <- file.path("cache", paste0("lookup_", vpu, ".csv"))
vpu_lookup_table_file <- file.path("cache", paste0("lookup_", vpu_codes, ".csv"))
options(scipen = 9999)
......@@ -89,13 +86,13 @@ poi_dar_move <- .05 # maximum proportional drainage area difference to collapse
# Intermediate layers created during 02_Navigate
xwalk_layer <- paste0("HUC12_nhd") # HUC12 - nhdcat crosswalk, built in Nav for VPU 20
nav_poi_layer <- paste0("POIs_tmp_", vpu) # Rolling Nav POI layer added to/modified througout nav workflow
WBs_layer <- paste0("WB_", vpu) # Waterbodies within VPU
WB_events_layer <- paste0("WB_events_", vpu) # inlet and outlet events for NHDArea and HR waterbodies
poi_moved_layer <- paste0("POIs_mv_", vpu) # POIs moved from original COMID assignment
nsegments_layer <- paste0("nsegment_", vpu) # Minimally-sufficient network dissolved by POI_ID
pois_all_layer <- paste0("POIs_", vpu) # All POIs binded together
poi_xwalk_layer <- paste0("poi_xwalk_layer_", vpu) # POIs that changed COMIDS during the navigate part of the workflow
nav_poi_layer <- paste0("POIs_tmp_", vpu_codes) # Rolling Nav POI layer added to/modified througout nav workflow
WBs_layer <- paste0("WB_", vpu_codes) # Waterbodies within VPU
WB_events_layer <- paste0("WB_events_", vpu_codes) # inlet and outlet events for NHDArea and HR waterbodies
poi_moved_layer <- paste0("POIs_mv_", vpu_codes) # POIs moved from original COMID assignment
nsegments_layer <- paste0("nsegment_", vpu_codes) # Minimally-sufficient network dissolved by POI_ID
pois_all_layer <- paste0("POIs_", vpu_codes) # All POIs binded together
poi_xwalk_layer <- paste0("poi_xwalk_layer_", vpu_codes) # POIs that changed COMIDS during the navigate part of the workflow
final_poi_layer <- "POIs"
dup_pois <- "dup_POIs"
......@@ -135,13 +132,13 @@ catchment_network_table <- "catchment_network"
CAC_thresh <- 0.66 # Coefficient of areal correspondence threshold
# output geopackage file names
ref_gpkg <- file.path(data_paths$ref_fab_directory, paste0(vpu, "_reference_features.gpkg"))
nav_gpkg <- file.path("cache", paste0("reference_", vpu,".gpkg"))
temp_gpkg <- file.path("cache", paste0("nav_", vpu,".gpkg"))
ref_gpkg <- file.path(data_paths$ref_fab_path, paste0(vpu_codes, "_reference_features.gpkg"))
nav_gpkg <- file.path("cache", paste0("reference_", vpu_codes,".gpkg"))
temp_gpkg <- file.path("cache", paste0("nav_", vpu_codes,".gpkg"))
rfc_gpkg <- file.path("cache", paste0("refactor_", vpu, ".gpkg"))
rfc_gpkg <- file.path("cache", paste0("refactor_", vpu_codes, ".gpkg"))
gf_gpkg <- file.path("cache", paste0("GF_", vpu, ".gpkg"))
gf_gpkg <- file.path("cache", paste0("GF_", vpu_codes, ".gpkg"))
gf_gpkg_conus <- "cache/reference_CONUS.gpkg"
gage_info_gpkg <- "cache/Gages_info.gpkg"
......@@ -149,7 +146,7 @@ gage_info_csv <- "cache/Gages_info.csv"
gage_info_csvt <- "cache/Gages_info.csvt"
# Defined during NonDend.Rmd
ND_gpkg <- file.path("temp", paste0("ND_", vpu,".gpkg"))
ND_gpkg <- file.path("temp", paste0("ND_", vpu_codes,".gpkg"))
divides_xwalk <- "divides_nhd"
HRU_layer <- "all_cats"
......
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