vignettes/sugar_creek_refactor.Rmd
sugar_creek_refactor.Rmd
Source dependencies and set up a bunch of files.
library(nhdplusTools)
#> USGS Support Package: https://owi.usgs.gov/R/packages.html#support
library(hyRefactor)
#> USGS Support Package: https://owi.usgs.gov/R/packages.html#support
library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
library(tidyr)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(hygeo)
src_gpkg <- system.file("gpkg/sugar_creek_fort_mill.gpkg", package = "hygeo")
fdr_tif <- system.file("tiff/sugar_creek_fort_mill_fdr.tif", package = "hygeo")
fac_tif <- system.file("tiff/sugar_creek_fort_mill_fac.tif", package = "hygeo")
collapsed <- tempfile(fileext = ".gpkg")
refactored_small <- tempfile(fileext = ".gpkg")
reconciled <- tempfile(fileext = ".gpkg")
reconciled_small <- tempfile(fileext = ".gpkg")
unlink(c(collapsed, refactored_small, reconciled, reconciled_small), force = TRUE)
catchment_prefix <- "cat-"
waterbody_prefix <- "fp-"
nexus_prefix <- "nex-"
Now we will get some data and just plot up our area of interest.
options("rgdal_show_exportToProj4_warnings"="none")
nhd <- nhdplusTools::plot_nhdplus(list(9731454),
gpkg = src_gpkg,
overwrite = FALSE,
nhdplus_data = src_gpkg)
#> Found invalid geometry, attempting to fix.
#> Found invalid geometry, attempting to fix.
#> Zoom: 10
#> Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL.
#> Audotdetect projection: assuming Google Mercator (epsg 3857)
For this demonstration we’ll just use NWIS Sites as they exist. Here we go grab upstream with tributaries NWIS Sites and index them to the network. This is all placeholder for doing this using a more formal process for selection of network locations.
nwis <- nhdplusTools::navigate_nldi(list(featureSource = "comid",
featureID = 9731454),
mode = "UT",
data_source = "nwissite",
distance_km = 9999)
if(is.list(nwis)) {
nwis <- nwis$UT_nwissite
}
what_nwis_data <- dataRetrieval::whatNWISdata(siteNumber = gsub("USGS-", "", nwis$identifier))
nwis_sites <- filter(what_nwis_data, parm_cd == "00060" & data_type_cd == "uv") %>%
st_as_sf(coords = c("dec_long_va", "dec_lat_va"),
crs = 4269) %>%
st_transform(5070)
nwis_sites <- bind_cols(nwis_sites,
left_join(data.frame(id = seq_len(nrow(nwis_sites))),
nhdplusTools::get_flowline_index(
st_transform(nhd$flowline, 5070),
nwis_sites, search_radius = 50), by = "id")) %>%
filter(!is.na(COMID)) %>%
st_sf() %>%
select(site_no, COMID, REACHCODE, REACH_meas, offset) %>%
left_join(select(st_drop_geometry(nhd$flowline), COMID, FromMeas, ToMeas), by = "COMID")
# Check if we have catchment polygons for all our gage outlets.
all(nwis_sites$COMID %in% nhd$catchment$FEATUREID)
#> [1] TRUE
# only chose sites that are 1/4 or more up the catchment.
split_sites <- nwis_sites %>%
filter((100 * (REACH_meas - FromMeas) / (ToMeas - FromMeas)) > params$gage_tolerance)
nwis_sites$split <- nwis_sites$site_no %in% split_sites$site_no
nhdplusTools::plot_nhdplus(list(9731454),
gpkg = src_gpkg,
overwrite = FALSE,
nhdplus_data = src_gpkg,
actually_plot = TRUE)
#> Found invalid geometry, attempting to fix.
#> Found invalid geometry, attempting to fix.
#> Zoom: 10
#> Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL.
#> Audotdetect projection: assuming Google Mercator (epsg 3857)
plot(st_transform(nwis_sites$geometry, 3857), pch = 24, bg = "darkgrey", add = TRUE)
hyRefactor::refactor_nhdplus(nhd$flowline,
split_flines_meters = params$split_m,
split_flines_cores = 2,
collapse_flines_meters = params$collapse_m,
collapse_flines_main_meters = params$collapse_m,
out_refactored = collapsed,
out_reconciled = reconciled,
three_pass = TRUE,
purge_non_dendritic = FALSE,
events = split_sites)
#> Warning in prepare_nhdplus(., 0, 0, 0, purge_non_dendritic =
#> purge_non_dendritic, : Got NHDPlus data without a Terminal catchment. Attempting
#> to find it.
#> Warning in prepare_nhdplus(., 0, 0, 0, purge_non_dendritic = purge_non_dendritic, : Removed 0 flowlines that don't apply.
#> Includes: Coastlines, non-dendritic paths,
#> and networks with drainage area less than 0 sqkm, and drainage basins smaller than 0
#> flowlines split complete, collapsing
#> Writing layer `file5dd4108a6355' to data source `C:\Users\DBLODG~1\AppData\Local\Temp\1\RtmpId2WUy\file5dd4108a6355.gpkg' using driver `GPKG'
#> options: OVERWRITE=YES
#> Writing 143 features with 11 fields and geometry type Line String.
#> collapse complete, out collapse written to disk, reconciling
#> Writing layer `file5dd48de5ed9' to data source `C:\Users\DBLODG~1\AppData\Local\Temp\1\RtmpId2WUy\file5dd48de5ed9.gpkg' using driver `GPKG'
#> options: OVERWRITE=YES
#> Writing 90 features with 7 fields and geometry type Line String.
collapse <- sf::read_sf(collapsed)
reconcile <- sf::read_sf(reconciled)
slope <- select(st_drop_geometry(reconcile), ID, member_COMID) %>%
mutate(member_COMID = strsplit(member_COMID, ",")) %>%
unnest(cols = member_COMID) %>%
mutate(member_COMID = floor(as.numeric(member_COMID))) %>%
left_join(select(st_drop_geometry(nhd$flowline), COMID, slope),
by = c("member_COMID" = "COMID")) %>%
group_by(ID) %>%
summarise(slope = mean(slope))
#> `summarise()` ungrouping output (override with `.groups` argument)
reconcile <- left_join(reconcile, slope, by = "ID")
nwis_sites <- left_join(nwis_sites,
select(st_drop_geometry(collapse), event_REACHCODE, split_COMID = COMID),
by = c("REACHCODE" = "event_REACHCODE"))
nwis_sites$local_id <-
sapply(seq_len(nrow(nwis_sites)),
function(x, nwis_sites) {
if(!is.na(nwis_sites$split_COMID[x])) {
checker <- nwis_sites$split_COMID[x]
} else {
checker <- as.character(nwis_sites$COMID[x])
}
id <- reconcile[grepl(checker,
reconcile$member_COMID), ]
if(nrow(id) > 1) {
id <- filter(id, Hydroseq == min(Hydroseq))
}
paste0(waterbody_prefix, id$ID)
}, nwis_sites = nwis_sites)
nwis_sites <- select(nwis_sites, -split, -split_COMID)
fdr <- raster::raster(fdr_tif)
fac <- raster::raster(fac_tif)
crs <- raster::crs(fdr)
nhd$catchment <- sf::st_transform(nhd$catchment, crs)
reconcile <- sf::st_transform(sf::st_sf(reconcile), crs)
collapse <- sf::st_transform(sf::st_sf(collapse), crs)
sf::st_precision(nhd$catchment) <- 30
reconcile_divides <- hyRefactor::reconcile_catchment_divides(nhd$catchment,
fdr = fdr,
fac = fac,
fline_ref = collapse,
fline_rec = reconcile,
para = 1)
#> Loading required namespace: rgeos
network_order <- dplyr::select(sf::st_drop_geometry(nhd$flowline), COMID, Hydroseq)
nwis_lookup <- dplyr::select(sf::st_drop_geometry(nwis_sites),
site_no, local_id) %>%
dplyr::mutate(local_id = gsub(waterbody_prefix, catchment_prefix, local_id))
nhd_crosswalk <- c(get_nhd_crosswalk(reconcile, catchment_prefix, network_order, nwis_lookup),
get_nhd_crosswalk(reconcile, waterbody_prefix, network_order, nwis_lookup))
We can now pass reconciled divides into the hygeo package functions to generate catchment areas, waterbodies, and nexuses.
nexus <- get_nexus(reconcile,
nexus_prefix = nexus_prefix)
catchment_edge_list <- get_catchment_edges(reconcile,
catchment_prefix = catchment_prefix,
nexus_prefix = nexus_prefix)
waterbody_edge_list <- get_waterbody_edge_list(reconcile,
waterbody_prefix = waterbody_prefix)
sqkm_per_sqm <- 1 / 1000^2
reconcile_divides$area_sqkm <- as.numeric(st_area(st_transform(reconcile_divides, 5070))) * sqkm_per_sqm
catchment_data <- get_catchment_data(reconcile_divides,
catchment_edge_list,
catchment_prefix = catchment_prefix)
reconcile <- dplyr::rename(reconcile, length_km = LENGTHKM)
flowpath_data <- get_flowpath_data(reconcile,
waterbody_edge_list,
catchment_prefix = waterbody_prefix) %>%
mutate(realized_catchment = gsub(waterbody_prefix,
catchment_prefix, ID))
nexus_data <- get_nexus_data(nexus,
catchment_edge_list)
mapview::mapview(catchment_data, layer.name = "Catchment Area", col.regions = "tan") +
mapview::mapview(flowpath_data, layer.name = "Flowpaths", color = "blue") +
mapview::mapview(nexus_data, layer.name = "Nexuses", cex = 3, color = "yellow4", col.regions = "yellow4") +
mapview::mapview(nwis_sites, layer.name = "NWIS Sites", cex = 6, color = "darkgrey", col.regions = "grey")
The outputs can be rendered into csv or json:
hygeo_list <- list(catchment = catchment_data,
flowpath = flowpath_data,
nexus = nexus_data,
catchment_edges = catchment_edge_list,
waterbody_edges = waterbody_edge_list)
class(hygeo_list) <- "hygeo"
out_path <- params$out_path
dir.create(out_path, recursive = TRUE, showWarnings = FALSE)
out_path <- write_hygeo(hygeo_list, out_path = out_path, edge_map = TRUE, overwrite = TRUE)
nhd_crosswalk <- lapply(nhd_crosswalk, function(x) {
out <- list(COMID = x$COMID, outlet_COMID = jsonlite::unbox(x$outlet_COMID))
if(!is.null(x$site_no)) {
out <- c(out, list(site_no = jsonlite::unbox(x$site_no)))
}
out
})
jsonlite::write_json(nhd_crosswalk, file.path(out_path, "crosswalk.json"),
pretty = TRUE, auto_unbox = FALSE)
(hygeo_list_read <- read_hygeo(out_path))
#> $catchment
#> Simple feature collection with 90 features and 3 fields
#> geometry type: MULTIPOLYGON
#> dimension: XY
#> bbox: xmin: -81.01073 ymin: 34.99056 xmax: -80.6473 ymax: 35.31445
#> geographic CRS: WGS 84
#> # A tibble: 90 x 4
#> id area_sqkm toid geometry
#> <chr> <dbl> <chr> <MULTIPOLYGON [°]>
#> 1 cat-52 18.1 nex-32 (((-80.92989 35.19063, -80.93001 35.19079, -80.93117~
#> 2 cat-1 11.2 nex-65 (((-80.95556 35.18335, -80.95659 35.18419, -80.95781~
#> 3 cat-18 5.17 nex-83 (((-80.78387 35.16191, -80.78403 35.16206, -80.78464~
#> 4 cat-44 2.21 nex-75 (((-80.76158 35.2144, -80.76273 35.21363, -80.76402 ~
#> 5 cat-8 0.438 nex-65 (((-80.93941 35.18507, -80.94011 35.18567, -80.93959~
#> 6 cat-17 11.2 nex-30 (((-80.89513 35.10984, -80.89523 35.1102, -80.89546 ~
#> 7 cat-34 12.1 nex-22 (((-80.86944 35.06659, -80.8701 35.06761, -80.87132 ~
#> 8 cat-19 15.4 nex-87 (((-80.8725 35.00046, -80.87429 35.00082, -80.87673 ~
#> 9 cat-27 1.82 nex-21 (((-80.89313 35.06234, -80.89585 35.064, -80.89817 3~
#> 10 cat-22 9.39 nex-87 (((-80.88475 35.02839, -80.88514 35.02875, -80.88587~
#> # ... with 80 more rows
#>
#> $flowpath
#> Simple feature collection with 90 features and 6 fields
#> geometry type: LINESTRING
#> dimension: XY
#> bbox: xmin: -80.9998 ymin: 35.00016 xmax: -80.66058 ymax: 35.30738
#> geographic CRS: WGS 84
#> # A tibble: 90 x 7
#> id length_km slope_percent main_id toid realized_catchm~
#> <chr> <dbl> <dbl> <int> <chr> <chr>
#> 1 fp-1 3.93 0.00518 58 fp-65 cat-1
#> 2 fp-2 10.1 0.00610 74 fp-3 cat-2
#> 3 fp-3 7.43 0.00154 16 fp-87 cat-3
#> 4 fp-4 9.67 0.00115 16 fp-3 cat-4
#> 5 fp-5 0.551 0.0132 49 fp-14 cat-5
#> 6 fp-6 2.80 0.00696 28 fp-3 cat-6
#> 7 fp-7 1.09 0.00239 45 fp-3 cat-7
#> 8 fp-8 0.206 0.00001 84 fp-65 cat-8
#> 9 fp-9 2.84 0.00001 53 fp-29 cat-9
#> 10 fp-10 3.57 0.00653 75 fp-21 cat-10
#> # ... with 80 more rows, and 1 more variable: geometry <LINESTRING [°]>
#>
#> $nexus
#> Simple feature collection with 45 features and 2 fields
#> geometry type: POINT
#> dimension: XY
#> bbox: xmin: -80.9777 ymin: 35.00016 xmax: -80.71308 ymax: 35.28691
#> geographic CRS: WGS 84
#> # A tibble: 45 x 3
#> id toid geometry
#> <chr> <chr> <POINT [°]>
#> 1 nex-65 cat-65 (-80.93949 35.18483)
#> 2 nex-3 cat-3 (-80.94817 35.06374)
#> 3 nex-87 cat-87 (-80.90946 35.01792)
#> 4 nex-14 cat-14 (-80.9777 35.04557)
#> 5 nex-29 cat-29 (-80.90107 35.08629)
#> 6 nex-21 cat-21 (-80.90722 35.06921)
#> 7 nex-4 cat-4 (-80.95742 35.09442)
#> 8 nex-69 cat-69 (-80.81283 35.0765)
#> 9 nex-77 cat-77 (-80.76566 35.24378)
#> 10 nex-30 cat-30 (-80.89567 35.10979)
#> # ... with 35 more rows
#>
#> $catchment_edges
#> id toid
#> 1 cat-1 nex-65
#> 2 cat-2 nex-3
#> 3 cat-3 nex-87
#> 4 cat-4 nex-3
#> 5 cat-5 nex-14
#> 6 cat-6 nex-3
#> 7 cat-7 nex-3
#> 8 cat-8 nex-65
#> 9 cat-9 nex-29
#> 10 cat-10 nex-21
#> 11 cat-11 nex-4
#> 12 cat-12 nex-3
#> 13 cat-13 nex-14
#> 14 cat-14 nex-3
#> 15 cat-15 nex-69
#> 16 cat-16 nex-77
#> 17 cat-17 nex-30
#> 18 cat-18 nex-83
#> 19 cat-19 nex-87
#> 20 cat-20 nex-27
#> 21 cat-21 nex-87
#> 22 cat-22 nex-87
#> 23 cat-23 nex-22
#> 24 cat-24 nex-23
#> 25 cat-25 nex-71
#> 26 cat-26 nex-25
#> 27 cat-27 nex-21
#> 28 cat-28 nex-73
#> 29 cat-29 nex-21
#> 30 cat-30 nex-29
#> 31 cat-31 nex-30
#> 32 cat-32 nex-31
#> 33 cat-33 nex-71
#> 34 cat-34 nex-22
#> 35 cat-35 nex-22
#> 36 cat-36 nex-22
#> 37 cat-37 nex-69
#> 38 cat-38 nex-69
#> 39 cat-39 nex-23
#> 40 cat-40 nex-24
#> 41 cat-41 nex-71
#> 42 cat-42 nex-83
#> 43 cat-43 nex-34
#> 44 cat-44 nex-75
#> 45 cat-45 nex-73
#> 46 cat-46 nex-20
#> 47 cat-47 nex-27
#> 48 cat-48 nex-79
#> 49 cat-49 nex-87
#> 50 cat-50 nex-81
#> 51 cat-51 nex-33
#> 52 cat-52 nex-32
#> 53 cat-53 nex-77
#> 54 cat-54 nex-28
#> 55 cat-55 nex-28
#> 56 cat-56 nex-62
#> 57 cat-57 nex-61
#> 58 cat-58 nex-61
#> 59 cat-59 nex-81
#> 60 cat-60 nex-81
#> 61 cat-61 nex-62
#> 62 cat-62 nex-89
#> 63 cat-63 nex-64
#> 64 cat-64 nex-4
#> 65 cat-65 nex-66
#> 66 cat-66 nex-31
#> 67 cat-67 nex-68
#> 68 cat-68 nex-71
#> 69 cat-69 nex-70
#> 70 cat-70 nex-22
#> 71 cat-71 nex-72
#> 72 cat-72 nex-24
#> 73 cat-73 nex-74
#> 74 cat-74 nex-20
#> 75 cat-75 nex-76
#> 76 cat-76 nex-73
#> 77 cat-77 nex-78
#> 78 cat-78 nex-75
#> 79 cat-79 nex-80
#> 80 cat-80 nex-89
#> 81 cat-81 nex-82
#> 82 cat-82 nex-79
#> 83 cat-83 nex-84
#> 84 cat-84 nex-34
#> 85 cat-85 nex-86
#> 86 cat-86 nex-73
#> 87 cat-87 nex-88
#> 88 cat-88 nex-0
#> 89 cat-89 nex-90
#> 90 cat-90 nex-32
#> 91 nex-65 cat-65
#> 92 nex-3 cat-3
#> 93 nex-87 cat-87
#> 94 nex-14 cat-14
#> 95 nex-29 cat-29
#> 96 nex-21 cat-21
#> 97 nex-4 cat-4
#> 98 nex-69 cat-69
#> 99 nex-77 cat-77
#> 100 nex-30 cat-30
#> 101 nex-83 cat-83
#> 102 nex-27 cat-27
#> 103 nex-22 cat-22
#> 104 nex-23 cat-23
#> 105 nex-71 cat-71
#> 106 nex-25 cat-25
#> 107 nex-73 cat-73
#> 108 nex-31 cat-31
#> 109 nex-24 cat-24
#> 110 nex-34 cat-34
#> 111 nex-75 cat-75
#> 112 nex-20 cat-20
#> 113 nex-79 cat-79
#> 114 nex-81 cat-81
#> 115 nex-33 cat-33
#> 116 nex-32 cat-32
#> 117 nex-28 cat-28
#> 118 nex-62 cat-62
#> 119 nex-61 cat-61
#> 120 nex-89 cat-89
#> 121 nex-64 cat-64
#> 122 nex-66 cat-66
#> 123 nex-68 cat-68
#> 124 nex-70 cat-70
#> 125 nex-72 cat-72
#> 126 nex-74 cat-74
#> 127 nex-76 cat-76
#> 128 nex-78 cat-78
#> 129 nex-80 cat-80
#> 130 nex-82 cat-82
#> 131 nex-84 cat-84
#> 132 nex-86 cat-86
#> 133 nex-88 cat-88
#> 134 nex-0 cat-0
#> 135 nex-90 cat-90
#>
#> $waterbody_edges
#> id toid
#> 1 fp-1 fp-65
#> 2 fp-2 fp-3
#> 3 fp-3 fp-87
#> 4 fp-4 fp-3
#> 5 fp-5 fp-14
#> 6 fp-6 fp-3
#> 7 fp-7 fp-3
#> 8 fp-8 fp-65
#> 9 fp-9 fp-29
#> 10 fp-10 fp-21
#> 11 fp-11 fp-4
#> 12 fp-12 fp-3
#> 13 fp-13 fp-14
#> 14 fp-14 fp-3
#> 15 fp-15 fp-69
#> 16 fp-16 fp-77
#> 17 fp-17 fp-30
#> 18 fp-18 fp-83
#> 19 fp-19 fp-87
#> 20 fp-20 fp-27
#> 21 fp-21 fp-87
#> 22 fp-22 fp-87
#> 23 fp-23 fp-22
#> 24 fp-24 fp-23
#> 25 fp-25 fp-71
#> 26 fp-26 fp-25
#> 27 fp-27 fp-21
#> 28 fp-28 fp-73
#> 29 fp-29 fp-21
#> 30 fp-30 fp-29
#> 31 fp-31 fp-30
#> 32 fp-32 fp-31
#> 33 fp-33 fp-71
#> 34 fp-34 fp-22
#> 35 fp-35 fp-22
#> 36 fp-36 fp-22
#> 37 fp-37 fp-69
#> 38 fp-38 fp-69
#> 39 fp-39 fp-23
#> 40 fp-40 fp-24
#> 41 fp-41 fp-71
#> 42 fp-42 fp-83
#> 43 fp-43 fp-34
#> 44 fp-44 fp-75
#> 45 fp-45 fp-73
#> 46 fp-46 fp-20
#> 47 fp-47 fp-27
#> 48 fp-48 fp-79
#> 49 fp-49 fp-87
#> 50 fp-50 fp-81
#> 51 fp-51 fp-33
#> 52 fp-52 fp-32
#> 53 fp-53 fp-77
#> 54 fp-54 fp-28
#> 55 fp-55 fp-28
#> 56 fp-56 fp-62
#> 57 fp-57 fp-61
#> 58 fp-58 fp-61
#> 59 fp-59 fp-81
#> 60 fp-60 fp-81
#> 61 fp-61 fp-62
#> 62 fp-62 fp-89
#> 63 fp-63 fp-64
#> 64 fp-64 fp-4
#> 65 fp-65 fp-66
#> 66 fp-66 fp-31
#> 67 fp-67 fp-68
#> 68 fp-68 fp-71
#> 69 fp-69 fp-70
#> 70 fp-70 fp-22
#> 71 fp-71 fp-72
#> 72 fp-72 fp-24
#> 73 fp-73 fp-74
#> 74 fp-74 fp-20
#> 75 fp-75 fp-76
#> 76 fp-76 fp-73
#> 77 fp-77 fp-78
#> 78 fp-78 fp-75
#> 79 fp-79 fp-80
#> 80 fp-80 fp-89
#> 81 fp-81 fp-82
#> 82 fp-82 fp-79
#> 83 fp-83 fp-84
#> 84 fp-84 fp-34
#> 85 fp-85 fp-86
#> 86 fp-86 fp-73
#> 87 fp-87 fp-88
#> 88 fp-88 fp-0
#> 89 fp-89 fp-90
#> 90 fp-90 fp-32
#>
#> attr(,"class")
#> [1] "hygeo"
nhd_crosswalk
#> $`cat-1`
#> $`cat-1`$COMID
#> [1] "9731278"
#>
#> $`cat-1`$outlet_COMID
#> [x] 9731278
#>
#>
#> $`cat-2`
#> $`cat-2`$COMID
#> [1] "9731364"
#>
#> $`cat-2`$outlet_COMID
#> [x] 9731364
#>
#>
#> $`cat-3`
#> $`cat-3`$COMID
#> [1] "9731422"
#>
#> $`cat-3`$outlet_COMID
#> [x] 9731422
#>
#>
#> $`cat-4`
#> $`cat-4`$COMID
#> [1] "9731394" "9731384" "9731370" "9731362"
#>
#> $`cat-4`$outlet_COMID
#> [x] 9731394
#>
#>
#> $`cat-5`
#> $`cat-5`$COMID
#> [1] "9731546" "9731388"
#>
#> $`cat-5`$outlet_COMID
#> [x] 9731388
#>
#>
#> $`cat-6`
#> $`cat-6`$COMID
#> [1] "9731548" "9731402" "9731396" "9731526" "9731524"
#>
#> $`cat-6`$outlet_COMID
#> [x] 9731402
#>
#>
#> $`cat-7`
#> $`cat-7`$COMID
#> [1] "9731408" "9731528"
#>
#> $`cat-7`$outlet_COMID
#> [x] 9731528
#>
#>
#> $`cat-8`
#> $`cat-8`$COMID
#> [1] "9731276"
#>
#> $`cat-8`$outlet_COMID
#> [x] 9731276
#>
#>
#> $`cat-9`
#> $`cat-9`$COMID
#> [1] "9731538" "9731330"
#>
#> $`cat-9`$outlet_COMID
#> [x] 9731330
#>
#>
#> $`cat-10`
#> $`cat-10`$COMID
#> [1] "9731354"
#>
#> $`cat-10`$outlet_COMID
#> [x] 9731354
#>
#>
#> $`cat-11`
#> $`cat-11`$COMID
#> [1] "9731314" "9731322"
#>
#> $`cat-11`$outlet_COMID
#> [x] 9731322
#>
#>
#> $`cat-12`
#> $`cat-12`$COMID
#> [1] "9731374" "9731372"
#>
#> $`cat-12`$outlet_COMID
#> [x] 9731372
#>
#>
#> $`cat-13`
#> $`cat-13`$COMID
#> [1] "9731544" "9731378" "9731522" "9731386"
#>
#> $`cat-13`$outlet_COMID
#> [x] 9731386
#>
#>
#> $`cat-14`
#> $`cat-14`$COMID
#> [1] "9731390"
#>
#> $`cat-14`$outlet_COMID
#> [x] 9731390
#>
#>
#> $`cat-15`
#> $`cat-15`$COMID
#> [1] "9731318" "9731332" "9731502"
#>
#> $`cat-15`$outlet_COMID
#> [x] 9731332
#>
#>
#> $`cat-16`
#> $`cat-16`$COMID
#> [1] "9731474"
#>
#> $`cat-16`$outlet_COMID
#> [x] 9731474
#>
#>
#> $`cat-17`
#> $`cat-17`$COMID
#> [1] "9731312"
#>
#> $`cat-17`$outlet_COMID
#> [x] 9731312
#>
#>
#> $`cat-18`
#> $`cat-18`$COMID
#> [1] "9731280"
#>
#> $`cat-18`$outlet_COMID
#> [x] 9731280
#>
#>
#> $`cat-19`
#> $`cat-19`$COMID
#> [1] "9731428"
#>
#> $`cat-19`$outlet_COMID
#> [x] 9731428
#>
#>
#> $`cat-20`
#> $`cat-20`$COMID
#> [1] "9731344" "9731340"
#>
#> $`cat-20`$outlet_COMID
#> [x] 9731344
#>
#>
#> $`cat-21`
#> $`cat-21`$COMID
#> [1] "9731424" "9731434" "9731420" "9731400" "9731430"
#>
#> $`cat-21`$outlet_COMID
#> [x] 9731430
#>
#>
#> $`cat-22`
#> $`cat-22`$COMID
#> [1] "9731398"
#>
#> $`cat-22`$outlet_COMID
#> [x] 9731398
#>
#>
#> $`cat-23`
#> $`cat-23`$COMID
#> [1] "9731368" "9731352" "9731334"
#>
#> $`cat-23`$outlet_COMID
#> [x] 9731368
#>
#>
#> $`cat-24`
#> $`cat-24`$COMID
#> [1] "9731324"
#>
#> $`cat-24`$outlet_COMID
#> [x] 9731324
#>
#>
#> $`cat-25`
#> $`cat-25`$COMID
#> [1] "9731290" "9731284.2"
#>
#> $`cat-25`$outlet_COMID
#> [x] 9731290
#>
#>
#> $`cat-26`
#> $`cat-26`$COMID
#> [1] "9731270" "9731532" "9731514" "9731284.1"
#>
#> $`cat-26`$outlet_COMID
#> [x] 9731284
#>
#> $`cat-26`$site_no
#> [x] "0214655255"
#>
#>
#> $`cat-27`
#> $`cat-27`$COMID
#> [1] "9731358"
#>
#> $`cat-27`$outlet_COMID
#> [x] 9731358
#>
#>
#> $`cat-28`
#> $`cat-28`$COMID
#> [1] "9731492" "9731288" "9731486"
#>
#> $`cat-28`$outlet_COMID
#> [x] 9731492
#>
#>
#> $`cat-29`
#> $`cat-29`$COMID
#> [1] "9731360" "9731506"
#>
#> $`cat-29`$outlet_COMID
#> [x] 9731360
#>
#>
#> $`cat-30`
#> $`cat-30`$COMID
#> [1] "9731328"
#>
#> $`cat-30`$outlet_COMID
#> [x] 9731328
#>
#>
#> $`cat-31`
#> $`cat-31`$COMID
#> [1] "9731316"
#>
#> $`cat-31`$outlet_COMID
#> [x] 9731316
#>
#>
#> $`cat-32`
#> $`cat-32`$COMID
#> [1] "9731498"
#>
#> $`cat-32`$outlet_COMID
#> [x] 9731498
#>
#>
#> $`cat-33`
#> $`cat-33`$COMID
#> [1] "9731294" "9731292.2"
#>
#> $`cat-33`$outlet_COMID
#> [x] 9731294
#>
#>
#> $`cat-34`
#> $`cat-34`$COMID
#> [1] "9731504"
#>
#> $`cat-34`$outlet_COMID
#> [x] 9731504
#>
#>
#> $`cat-35`
#> $`cat-35`$COMID
#> [1] "9731392" "9731382"
#>
#> $`cat-35`$outlet_COMID
#> [x] 9731382
#>
#>
#> $`cat-36`
#> $`cat-36`$COMID
#> [1] "9731380" "9731356" "9731366"
#>
#> $`cat-36`$outlet_COMID
#> [x] 9731356
#>
#>
#> $`cat-37`
#> $`cat-37`$COMID
#> [1] "9731540" "9731346"
#>
#> $`cat-37`$outlet_COMID
#> [x] 9731346
#>
#>
#> $`cat-38`
#> $`cat-38`$COMID
#> [1] "9731542" "9731338" "9731518" "9731350" "9731520"
#>
#> $`cat-38`$outlet_COMID
#> [x] 9731338
#>
#>
#> $`cat-39`
#> $`cat-39`$COMID
#> [1] "9731536" "9731326"
#>
#> $`cat-39`$outlet_COMID
#> [x] 9731326
#>
#>
#> $`cat-40`
#> $`cat-40`$COMID
#> [1] "9731306" "9731308"
#>
#> $`cat-40`$outlet_COMID
#> [x] 9731308
#>
#>
#> $`cat-41`
#> $`cat-41`$COMID
#> [1] "9731304" "9731298" "9731516" "9731302"
#>
#> $`cat-41`$outlet_COMID
#> [x] 9731298
#>
#>
#> $`cat-42`
#> $`cat-42`$COMID
#> [1] "9731282"
#>
#> $`cat-42`$outlet_COMID
#> [x] 9731282
#>
#>
#> $`cat-43`
#> $`cat-43`$COMID
#> [1] "9731534" "9731310"
#>
#> $`cat-43`$outlet_COMID
#> [x] 9731310
#>
#>
#> $`cat-44`
#> $`cat-44`$COMID
#> [1] "9731478"
#>
#> $`cat-44`$outlet_COMID
#> [x] 9731478
#>
#>
#> $`cat-45`
#> $`cat-45`$COMID
#> [1] "9731490"
#>
#> $`cat-45`$outlet_COMID
#> [x] 9731490
#>
#>
#> $`cat-46`
#> $`cat-46`$COMID
#> [1] "9731496"
#>
#> $`cat-46`$outlet_COMID
#> [x] 9731496
#>
#>
#> $`cat-47`
#> $`cat-47`$COMID
#> [1] "9731348"
#>
#> $`cat-47`$outlet_COMID
#> [x] 9731348
#>
#>
#> $`cat-48`
#> $`cat-48`$COMID
#> [1] "9731262" "9731258"
#>
#> $`cat-48`$outlet_COMID
#> [x] 9731262
#>
#>
#> $`cat-49`
#> $`cat-49`$COMID
#> [1] "9731432"
#>
#> $`cat-49`$outlet_COMID
#> [x] 9731432
#>
#>
#> $`cat-50`
#> $`cat-50`$COMID
#> [1] "9731244" "9731470"
#>
#> $`cat-50`$outlet_COMID
#> [x] 9731470
#>
#>
#> $`cat-51`
#> $`cat-51`$COMID
#> [1] "9731274" "9731292.1"
#>
#> $`cat-51`$outlet_COMID
#> [x] 9731292
#>
#> $`cat-51`$site_no
#> [x] "0214657975"
#>
#>
#> $`cat-52`
#> $`cat-52`$COMID
#> [1] "9731272"
#>
#> $`cat-52`$outlet_COMID
#> [x] 9731272
#>
#>
#> $`cat-53`
#> $`cat-53`$COMID
#> [1] "9731256"
#>
#> $`cat-53`$outlet_COMID
#> [x] 9731256
#>
#>
#> $`cat-54`
#> $`cat-54`$COMID
#> [1] "9731252"
#>
#> $`cat-54`$outlet_COMID
#> [x] 9731252
#>
#>
#> $`cat-55`
#> $`cat-55`$COMID
#> [1] "9731240" "9731254"
#>
#> $`cat-55`$outlet_COMID
#> [x] 9731254
#>
#>
#> $`cat-56`
#> $`cat-56`$COMID
#> [1] "9731248"
#>
#> $`cat-56`$outlet_COMID
#> [x] 9731248
#>
#> $`cat-56`$site_no
#> [x] "02146211"
#>
#>
#> $`cat-57`
#> $`cat-57`$COMID
#> [1] "9731236"
#>
#> $`cat-57`$outlet_COMID
#> [x] 9731236
#>
#>
#> $`cat-58`
#> $`cat-58`$COMID
#> [1] "9731530" "9731238"
#>
#> $`cat-58`$outlet_COMID
#> [x] 9731238
#>
#>
#> $`cat-59`
#> $`cat-59`$COMID
#> [1] "9731246"
#>
#> $`cat-59`$outlet_COMID
#> [x] 9731246
#>
#>
#> $`cat-60`
#> $`cat-60`$COMID
#> [1] "9731472"
#>
#> $`cat-60`$outlet_COMID
#> [x] 9731472
#>
#>
#> $`cat-61`
#> $`cat-61`$COMID
#> [1] "9731242" "9731250" "9731512"
#>
#> $`cat-61`$outlet_COMID
#> [x] 9731250
#>
#>
#> $`cat-62`
#> $`cat-62`$COMID
#> [1] "9731468"
#>
#> $`cat-62`$outlet_COMID
#> [x] 9731468
#>
#>
#> $`cat-63`
#> $`cat-63`$COMID
#> [1] "9731320.1"
#>
#> $`cat-63`$outlet_COMID
#> [x] 9731320
#>
#> $`cat-63`$site_no
#> [x] "0214678175"
#>
#>
#> $`cat-64`
#> $`cat-64`$COMID
#> [1] "9731320.2"
#>
#> $`cat-64`$outlet_COMID
#> [x] 9731320
#>
#>
#> $`cat-65`
#> $`cat-65`$COMID
#> [1] "9731300.1"
#>
#> $`cat-65`$outlet_COMID
#> [x] 9731300
#>
#> $`cat-65`$site_no
#> [x] "02146348"
#>
#>
#> $`cat-66`
#> $`cat-66`$COMID
#> [1] "9731300.2"
#>
#> $`cat-66`$outlet_COMID
#> [x] 9731300
#>
#>
#> $`cat-67`
#> $`cat-67`$COMID
#> [1] "9731286.1"
#>
#> $`cat-67`$outlet_COMID
#> [x] 9731286
#>
#> $`cat-67`$site_no
#> [x] "02146562"
#>
#>
#> $`cat-68`
#> $`cat-68`$COMID
#> [1] "9731286.2"
#>
#> $`cat-68`$outlet_COMID
#> [x] 9731286
#>
#>
#> $`cat-69`
#> $`cat-69`$COMID
#> [1] "9731342.1"
#>
#> $`cat-69`$outlet_COMID
#> [x] 9731342
#>
#> $`cat-69`$site_no
#> [x] "02146670"
#>
#>
#> $`cat-70`
#> $`cat-70`$COMID
#> [1] "9731342.2"
#>
#> $`cat-70`$outlet_COMID
#> [x] 9731342
#>
#>
#> $`cat-71`
#> $`cat-71`$COMID
#> [1] "9731500.1"
#>
#> $`cat-71`$outlet_COMID
#> [x] 9731500
#>
#> $`cat-71`$site_no
#> [x] "02146600"
#>
#>
#> $`cat-72`
#> $`cat-72`$COMID
#> [1] "9731500.2"
#>
#> $`cat-72`$outlet_COMID
#> [x] 9731500
#>
#>
#> $`cat-73`
#> $`cat-73`$COMID
#> [1] "9731296.1"
#>
#> $`cat-73`$outlet_COMID
#> [x] 9731296
#>
#> $`cat-73`$site_no
#> [x] "02146507"
#>
#>
#> $`cat-74`
#> $`cat-74`$COMID
#> [1] "9731296.2"
#>
#> $`cat-74`$outlet_COMID
#> [x] 9731296
#>
#>
#> $`cat-75`
#> $`cat-75`$COMID
#> [1] "9731484.1"
#>
#> $`cat-75`$outlet_COMID
#> [x] 9731484
#>
#> $`cat-75`$site_no
#> [x] "0214645022"
#>
#>
#> $`cat-76`
#> $`cat-76`$COMID
#> [1] "9731484.2"
#>
#> $`cat-76`$outlet_COMID
#> [x] 9731484
#>
#>
#> $`cat-77`
#> $`cat-77`$COMID
#> [1] "9731260.1"
#>
#> $`cat-77`$outlet_COMID
#> [x] 9731260
#>
#> $`cat-77`$site_no
#> [x] "0214642825"
#>
#>
#> $`cat-78`
#> $`cat-78`$COMID
#> [1] "9731260.2"
#>
#> $`cat-78`$outlet_COMID
#> [x] 9731260
#>
#>
#> $`cat-79`
#> $`cat-79`$COMID
#> [1] "9731264.1"
#>
#> $`cat-79`$outlet_COMID
#> [x] 9731264
#>
#> $`cat-79`$site_no
#> [x] "02146285"
#>
#>
#> $`cat-80`
#> $`cat-80`$COMID
#> [1] "9731264.2"
#>
#> $`cat-80`$outlet_COMID
#> [x] 9731264
#>
#>
#> $`cat-81`
#> $`cat-81`$COMID
#> [1] "9731476.1"
#>
#> $`cat-81`$outlet_COMID
#> [x] 9731476
#>
#> $`cat-81`$site_no
#> [x] "0214627970"
#>
#>
#> $`cat-82`
#> $`cat-82`$COMID
#> [1] "9731476.2"
#>
#> $`cat-82`$outlet_COMID
#> [x] 9731476
#>
#>
#> $`cat-83`
#> $`cat-83`$COMID
#> [1] "9731494.1"
#>
#> $`cat-83`$outlet_COMID
#> [x] 9731494
#>
#> $`cat-83`$site_no
#> [x] "02146700"
#>
#>
#> $`cat-84`
#> $`cat-84`$COMID
#> [1] "9731494.2"
#>
#> $`cat-84`$outlet_COMID
#> [x] 9731494
#>
#>
#> $`cat-85`
#> $`cat-85`$COMID
#> [1] "9731488.1"
#>
#> $`cat-85`$outlet_COMID
#> [x] 9731488
#>
#> $`cat-85`$site_no
#> [x] "02146470"
#>
#>
#> $`cat-86`
#> $`cat-86`$COMID
#> [1] "9731488.2"
#>
#> $`cat-86`$outlet_COMID
#> [x] 9731488
#>
#>
#> $`cat-87`
#> $`cat-87`$COMID
#> [1] "9731454.1"
#>
#> $`cat-87`$outlet_COMID
#> [x] 9731454
#>
#> $`cat-87`$site_no
#> [x] "02146800"
#>
#>
#> $`cat-88`
#> $`cat-88`$COMID
#> [1] "9731454.2"
#>
#> $`cat-88`$outlet_COMID
#> [x] 9731454
#>
#>
#> $`cat-89`
#> $`cat-89`$COMID
#> [1] "9731482.1"
#>
#> $`cat-89`$outlet_COMID
#> [x] 9731482
#>
#> $`cat-89`$site_no
#> [x] "02146300"
#>
#>
#> $`cat-90`
#> $`cat-90`$COMID
#> [1] "9731482.2"
#>
#> $`cat-90`$outlet_COMID
#> [x] 9731482
#>
#>
#> $`fp-1`
#> $`fp-1`$COMID
#> [1] "9731278"
#>
#> $`fp-1`$outlet_COMID
#> [x] 9731278
#>
#>
#> $`fp-2`
#> $`fp-2`$COMID
#> [1] "9731364"
#>
#> $`fp-2`$outlet_COMID
#> [x] 9731364
#>
#>
#> $`fp-3`
#> $`fp-3`$COMID
#> [1] "9731422"
#>
#> $`fp-3`$outlet_COMID
#> [x] 9731422
#>
#>
#> $`fp-4`
#> $`fp-4`$COMID
#> [1] "9731394" "9731384" "9731370" "9731362"
#>
#> $`fp-4`$outlet_COMID
#> [x] 9731394
#>
#>
#> $`fp-5`
#> $`fp-5`$COMID
#> [1] "9731546" "9731388"
#>
#> $`fp-5`$outlet_COMID
#> [x] 9731388
#>
#>
#> $`fp-6`
#> $`fp-6`$COMID
#> [1] "9731548" "9731402" "9731396" "9731526" "9731524"
#>
#> $`fp-6`$outlet_COMID
#> [x] 9731402
#>
#>
#> $`fp-7`
#> $`fp-7`$COMID
#> [1] "9731408" "9731528"
#>
#> $`fp-7`$outlet_COMID
#> [x] 9731528
#>
#>
#> $`fp-8`
#> $`fp-8`$COMID
#> [1] "9731276"
#>
#> $`fp-8`$outlet_COMID
#> [x] 9731276
#>
#>
#> $`fp-9`
#> $`fp-9`$COMID
#> [1] "9731538" "9731330"
#>
#> $`fp-9`$outlet_COMID
#> [x] 9731330
#>
#>
#> $`fp-10`
#> $`fp-10`$COMID
#> [1] "9731354"
#>
#> $`fp-10`$outlet_COMID
#> [x] 9731354
#>
#>
#> $`fp-11`
#> $`fp-11`$COMID
#> [1] "9731314" "9731322"
#>
#> $`fp-11`$outlet_COMID
#> [x] 9731322
#>
#>
#> $`fp-12`
#> $`fp-12`$COMID
#> [1] "9731374" "9731372"
#>
#> $`fp-12`$outlet_COMID
#> [x] 9731372
#>
#>
#> $`fp-13`
#> $`fp-13`$COMID
#> [1] "9731544" "9731378" "9731522" "9731386"
#>
#> $`fp-13`$outlet_COMID
#> [x] 9731386
#>
#>
#> $`fp-14`
#> $`fp-14`$COMID
#> [1] "9731390"
#>
#> $`fp-14`$outlet_COMID
#> [x] 9731390
#>
#>
#> $`fp-15`
#> $`fp-15`$COMID
#> [1] "9731318" "9731332" "9731502"
#>
#> $`fp-15`$outlet_COMID
#> [x] 9731332
#>
#>
#> $`fp-16`
#> $`fp-16`$COMID
#> [1] "9731474"
#>
#> $`fp-16`$outlet_COMID
#> [x] 9731474
#>
#>
#> $`fp-17`
#> $`fp-17`$COMID
#> [1] "9731312"
#>
#> $`fp-17`$outlet_COMID
#> [x] 9731312
#>
#>
#> $`fp-18`
#> $`fp-18`$COMID
#> [1] "9731280"
#>
#> $`fp-18`$outlet_COMID
#> [x] 9731280
#>
#>
#> $`fp-19`
#> $`fp-19`$COMID
#> [1] "9731428"
#>
#> $`fp-19`$outlet_COMID
#> [x] 9731428
#>
#>
#> $`fp-20`
#> $`fp-20`$COMID
#> [1] "9731344" "9731340"
#>
#> $`fp-20`$outlet_COMID
#> [x] 9731344
#>
#>
#> $`fp-21`
#> $`fp-21`$COMID
#> [1] "9731424" "9731434" "9731420" "9731400" "9731430"
#>
#> $`fp-21`$outlet_COMID
#> [x] 9731430
#>
#>
#> $`fp-22`
#> $`fp-22`$COMID
#> [1] "9731398"
#>
#> $`fp-22`$outlet_COMID
#> [x] 9731398
#>
#>
#> $`fp-23`
#> $`fp-23`$COMID
#> [1] "9731368" "9731352" "9731334"
#>
#> $`fp-23`$outlet_COMID
#> [x] 9731368
#>
#>
#> $`fp-24`
#> $`fp-24`$COMID
#> [1] "9731324"
#>
#> $`fp-24`$outlet_COMID
#> [x] 9731324
#>
#>
#> $`fp-25`
#> $`fp-25`$COMID
#> [1] "9731290" "9731284.2"
#>
#> $`fp-25`$outlet_COMID
#> [x] 9731290
#>
#>
#> $`fp-26`
#> $`fp-26`$COMID
#> [1] "9731270" "9731532" "9731514" "9731284.1"
#>
#> $`fp-26`$outlet_COMID
#> [x] 9731284
#>
#>
#> $`fp-27`
#> $`fp-27`$COMID
#> [1] "9731358"
#>
#> $`fp-27`$outlet_COMID
#> [x] 9731358
#>
#>
#> $`fp-28`
#> $`fp-28`$COMID
#> [1] "9731492" "9731288" "9731486"
#>
#> $`fp-28`$outlet_COMID
#> [x] 9731492
#>
#>
#> $`fp-29`
#> $`fp-29`$COMID
#> [1] "9731360" "9731506"
#>
#> $`fp-29`$outlet_COMID
#> [x] 9731360
#>
#>
#> $`fp-30`
#> $`fp-30`$COMID
#> [1] "9731328"
#>
#> $`fp-30`$outlet_COMID
#> [x] 9731328
#>
#>
#> $`fp-31`
#> $`fp-31`$COMID
#> [1] "9731316"
#>
#> $`fp-31`$outlet_COMID
#> [x] 9731316
#>
#>
#> $`fp-32`
#> $`fp-32`$COMID
#> [1] "9731498"
#>
#> $`fp-32`$outlet_COMID
#> [x] 9731498
#>
#>
#> $`fp-33`
#> $`fp-33`$COMID
#> [1] "9731294" "9731292.2"
#>
#> $`fp-33`$outlet_COMID
#> [x] 9731294
#>
#>
#> $`fp-34`
#> $`fp-34`$COMID
#> [1] "9731504"
#>
#> $`fp-34`$outlet_COMID
#> [x] 9731504
#>
#>
#> $`fp-35`
#> $`fp-35`$COMID
#> [1] "9731392" "9731382"
#>
#> $`fp-35`$outlet_COMID
#> [x] 9731382
#>
#>
#> $`fp-36`
#> $`fp-36`$COMID
#> [1] "9731380" "9731356" "9731366"
#>
#> $`fp-36`$outlet_COMID
#> [x] 9731356
#>
#>
#> $`fp-37`
#> $`fp-37`$COMID
#> [1] "9731540" "9731346"
#>
#> $`fp-37`$outlet_COMID
#> [x] 9731346
#>
#>
#> $`fp-38`
#> $`fp-38`$COMID
#> [1] "9731542" "9731338" "9731518" "9731350" "9731520"
#>
#> $`fp-38`$outlet_COMID
#> [x] 9731338
#>
#>
#> $`fp-39`
#> $`fp-39`$COMID
#> [1] "9731536" "9731326"
#>
#> $`fp-39`$outlet_COMID
#> [x] 9731326
#>
#>
#> $`fp-40`
#> $`fp-40`$COMID
#> [1] "9731306" "9731308"
#>
#> $`fp-40`$outlet_COMID
#> [x] 9731308
#>
#>
#> $`fp-41`
#> $`fp-41`$COMID
#> [1] "9731304" "9731298" "9731516" "9731302"
#>
#> $`fp-41`$outlet_COMID
#> [x] 9731298
#>
#>
#> $`fp-42`
#> $`fp-42`$COMID
#> [1] "9731282"
#>
#> $`fp-42`$outlet_COMID
#> [x] 9731282
#>
#>
#> $`fp-43`
#> $`fp-43`$COMID
#> [1] "9731534" "9731310"
#>
#> $`fp-43`$outlet_COMID
#> [x] 9731310
#>
#>
#> $`fp-44`
#> $`fp-44`$COMID
#> [1] "9731478"
#>
#> $`fp-44`$outlet_COMID
#> [x] 9731478
#>
#>
#> $`fp-45`
#> $`fp-45`$COMID
#> [1] "9731490"
#>
#> $`fp-45`$outlet_COMID
#> [x] 9731490
#>
#>
#> $`fp-46`
#> $`fp-46`$COMID
#> [1] "9731496"
#>
#> $`fp-46`$outlet_COMID
#> [x] 9731496
#>
#>
#> $`fp-47`
#> $`fp-47`$COMID
#> [1] "9731348"
#>
#> $`fp-47`$outlet_COMID
#> [x] 9731348
#>
#>
#> $`fp-48`
#> $`fp-48`$COMID
#> [1] "9731262" "9731258"
#>
#> $`fp-48`$outlet_COMID
#> [x] 9731262
#>
#>
#> $`fp-49`
#> $`fp-49`$COMID
#> [1] "9731432"
#>
#> $`fp-49`$outlet_COMID
#> [x] 9731432
#>
#>
#> $`fp-50`
#> $`fp-50`$COMID
#> [1] "9731244" "9731470"
#>
#> $`fp-50`$outlet_COMID
#> [x] 9731470
#>
#>
#> $`fp-51`
#> $`fp-51`$COMID
#> [1] "9731274" "9731292.1"
#>
#> $`fp-51`$outlet_COMID
#> [x] 9731292
#>
#>
#> $`fp-52`
#> $`fp-52`$COMID
#> [1] "9731272"
#>
#> $`fp-52`$outlet_COMID
#> [x] 9731272
#>
#>
#> $`fp-53`
#> $`fp-53`$COMID
#> [1] "9731256"
#>
#> $`fp-53`$outlet_COMID
#> [x] 9731256
#>
#>
#> $`fp-54`
#> $`fp-54`$COMID
#> [1] "9731252"
#>
#> $`fp-54`$outlet_COMID
#> [x] 9731252
#>
#>
#> $`fp-55`
#> $`fp-55`$COMID
#> [1] "9731240" "9731254"
#>
#> $`fp-55`$outlet_COMID
#> [x] 9731254
#>
#>
#> $`fp-56`
#> $`fp-56`$COMID
#> [1] "9731248"
#>
#> $`fp-56`$outlet_COMID
#> [x] 9731248
#>
#>
#> $`fp-57`
#> $`fp-57`$COMID
#> [1] "9731236"
#>
#> $`fp-57`$outlet_COMID
#> [x] 9731236
#>
#>
#> $`fp-58`
#> $`fp-58`$COMID
#> [1] "9731530" "9731238"
#>
#> $`fp-58`$outlet_COMID
#> [x] 9731238
#>
#>
#> $`fp-59`
#> $`fp-59`$COMID
#> [1] "9731246"
#>
#> $`fp-59`$outlet_COMID
#> [x] 9731246
#>
#>
#> $`fp-60`
#> $`fp-60`$COMID
#> [1] "9731472"
#>
#> $`fp-60`$outlet_COMID
#> [x] 9731472
#>
#>
#> $`fp-61`
#> $`fp-61`$COMID
#> [1] "9731242" "9731250" "9731512"
#>
#> $`fp-61`$outlet_COMID
#> [x] 9731250
#>
#>
#> $`fp-62`
#> $`fp-62`$COMID
#> [1] "9731468"
#>
#> $`fp-62`$outlet_COMID
#> [x] 9731468
#>
#>
#> $`fp-63`
#> $`fp-63`$COMID
#> [1] "9731320.1"
#>
#> $`fp-63`$outlet_COMID
#> [x] 9731320
#>
#>
#> $`fp-64`
#> $`fp-64`$COMID
#> [1] "9731320.2"
#>
#> $`fp-64`$outlet_COMID
#> [x] 9731320
#>
#>
#> $`fp-65`
#> $`fp-65`$COMID
#> [1] "9731300.1"
#>
#> $`fp-65`$outlet_COMID
#> [x] 9731300
#>
#>
#> $`fp-66`
#> $`fp-66`$COMID
#> [1] "9731300.2"
#>
#> $`fp-66`$outlet_COMID
#> [x] 9731300
#>
#>
#> $`fp-67`
#> $`fp-67`$COMID
#> [1] "9731286.1"
#>
#> $`fp-67`$outlet_COMID
#> [x] 9731286
#>
#>
#> $`fp-68`
#> $`fp-68`$COMID
#> [1] "9731286.2"
#>
#> $`fp-68`$outlet_COMID
#> [x] 9731286
#>
#>
#> $`fp-69`
#> $`fp-69`$COMID
#> [1] "9731342.1"
#>
#> $`fp-69`$outlet_COMID
#> [x] 9731342
#>
#>
#> $`fp-70`
#> $`fp-70`$COMID
#> [1] "9731342.2"
#>
#> $`fp-70`$outlet_COMID
#> [x] 9731342
#>
#>
#> $`fp-71`
#> $`fp-71`$COMID
#> [1] "9731500.1"
#>
#> $`fp-71`$outlet_COMID
#> [x] 9731500
#>
#>
#> $`fp-72`
#> $`fp-72`$COMID
#> [1] "9731500.2"
#>
#> $`fp-72`$outlet_COMID
#> [x] 9731500
#>
#>
#> $`fp-73`
#> $`fp-73`$COMID
#> [1] "9731296.1"
#>
#> $`fp-73`$outlet_COMID
#> [x] 9731296
#>
#>
#> $`fp-74`
#> $`fp-74`$COMID
#> [1] "9731296.2"
#>
#> $`fp-74`$outlet_COMID
#> [x] 9731296
#>
#>
#> $`fp-75`
#> $`fp-75`$COMID
#> [1] "9731484.1"
#>
#> $`fp-75`$outlet_COMID
#> [x] 9731484
#>
#>
#> $`fp-76`
#> $`fp-76`$COMID
#> [1] "9731484.2"
#>
#> $`fp-76`$outlet_COMID
#> [x] 9731484
#>
#>
#> $`fp-77`
#> $`fp-77`$COMID
#> [1] "9731260.1"
#>
#> $`fp-77`$outlet_COMID
#> [x] 9731260
#>
#>
#> $`fp-78`
#> $`fp-78`$COMID
#> [1] "9731260.2"
#>
#> $`fp-78`$outlet_COMID
#> [x] 9731260
#>
#>
#> $`fp-79`
#> $`fp-79`$COMID
#> [1] "9731264.1"
#>
#> $`fp-79`$outlet_COMID
#> [x] 9731264
#>
#>
#> $`fp-80`
#> $`fp-80`$COMID
#> [1] "9731264.2"
#>
#> $`fp-80`$outlet_COMID
#> [x] 9731264
#>
#>
#> $`fp-81`
#> $`fp-81`$COMID
#> [1] "9731476.1"
#>
#> $`fp-81`$outlet_COMID
#> [x] 9731476
#>
#>
#> $`fp-82`
#> $`fp-82`$COMID
#> [1] "9731476.2"
#>
#> $`fp-82`$outlet_COMID
#> [x] 9731476
#>
#>
#> $`fp-83`
#> $`fp-83`$COMID
#> [1] "9731494.1"
#>
#> $`fp-83`$outlet_COMID
#> [x] 9731494
#>
#>
#> $`fp-84`
#> $`fp-84`$COMID
#> [1] "9731494.2"
#>
#> $`fp-84`$outlet_COMID
#> [x] 9731494
#>
#>
#> $`fp-85`
#> $`fp-85`$COMID
#> [1] "9731488.1"
#>
#> $`fp-85`$outlet_COMID
#> [x] 9731488
#>
#>
#> $`fp-86`
#> $`fp-86`$COMID
#> [1] "9731488.2"
#>
#> $`fp-86`$outlet_COMID
#> [x] 9731488
#>
#>
#> $`fp-87`
#> $`fp-87`$COMID
#> [1] "9731454.1"
#>
#> $`fp-87`$outlet_COMID
#> [x] 9731454
#>
#>
#> $`fp-88`
#> $`fp-88`$COMID
#> [1] "9731454.2"
#>
#> $`fp-88`$outlet_COMID
#> [x] 9731454
#>
#>
#> $`fp-89`
#> $`fp-89`$COMID
#> [1] "9731482.1"
#>
#> $`fp-89`$outlet_COMID
#> [x] 9731482
#>
#>
#> $`fp-90`
#> $`fp-90`$COMID
#> [1] "9731482.2"
#>
#> $`fp-90`$outlet_COMID
#> [x] 9731482
If needed, we can further break up the flowline network ensuring the outlets in the catchment network are included.
outlet_comids <- select(st_drop_geometry(reconcile), ID, member_COMID) %>%
mutate(member_COMID = strsplit(member_COMID, ",")) %>%
unnest(cols = member_COMID) %>%
mutate(member_COMID = as.integer(member_COMID)) %>%
left_join(select(st_drop_geometry(nhd$flowline), COMID, Hydroseq),
by = c("member_COMID" = "COMID")) %>%
group_by(ID) %>%
filter(Hydroseq == min(Hydroseq)) %>%
ungroup()
hyRefactor::refactor_nhdplus(nhd$flowline,
split_flines_meters = 500,
split_flines_cores = 2,
collapse_flines_meters = 400,
collapse_flines_main_meters = 400,
exclude_cats = outlet_comids$member_COMID,
out_refactored = refactored_small,
out_reconciled = reconciled_small,
three_pass = TRUE,
purge_non_dendritic = FALSE)
#> Warning in prepare_nhdplus(., 0, 0, 0, purge_non_dendritic =
#> purge_non_dendritic, : Got NHDPlus data without a Terminal catchment. Attempting
#> to find it.
#> Warning in prepare_nhdplus(., 0, 0, 0, purge_non_dendritic = purge_non_dendritic, : Removed 0 flowlines that don't apply.
#> Includes: Coastlines, non-dendritic paths,
#> and networks with drainage area less than 0 sqkm, and drainage basins smaller than 0
#> flowlines split complete, collapsing
#> Writing layer `file5dd455453b9c' to data source `C:\Users\DBLODG~1\AppData\Local\Temp\1\RtmpId2WUy\file5dd455453b9c.gpkg' using driver `GPKG'
#> options: OVERWRITE=YES
#> Writing 280 features with 12 fields and geometry type Line String.
#> collapse complete, out collapse written to disk, reconciling
#> Writing layer `file5dd464bf173f' to data source `C:\Users\DBLODG~1\AppData\Local\Temp\1\RtmpId2WUy\file5dd464bf173f.gpkg' using driver `GPKG'
#> options: OVERWRITE=YES
#> Writing 251 features with 7 fields and geometry type Line String.