Skip to content

Commit

Permalink
fixing biomass pull to use flat files rather than survdat
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Lucey committed Nov 30, 2023
1 parent 6d5f9e3 commit 7e91e17
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions data-raw/R/GBRpath_biomass_pull.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ library(dbutils); library(DBI); library(sf); library(survdat)
#Connect to the database
channel <- dbutils::connect_to_database('sole', 'slucey')

scall <- survdat::get_survdat_scallop_data(channel, getWeightLength = T)
#scall <- survdat::get_survdat_scallop_data(channel, getWeightLength = T)
load(here::here('data', 'survdatScallops.RData'))

#Scallop survey did not record weight prior to 2001 (FSCS) so need to manually
#calculate catch weights
scalldat <- scall$survdat[, BIOMASS := sum(WGTLEN), by = c('YEAR', 'STATION')]
scalldat <- scallops$survdat[, BIOMASS := sum(WGTLEN), by = c('YEAR', 'STATION')]

#Calculate scallop index
#use poststrat to assign to EPU
Expand Down Expand Up @@ -78,12 +79,12 @@ bio.input[RPATH == 'AtlScallop', B := scall.input[, B]]


#Clam survey--------------------------------------------------------------------
clam <- survdat::get_survdat_clam_data(channel)
#clam <- survdat::get_survdat_clam_data(channel)
load(here::here('data', 'survdatClams.RData'))

#Use GB clam region to calculate biomass
clam.mean <- clam$data[!is.na(SVSPP) & clam.region == 'GB',
clam.index <- clams$data[!is.na(SVSPP) & clam.region == 'GB',
.(B = mean(BIOMASS.MW, na.rm = T)), by = c('YEAR', 'SVSPP')]
clam.index <- clam.mean[, .(B = sum(B)), by = YEAR]

#Need to expand from kg/tow to mt/km^2
# Clam tows can vary greatly by I'll use an example tow as the expansion
Expand Down
4 changes: 2 additions & 2 deletions data-raw/R/generic_scallop_clam_survey_pull.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ clams <- survdat::get_survdat_clam_data(channel)

save(clams, file = here('data', 'survdatClams.RData'))

scallops <- survdat::get_survdat_scallop_data(channel)
scallops <- survdat::get_survdat_scallop_data(channel, getWeightLength = T)

save(scallops, file = here('data', 'survdatScallops.RData'))
save(scallops, file = here::here('data', 'survdatScallops.RData'))

Binary file modified data/survdatScallops.RData
Binary file not shown.

0 comments on commit 7e91e17

Please sign in to comment.