X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=pkg%2FR%2Futils.R;h=7e4e332b7465284d1d422b32bb9c19fa058c1a37;hb=f71b975b140342f7ea80275359b7f4f9aa75153a;hp=bb769967b328edba87f583b74eabb2e4df54a916;hpb=638f27f4296727aff62b56643beb9f42aa5b57ef;p=talweg.git diff --git a/pkg/R/utils.R b/pkg/R/utils.R index bb76996..7e4e332 100644 --- a/pkg/R/utils.R +++ b/pkg/R/utils.R @@ -78,6 +78,8 @@ getSimilarDaysIndices = function(index, data, limit, same_season, j = index + 1 while (length(days) < min( limit, ifelse(is.null(days_in),Inf,length(days_in)) )) { + if (i < 1 && j > data$getSize()) + break if (i >= 1) { dt = as.POSIXlt(data$getTime(i)[1]) @@ -111,6 +113,8 @@ getSimilarDaysIndices = function(index, data, limit, same_season, # .isSameSeason = function(month, month_ref) { +# if (month_ref == 3) #TODO: same as Bruno (but weird) +# return (month %in% c(2,3,4,9,10)) if (month_ref %in% c(11,12,1,2)) #~= mid-polluted return (month %in% c(11,12,1,2)) if (month_ref %in% c(3,4,9,10)) #~= high-polluted