Skip to content

Commit

Permalink
flag years that we exclude from the survey in plot
Browse files Browse the repository at this point in the history
  • Loading branch information
iantaylor-NOAA committed Jan 31, 2025
1 parent c184c68 commit 364f90b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 01-data-sources.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Note: the names for the first 4 of these surveys in the [{nwfscSurvey}](https://

c. This survey should be referenced as the "WCGBT Survey"

![Summary of the day of the year, latitude and depth covered by each of the primary trawl surveys on the U.S. West Coast. Note that the depth figure uses a log<sub>2</sub>-scale.](img/survey_summary_US_West_Coast.png)
![Summary of the day of the year, latitude and depth covered by each of the primary trawl surveys on the U.S. West Coast. Values that are typically excluded (Triennial in 1977 and AFSC Slope survey prior to 1997) are shaded gray. Note that the depth figure uses a log<sub>2</sub>-scale to better reflect the relative area associated with different depth ranges (shelf is generally wider than slope).](img/survey_summary_US_West_Coast.png)

### AFSC surveys

Expand Down
21 changes: 18 additions & 3 deletions R/survey_summary_US_West_Coast.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,39 @@ catch$yday <- lubridate::yday(catch$date)
# 2nd try for day within each year by making the year be the same for all entries
catch$yday2 <- catch$date
lubridate::year(catch$yday2) <- 1900
# flag years that we typically use
catch <- catch |>
dplyr::mutate(
exclude = dplyr::case_when(
survey_name == "Triennial" & lubridate::year(date) < 1980 ~ TRUE,
survey_name == "AFSC Slope" & lubridate::year(date) < 1997 ~ TRUE,
TRUE ~ FALSE # all other surveys/years
)
)

# reorder points so that the colors mix instead of one masking the other
catch <- catch[sample(1:nrow(catch)),]

# make plots
library(ggplot2)
g1 <- ggplot(catch, aes(date, yday2)) +
geom_point(aes(color = survey_name), alpha = 0.3) +
geom_point(aes(color = survey_name, shape = exclude), fill = "grey", alpha = 0.3) +
labs(x = "Date", y = "Day within year", color = "") +
scale_y_date(date_breaks = "1 month", date_labels = "%b") +
scale_shape_manual(values = c(19, 21)) +
guides(colour = guide_legend(override.aes = list(alpha = 1)))

g2 <- ggplot(catch, aes(date, Latitude_dd)) +
geom_point(aes(color = survey_name), alpha = 0.3) +
geom_point(aes(color = survey_name, shape = exclude), fill = "grey", alpha = 0.3) +
labs(x = "Date", y = "Latitude (°N)", color = "") +
scale_shape_manual(values = c(19, 21)) +
guides(colour = guide_legend(override.aes = list(alpha = 1)))

g3 <- ggplot(catch, aes(date, Depth_m)) +
geom_point(aes(color = survey_name), alpha = 0.3) +
geom_point(aes(color = survey_name, shape = exclude), fill = "grey", alpha = 0.3) +
scale_y_continuous(transform = "log2") +
labs(x = "Date", y = "Depth (m)", color = "") +
scale_shape_manual(values = c(19, 21)) +
guides(colour = guide_legend(override.aes = list(alpha = 1)))

# combine plots and save results
Expand Down
Binary file modified img/survey_summary_US_West_Coast.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 364f90b

Please sign in to comment.