Skip to content

Commit

Permalink
Fix for objects with no discards data in 1 area (pandalus, MC)
Browse files Browse the repository at this point in the history
  • Loading branch information
iagomosqueira committed Jan 25, 2023
1 parent df8a6f2 commit 0c8cdd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ss3om
Title: Tools for Conditioning Fisheries Operating Models Using Stock Synthesis 3
Version: 0.5.2.9002
Version: 0.5.2.9005
Authors@R: person("Iago", "Mosqueira", email = "[email protected]",
role = c("aut", "cre"))
Description: Tools for loading Stock Synthesis (SS3) models into FLR. Used in
Expand Down
12 changes: 11 additions & 1 deletion R/build330.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ buildFLSss330 <- function(out, morphs=out$morph_indexing$Index, name=out$Control
discards.wt <- catch.wt

if(!is.na(out["discard"])) {

# EXTRACT datage
datage <- data.table(out$discard_at_age)
setkey(datage, "Area", "Fleet", "Yr", "Seas", "Era", "Type")
Expand Down Expand Up @@ -149,6 +149,16 @@ buildFLSss330 <- function(out, morphs=out$morph_indexing$Index, name=out$Control
idx <- is.na(discards.wt) | discards.wt == 0
if(any(idx))
discards.wt[idx] <- c(mdiscards.wt)[c(idx)]

# EXPAND discards FLQuants for areas / seasons with no data
discards.n <- expand(discards.n, area=dimnames(catch.n)$area,
season=dimnames(catch.n)$season)

# EXPAND discards FLQuants for areas / seasons with no data
discards.n <- expand(discards.n, area=dimnames(catch.n)$area,
season=dimnames(catch.n)$season)
discards.wt <- expand(discards.wt, area=dimnames(catch.n)$area,
season=dimnames(catch.n)$season)
}
}

Expand Down

0 comments on commit 0c8cdd4

Please sign in to comment.