Returns a vector with the cumulative sum of the maximum length of wet spell (MLWS)

cumrain(x)

Arguments

x

a numeric vector

Value

a vector with the cumulative sum of MLWS

Examples


# Example 1

rain <- c(0,0.2,1.4,6.1,1.4,5.1,1.5,1.6,0.1,0,7,6,4,6,1.1,1.2,1.5,0)

cumrain(rain)
#>  [1] 0 0 1 2 3 4 5 6 6 6 6 6 6 6 6 6 7 7

# should return this vector
# raincum <- c(0,0,1,2,3,4,5,6,6,6,6,6,6,6,6,6,7,7)

# Example 2

rain2 <- c(1,0,1,1,0,0,1,1,1,0,0,1,1)

cumrain(rain2)
#>  [1] 1 1 1 2 2 2 2 2 3 3 3 3 3

# should return this 
# raincum2 <- c(1,1,1,2,2,2,2,2,3,3,3,3,3)