Skip to content

Commit

Permalink
Added useLanded argument for foreign data
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Lucey committed Nov 30, 2023
1 parent 27bbbb1 commit c474f48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/get_comland_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ get_comland_data <- function(channel, filterByYear = NA,
#Pull data and process to look like comland data
comland.foreign <- comlandr::get_foreign_data(filterByYear, filterByArea)
comland.foreign <- comlandr::process_foreign_data(channel, comland.foreign,
useHerringMaine)
useLanded, useHerringMaine)

#Combine foreign landings
comland$comland <- data.table::rbindlist(list(comland$comland, comland.foreign),
Expand Down
5 changes: 4 additions & 1 deletion R/process_foreign_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#'
#'@export

process_foreign_data <- function(channel, nafoland, useHerringMaine){
process_foreign_data <- function(channel, nafoland, useLanded = T, useHerringMaine = T){

## All code copied directly from nafo_comland
nafoland <- nafoland[Divcode %in% c(47, 51:56, 61:63) & Code > 3, ]
Expand Down Expand Up @@ -116,6 +116,9 @@ process_foreign_data <- function(channel, nafoland, useHerringMaine){
#remove species without a match
nafoland <- nafoland[!is.na(NESPP3), ]

#Convert scallops to meat weight
if(useLanded) nafoland[NESPP3 == 800, SPPLIVMT := SPPLIVMT / 8.33], ]

#Remove herring catch - if pulling using comlandr::get_herring_data()
if(useHerringMaine) nafoland <- nafoland[NESPP3 != 168, ]

Expand Down

0 comments on commit c474f48

Please sign in to comment.