library(stringr)
# directory structure
main_dir <- "S:/ursa/campbell/Other/tune/data/for_analysis"
# inputs
counties <- file.path(main_dir, "counties.shp") |> vect()
huc04 <- file.path(main_dir, "huc04.shp") |> vect()
huc06 <- file.path(main_dir, "huc06.shp") |> vect()
huc08 <- file.path(main_dir, "huc08.shp") |> vect()
streamdist <- file.path(main_dir, "dist_to_steams_250cfs_clip.tif") |> rast()
artifacts <- file.path(main_dir, "artifacts.csv") |> read.csv()
# join artifacts data to counties
artifacts$FIPS <- str_pad(artifacts$FPS, 5, "left", "0")
counties <- merge(counties, artifacts, by = "FIPS")
# select the watersheds within the three main basins
keepers <- c("0601", "0602", "0603", "0604")
huc04 <- huc04[huc04$huc4 %in% keepers,]
huc06 <- huc06[str_sub(huc06$huc6, 1, 4) %in% keepers,]
huc08 <- huc08[str_sub(huc08$huc8, 1, 4) %in% keepers,]
# map artifacts by county and overlay watersheds
plot(counties, "Total.Sample", breaks = 10, bg = "white")
lines(huc08, col = "yellow", lwd = 0.5)
lines(huc06, col = "orange", lwd = 2)
lines(huc04, col = "red", lwd = 4)