Skip to content

Commit

Permalink
#35 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainschmitt authored Jun 13, 2019
2 parents 04e4c96 + b82da28 commit 48c4648
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SSDM 0.2.5.9000
===============

- #46 fixed
- Fixed division by zero bug (NA propagation) in `project`

SSDM 0.2.5
===============
Expand Down
4 changes: 2 additions & 2 deletions R/project.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ setMethod("project", "Algorithm.SDM", function(obj, Env, ...) {
# Rescaling projection
proj = reclassify(proj, c(-Inf, 0, 0))
if(all(obj@data$Presence %in% c(0,1))) # MEMs should not be rescaled
proj = proj / proj@data@max
if(proj@data@max > 0) proj = proj / proj@data@max
names(proj) = "Projection"
obj@projection = proj
if(all(obj@data$Presence %in% c(0,1))) # MEMs can't produce binary
Expand All @@ -55,7 +55,7 @@ setMethod("project", "MAXENT.SDM", function(obj, Env, ...) {
# Rescaling projection
proj = reclassify(proj, c(-Inf, 0, 0))
if(!all(obj@data$Presence %in% c(0,1))) # MEMs should not be rescaled
proj = proj / proj@data@max
if(proj@data@max > 0) proj = proj / proj@data@max
names(proj) = "Projection"
obj@projection = proj
if(all(obj@data$Presence %in% c(0,1))) # MEMs can't produce binary
Expand Down

0 comments on commit 48c4648

Please sign in to comment.