Open JaneSullivan-NOAA opened 2 years ago
Sure! Though I can't take much credit, pretty much followed Sean's vignette. The only parts I had to use my brain for were:
1) Loading the Data_Geostat object pre-created by the VASTGAP crew (these are raw CPUE observations normally passed to a VAST model, but are neatly arranged by haul & lat long). Cecilia O'Leary pointed me to the right google drive with this info for my species, and
2) Adding a column called COMMON_NAME to meet the minimum column requirements listed here, and specifying "goa" as the region.
3) I didn't bother with the "create map file" add-on because I wanted to do a panel plot (as in the image above). Using that snippet saves a high-res version with no background (nice for presentations). Otherwise you have to extract the $plot
slot from the object.
Down the road I might look into their eval_plot_breaks function to standardize the legend across years.
I picked the 'green2' fill pallette from the schema options here.
Code I used:
library(akgfmaps)
# format this based on https://github.com/afsc-gap-products/akgfmaps/blob/master/R/make_idw_map.R
raw_surv <- readRDS(here('data', 'survey','hippoglossoides_elassodon','Data_Geostat_Hippoglossoides_elassodon.rds'))
s2021 <- raw_surv%>%
mutate( COMMON_NAME = 'Flathead Sole') %>%
dplyr::select(Year,COMMON_NAME, CPUE_KGHA = Catch_KG, LATITUDE = Lat, LONGITUDE = Lon) %>%
dplyr::filter(Year == 2021) %>%
make_idw_map(region = "goa",
set.breaks = "jenks",
in.crs = "+proj=longlat",
out.crs = "EPSG:3338", # Set output coordinate reference system
use.survey.bathymetry = FALSE, ## for GOA
grid.cell = c(20000, 20000)) %>% # 20x20km grid
add_map_labels() %>%
change_fill_color(new.scheme = "green2", show.plot = TRUE)
s2019 <- raw_surv%>%
mutate( COMMON_NAME = 'Flathead Sole') %>%
dplyr::select(Year,COMMON_NAME, CPUE_KGHA = Catch_KG, LATITUDE = Lat, LONGITUDE = Lon) %>%
dplyr::filter(Year == 2019) %>%
make_idw_map(region = "goa",
set.breaks = "jenks",
in.crs = "+proj=longlat",
out.crs = "EPSG:3338", # Set output coordinate reference system
use.survey.bathymetry = FALSE, ## for GOA
grid.cell = c(20000, 20000)) %>% # 20x20km grid
add_map_labels() %>%
change_fill_color(new.scheme = "green2", show.plot = TRUE)
p1 <- s2019$plot+theme(legend.position = 'right')
p2 <- s2021$plot+theme(legend.position = 'right')
ggsave(Rmisc::multiplot(plotlist = list(p1,p2), cols = 1),
file = here('figs','2_cpue_maps.png'),
height = 10, width = 8, dpi = 520)
@mkapur-noaa would you be willing to share some code to reproduce your gorgeous Flathead sole cpue maps? (like at some point, no rush)