Skip to content

Commit

Permalink
Merge branch 'hotfix/1.0.2'
Browse files Browse the repository at this point in the history
Test if yieldByfishery is defined before using it
  • Loading branch information
barriern committed Jan 8, 2020
2 parents 5b15d47 + ded5d55 commit 86301a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,7 +1,7 @@
Package: osmose
Type: Package
Title: Object Oriented Simulator of Marine Ecosystems
Version: 1.0.1
Version: 1.0.2
Date: 2019-09-19
Authors@R: c(
person("Yunne-Jai", "Shin", role="aut"),
Expand Down
18 changes: 10 additions & 8 deletions R/osmose2R.R
Expand Up @@ -60,14 +60,16 @@ osmose2R.v4r0 = function (path=NULL, species.names=NULL) {

)

# temporal
outputData$yield = aperm(apply(outputData$yieldByFishery, 2:4, sum, na.rm=TRUE),
perm = c(2,1,3))
rownames(outputData$yield) = seq_len(nrow(outputData$yield)) - 1
colnames(outputData$yield) = colnames(outputData$biomass)

class(outputData$yield) = "osmose.yield"
# end of temporal
if(!is.null(outputData$yieldByFishery)) {
# temporal
outputData$yield = aperm(apply(outputData$yieldByFishery, 2:4, sum, na.rm=TRUE),
perm = c(2,1,3))
rownames(outputData$yield) = seq_len(nrow(outputData$yield)) - 1
colnames(outputData$yield) = colnames(outputData$biomass)

class(outputData$yield) = "osmose.yield"
# end of temporal
}

model = list(version = "4",
model = .getModelName(path = path),
Expand Down

0 comments on commit 86301a8

Please sign in to comment.