clarified comments

This commit is contained in:
Ben Varick 2023-10-29 15:13:00 -05:00
parent 4b75d15a6e
commit d4aca67ed2
Signed by: ben
SSH Key Fingerprint: SHA256:jWnpFDAcacYM5aPFpYRqlsamlDyKNpSj3jj+k4ojtUo
3 changed files with 12 additions and 4 deletions

View File

@ -2,7 +2,7 @@
library(nhdplusTools)
library(sf)
# set data dir
# set hydrologic data dir
data_dir <- "data"
ifelse(
!dir.exists(file.path(getwd(), paste0(data_dir, "/hydrologic"))),
@ -15,6 +15,7 @@ nhdplusTools_data_dir(dir = paste0(data_dir, "/hydrologic"))
extent <- read.csv(file = "extent.csv")
crs <- 4269
# make extent a polygon
extent_poly <- st_polygon(
x = list(
cbind(
@ -24,7 +25,10 @@ extent_poly <- st_polygon(
)
extent_poly <- st_sfc(extent_poly, crs=4326)
# make extent a bounding box
extent_bbox <- st_bbox(st_transform(x = extent_poly, crs))
# make list of extent coordinates
extent <- list(longitude_max = max(extent$longitude),
longitude_min = min(extent$longitude),
latitude_max = max(extent$latitude),

View File

@ -1,6 +1,5 @@
# load libraries
library(nhdplusTools)
library(sf)
# get watershed areas
extent_huc <- get_huc(AOI = extent_poly, buffer = 0, type = "huc04")
@ -12,11 +11,13 @@ download_nhdplushr(nhdplusTools_data_dir(), extent_huc$huc4, download_files = TR
get_vaa()
# combine data into geopackage
# identify which layers to use
layers <- c("NHDArea",
"NHDFlowline",
"NHDWaterbody",
"NHDPlusLandSea")
# save data into "data.gpkg" file
data <- get_nhdplushr(hr_dir = nhdplusTools_data_dir(),
out_gpkg = paste0(nhdplusTools_data_dir(),"/data.gpkg"),
layers = layers,

View File

@ -17,7 +17,7 @@ units <- "in"
res <- 600
margin <- 0
# set state to highlight
# set state to highlight from political map
state <- c("Wisconsin")
# plot map
@ -53,7 +53,8 @@ plot_map <- function () {
add = TRUE)
}
# save figure
## save figures
## generate tiff
# tiff(filename = paste0(figure_dir,"/map.tiff"),
# width = width,
# height = height,
@ -65,6 +66,7 @@ plot_map <- function () {
# plot_map()
# dev.off()
#
## generate jpeg
# jpeg(filename = paste0(figure_dir,"/map.jpg"),
# width = width,
# height = height,
@ -76,6 +78,7 @@ plot_map <- function () {
# plot_map()
# dev.off()
# generate png
png(filename = paste0(figure_dir, "/map.png"),
width = width,
height = height,