'update'
[talweg.git] / pkg / R / utils.R
index ddf0bb1..b0d0ae0 100644 (file)
@@ -115,3 +115,18 @@ getSimilarDaysIndices = function(index, data, limit, same_season, days_in=NULL)
                return (day %in% 1:4)
        return (day == day_ref)
 }
+
+# getNoNA2
+#
+# Get indices in data of no-NA series followed by no-NA, within [first,last] range.
+#
+# @inheritParams dateIndexToInteger
+# @param first First index (included)
+# @param last Last index (included)
+#
+.getNoNA2 = function(data, first, last)
+{
+       (first:last)[ sapply(first:last, function(i)
+               !any( is.na(data$getCenteredSerie(i)) | is.na(data$getCenteredSerie(i+1)) )
+       ) ]
+}