Skip to content

Commit

Permalink
Add historical length data #30
Browse files Browse the repository at this point in the history
Miller and Geibel
Miller and Gotschall
  • Loading branch information
brianlangseth-NOAA committed Dec 10, 2024
1 parent 3b1d424 commit d102a69
Show file tree
Hide file tree
Showing 2 changed files with 209 additions and 9 deletions.
127 changes: 118 additions & 9 deletions code/recfin_processing.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ ggsave(here('data_explore_figs',"recfin_mortality_district_fleet_percent.png"),
#Load catch data
##

# MRFSS Recreational - 1980-2004 Landings mtons
# MRFSS Recreational - 1980-1989, 1993-2004 Landings mtons
ca_mrfss = read.csv(here("data-raw","MRFSS-CTE510-California-quillback-1980---2004_17.Oct.2024.csv"), header = T)

#Pull 2021 assessment values for comparison. These are recFIN landings + discards
Expand Down Expand Up @@ -377,7 +377,7 @@ ggplot(aggAreaYr_mrfss, aes(y = tot_mt, x = YEAR)) +

#-----------------------------------------------------------------------------#

# Load RecFIN bio sampling data ----
# Process RecFIN bio sampling data ----

#-----------------------------------------------------------------------------#

Expand Down Expand Up @@ -617,14 +617,15 @@ ggsave(here('data_explore_figs',"recfin_weight_area_density.png"),

#-----------------------------------------------------------------------------#

# Load MRFSS bio sampling data ----
# Process MRFSS bio sampling data ----

#-----------------------------------------------------------------------------#

##
#Load the data
##
# MRFSS Recreational - 1980-2003

# MRFSS Recreational - 1980-1989, 1993-2003
ca_mrfss_bio <- read.csv(here("data-raw","MRFSS-SD509-CALIFORNIA-quillback-1980---2003_22.Nov.2024.csv"), header = T)


Expand Down Expand Up @@ -876,13 +877,20 @@ ggsave(here('data_explore_figs',"mrfss_weight_area_density.png"),
width = 6, height = 4)



#-----------------------------------------------------------------------------#

# Process historical bio sampling data ----

#-----------------------------------------------------------------------------#

########################-
# Check the Deb Wilson-Vandenberg dataset ----
## Deb Wilson-Vandenberg dataset 1987-1998 ----
########################-

#To see if duplicates exist in 1997 and 1998
#Copper rockfish 2023 assessment replaced 1997 and 1998 MRFSS PC data with Deb's estimates
#However, deb's estimates are total length so need to do conversions to FL
#To see if duplicates exist in 1997 and 1998 and process data
#Copper rockfish 2023 assessment replaced 1997 and 1998 MRFSS PC data with Deb's samples
#However, deb's samples are total length so need to do conversions to FL

#Pull 2021 assessment file for deb length data.
dir = "//nwcfile.nmfs.local/FRAM/Assessments/Archives/QuillbackRF/QuillbackRF_2021/6_non_confidential_data/postSSC_request_data"
Expand All @@ -893,7 +901,7 @@ table(deb_bio$PORTNAME, useNA = "always")
table(deb_bio$COUNTY, useNA = "always")

#Assign County to codes in Deb's data to district from the lookup table.
#Have to load two workssheets from the lookup table:
#Have to load two worksheets from the lookup table:
#First to get the county number, second to assign county number to district.
#Although county 23 (Humboldt) has one INTSITE that is assigned to Wine, Deb's data doesn't have that
#level of detail, so assign all Humboldt samples to Redwood.
Expand Down Expand Up @@ -978,3 +986,104 @@ out_deb$length_cm <- 9.075 + out_deb$length_cm * 0.965 #convert to FL based on
#write.csv(out_deb, here("data","CAquillback_deb_bio.csv"), row.names = FALSE)


########################-
## Miller and Gotschall 1957-1972 (Quillback lengths only for 1959-1960) ----
########################-

#Load the data - Table 3 is of lengths
milgot_bio <- data.frame(read_excel(here("data-raw", "Miller_Gotshall_catch_length_data.xlsx"), sheet = "Table 3",
col_types = c(rep("guess",7),"text")))

#Check variables
table(milgot_bio$Year)
table(milgot_bio$Month)
table(milgot_bio$Fishery)
table(milgot_bio$Species)
table(milgot_bio$Port)
table(milgot_bio$other.notes..comments)

#Process data

#Retain only quillback lengths
milgot_bio <- milgot_bio %>% dplyr::filter(Species == "QLBK")
#Expand dataset so each row equals one length (will remove the count column)
milgot_bio <- milgot_bio %>% tidyr::uncount(Count)

#Simplify variables

milgot_bio$length_cm <- milgot_bio$Length..cm.
milgot_bio$weight_kg <- NA
#Replace port with district
milgot_bio$area <- dplyr::case_when(milgot_bio$Port == "Bodega Bay" ~ "Bay",
milgot_bio$Port == "Ft. Bragg" ~ "Wine",
milgot_bio$Port == "Princeton" ~ "Bay",
milgot_bio$Port == "Shelter Cove" ~ "Wine",
TRUE ~ NA)
milgot_bio$mode <- dplyr::case_when(milgot_bio$Fishery %in% c("skiff", "Skiff") ~ "PR",
milgot_bio$Fishery == "CPFV" ~ "PC",
TRUE ~ NA)
milgot_bio$sex <- "U"
milgot_bio$disp <- "RETAINED"
milgot_bio$source <- "MilGot"

out_milgot <- milgot_bio %>% dplyr::select(Year,
length_cm,
weight_kg,
sex,
area,
mode,
disp,
source)


########################-
## Miller and Gleibel 1959-1960 ----
########################-

#Load the data
milgle_bio <- data.frame(read_excel(here("data-raw", "bio_quillback_rockfish_Miller_NorCal_Lengths_59_72.xlsx"), sheet = "Sheet1"))

#Check variables
table(milgle_bio$YEAR)
table(milgle_bio$NUMBER_OF_FISH)
table(milgle_bio$COAST_DIST)
table(milgle_bio$MODE)
table(milgle_bio$mode_description)
table(milgle_bio$Counties)

#Process data

#Expand dataset so each row equals one length (will remove the count column)
milgle_bio <- milgle_bio %>% tidyr::uncount(NUMBER_OF_FISH)


#Simplify variables

milgle_bio$length_cm <- milgle_bio$LENGTH/10
milgle_bio$weight_kg <- NA
#Replace port with district
milgle_bio$area <- dplyr::case_when(milgle_bio$Counties == "DelNorte_Humboldt" ~ "Redwood",
milgle_bio$Counties == "Mendocino_Sonoma" ~ "Wine",
milgle_bio$Counties == "SanFranciscoBay" ~ "Bay",
milgle_bio$Counties == "SantaCruz_Monterey" ~ "Central",
TRUE ~ NA)
milgle_bio$mode <- dplyr::case_when(milgle_bio$mode_description == "private_rental" ~ "PR",
milgle_bio$mode_description == "party_boat" ~ "PC",
TRUE ~ NA)
milgle_bio$sex <- "U"
milgle_bio$disp <- "RETAINED"
milgle_bio$source <- "MilGle"

out_milgle <- milgle_bio %>% dplyr::select("Year" = YEAR,
length_cm,
weight_kg,
sex,
area,
mode,
disp,
source)

#write.csv(cbind(out_milgot, out_milgle), here("data","CAquillback_historical_bio.csv"), row.names = FALSE)



91 changes: 91 additions & 0 deletions data/CAquillback_historical_bio.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
"Year","length_cm","weight_kg","sex","area","mode","disp","source"
1960,37,NA,"U","Bay","PC","RETAINED","MilGot"
1960,44,NA,"U","Bay","PC","RETAINED","MilGot"
1960,39,NA,"U","Bay","PC","RETAINED","MilGot"
1960,43,NA,"U","Bay","PC","RETAINED","MilGot"
1960,44,NA,"U","Bay","PC","RETAINED","MilGot"
1960,45,NA,"U","Bay","PC","RETAINED","MilGot"
1960,49,NA,"U","Bay","PC","RETAINED","MilGot"
1960,29,NA,"U","Bay","PC","RETAINED","MilGot"
1960,30,NA,"U","Bay","PC","RETAINED","MilGot"
1960,36,NA,"U","Bay","PC","RETAINED","MilGot"
1960,38,NA,"U","Bay","PC","RETAINED","MilGot"
1960,38,NA,"U","Bay","PC","RETAINED","MilGot"
1960,42,NA,"U","Bay","PC","RETAINED","MilGot"
1960,46,NA,"U","Bay","PC","RETAINED","MilGot"
1960,46,NA,"U","Bay","PC","RETAINED","MilGot"
1960,35,NA,"U","Bay","PC","RETAINED","MilGot"
1960,34,NA,"U","Bay","PC","RETAINED","MilGot"
1960,39,NA,"U","Bay","PC","RETAINED","MilGot"
1960,41,NA,"U","Bay","PC","RETAINED","MilGot"
1960,34,NA,"U","Bay","PC","RETAINED","MilGot"
1960,28,NA,"U","Bay","PR","RETAINED","MilGot"
1960,30,NA,"U","Bay","PR","RETAINED","MilGot"
1959,52,NA,"U","Wine","PR","RETAINED","MilGot"
1959,46,NA,"U","Wine","PR","RETAINED","MilGot"
1959,48,NA,"U","Wine","PR","RETAINED","MilGot"
1959,41,NA,"U","Wine","PR","RETAINED","MilGot"
1959,42,NA,"U","Wine","PR","RETAINED","MilGot"
1959,40,NA,"U","Wine","PR","RETAINED","MilGot"
1959,41,NA,"U","Wine","PR","RETAINED","MilGot"
1959,43,NA,"U","Wine","PR","RETAINED","MilGot"
1959,45,NA,"U","Wine","PR","RETAINED","MilGot"
1959,47,NA,"U","Wine","PR","RETAINED","MilGot"
1959,48,NA,"U","Wine","PR","RETAINED","MilGot"
1959,42.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,43.8,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,44.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,45.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,45.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,45.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,46.8,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,47.8,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,48.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,48.8,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,49.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,49.8,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,40.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,41.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,41.8,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,41.8,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,42.8,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,43.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,45.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,47.3,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,48.8,NA,"U","Redwood","PR","RETAINED","MilGle"
1959,27.8,NA,"U","Wine","PR","RETAINED","MilGle"
1959,34.3,NA,"U","Wine","PR","RETAINED","MilGle"
1959,34.8,NA,"U","Wine","PR","RETAINED","MilGle"
1959,36.3,NA,"U","Wine","PR","RETAINED","MilGle"
1959,37.3,NA,"U","Wine","PR","RETAINED","MilGle"
1959,39.3,NA,"U","Wine","PR","RETAINED","MilGle"
1959,41.8,NA,"U","Wine","PR","RETAINED","MilGle"
1959,42.8,NA,"U","Wine","PR","RETAINED","MilGle"
1959,43.3,NA,"U","Wine","PR","RETAINED","MilGle"
1959,43.3,NA,"U","Wine","PR","RETAINED","MilGle"
1959,43.8,NA,"U","Wine","PR","RETAINED","MilGle"
1959,45.8,NA,"U","Wine","PR","RETAINED","MilGle"
1959,47.8,NA,"U","Wine","PR","RETAINED","MilGle"
1960,34.3,NA,"U","Bay","PC","RETAINED","MilGle"
1960,34.8,NA,"U","Bay","PC","RETAINED","MilGle"
1960,35.8,NA,"U","Bay","PC","RETAINED","MilGle"
1960,39.3,NA,"U","Bay","PC","RETAINED","MilGle"
1960,40.8,NA,"U","Bay","PC","RETAINED","MilGle"
1960,29.3,NA,"U","Wine","PC","RETAINED","MilGle"
1960,30.8,NA,"U","Wine","PC","RETAINED","MilGle"
1960,36.8,NA,"U","Wine","PC","RETAINED","MilGle"
1960,37.8,NA,"U","Wine","PC","RETAINED","MilGle"
1960,38.8,NA,"U","Wine","PC","RETAINED","MilGle"
1960,38.8,NA,"U","Wine","PC","RETAINED","MilGle"
1960,39.3,NA,"U","Wine","PC","RETAINED","MilGle"
1960,41.8,NA,"U","Wine","PC","RETAINED","MilGle"
1960,42.3,NA,"U","Wine","PC","RETAINED","MilGle"
1960,43.3,NA,"U","Wine","PC","RETAINED","MilGle"
1960,43.8,NA,"U","Wine","PC","RETAINED","MilGle"
1960,44.3,NA,"U","Wine","PC","RETAINED","MilGle"
1960,44.3,NA,"U","Wine","PC","RETAINED","MilGle"
1960,45.8,NA,"U","Wine","PC","RETAINED","MilGle"
1960,46.3,NA,"U","Wine","PC","RETAINED","MilGle"
1960,46.8,NA,"U","Wine","PC","RETAINED","MilGle"
1960,49.8,NA,"U","Wine","PC","RETAINED","MilGle"
1960,23,NA,"U","Central","PC","RETAINED","MilGle"

0 comments on commit d102a69

Please sign in to comment.