-
Notifications
You must be signed in to change notification settings - Fork 0
/
FASTR_map.R
67 lines (54 loc) · 2.87 KB
/
FASTR_map.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Create map of FASTR sampling locations
# Laura Twardochleb
# 11/21/23
#1. Global Code and Functions ---------------------------------------------------------------------------------------------------------------------------------------------
library(tidyverse)
library(here)
require(sf)
require(ggplot2)
require(dplyr)
SubRegions<-deltamapr::R_EDSM_Subregions_Mahardja%>%
filter(Region!="South")%>%
filter(!SubRegion%in%c("Upper Napa River", "Lower Napa River", "San Pablo Bay", "San Francisco Bay"))
yolo<-sf::st_read(here("manuscript_synthesis","data","Yolo Bypass Extent"))%>%
st_transform(crs=st_crs(SubRegions))%>%
st_union()
add<-tibble(Latitude=c(37.9, 38.8), Longitude=c(-121.9, -121.2))%>%
st_as_sf(coords=c("Longitude", "Latitude"), crs=4326)%>%
st_transform(crs=st_crs(SubRegions))
base<-deltamapr::WW_Watershed%>%
st_transform(crs=st_crs(SubRegions))%>%
st_crop(st_union(st_union(st_buffer(yolo, units::set_units(3000, "m")), SubRegions), add))%>%
filter(!HNAME%in%c("PUTAH CREEK", "LAKE BERRYESSA", "SOUTH FORK PUTAH CREEK", "LAKE CURRY", "UPPER SAN LEANDRO RESERVOIR", "BETHANY RESERVOIR", "LAKE CHABOT", "SAN FRANCISCO BAY"))%>%
st_union()
stations<-tibble(Station=c("RCS", "RD22", "I80", "LIS", "STTD", "BL5", "LIB", "RYI", "RVB"),
Region=c(rep("Upstream", 5), rep("Downstream", 4)),
Latitude=c(38.793457, 38.676367, 38.573111, 38.474816, 38.353461, 38.274460, 38.242100, 38.213167, 38.159737),
Longitude=c(-121.725447, -121.643972, -121.582958, -121.588584, -121.642975, -121.665652, -121.684900,-121.668591, -121.686355))%>%
st_as_sf(coords=c("Longitude", "Latitude"), crs=4326)%>%
mutate(Region=factor(Region, levels=c("Upstream", "Downstream")))
locations_points<-tibble(Location=c( "Freeport", "Antioch"),
Latitude=c(38.461562, 38.004094),
Longitude=c(-121.499371, -121.805606))%>%
st_as_sf(coords=c("Longitude", "Latitude"), crs=4326)
locations_text<-tibble(Location=c("Freeport", "Antioch", "Rio Vista", "Cache Slough", "Yolo Bypass", "Sacramento River"),
Latitude=c(38.481562, 37.99, 38.155603, 38.36, 38.5, 38.51),
Longitude=c(-121.419371, -121.805606, -121.77, -121.78, -121.7, -121.38))%>%
st_as_sf(coords=c("Longitude", "Latitude"), crs=4326)
p<-ggplot()+
geom_sf(data=yolo, color=NA, fill="gray80")+
geom_sf(data=base, fill="slategray3", color="slategray4")+
geom_sf(data=locations_points)+
geom_sf(data=stations, aes(fill=Region), shape=21, color="black", size=3)+
geom_sf_text(data=locations_text, aes(label=Location), lineheight = 1)+
scale_fill_manual(values=c("#E41A1C", "#377EB8"))+
theme_void()
p
ggsave(here("manuscript_synthesis","plots","FASTR_MS_map.pdf"),
plot=p,
device="pdf",
scale=1.0,
width=8,
height=8,
units = "in",
dpi="print")