Skip to content

Commit

Permalink
Bug fix to GISSM
Browse files Browse the repository at this point in the history
 function ‘get.DoyMostFrequentSuccesses’ didn’t work correctly when
quantiles interpolated
—> type 3 (even order statistic) instead of type 7


Former-commit-id: 406c234
  • Loading branch information
dschlaep committed Sep 12, 2016
1 parent 3f5d3bb commit e3907b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 2_SWSF_p4of5_Code_v51.R
Original file line number Diff line number Diff line change
Expand Up @@ -5361,7 +5361,7 @@ do_OneSite <- function(i_sim, i_labels, i_SWRunInformation, i_sw_input_soillayer
#Days of year (in normal count) of most frequent successes among years: #toDoy <- function(x) sort(ifelse((temp <- x+Doy_SeedDispersalStart-1) > 365, temp-365,temp)) #convert to normal doys
res1.dy <- aggregate(temp1, by=list(doy_ForEachUsedRYDay), FUN=sum)[, -1]
get.DoyMostFrequentSuccesses <- function(doys){
res1.max <- sapply(1:2, FUN=function(x) quantile(doys[doys[, x]>0, x], probs=c(0.1, 1), type=7))
res1.max <- sapply(1:2, function(x) quantile(doys[doys[, x] > 0, x], probs = c(0.1, 1), type = 3)) # must return one of the values because the quantiles are compared against the values in function 'get.DoyAtLevel'
get.DoyAtLevel <- function(x, level) which(x == level & x > 0)
if(all(!temp1[, 1])){#no successful germination
germ.doy <- list(NA, NA)
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: SWSF
Title: SOILWAT Simulation Framework
Version: 1.4.2
Date: 2016-09-04
Version: 1.4.3
Date: 2016-09-09
Authors@R: c(person("Daniel", "Schlaepfer", email = "[email protected]", role = c("aut", "cre")),
person("Ryan", "Murphy", role = "ctb", email = "[email protected]"))
Description: An R wrapper for simulation experiments with SOILWAT
Expand Down

0 comments on commit e3907b3

Please sign in to comment.