Created
March 14, 2013 12:49
aggregate daily rainfall time series to 16 day temporal resolution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## x: daily rainfall time series | |
## lindex: date stamps of the MOD13 VI product time series | |
## rindex = lindex + 15 | |
## TODO: increase the efficiency by replace the loop use sapply | |
fun.aggre16d <- function(x, lindex, rindex) { | |
v.16d.rain <- vector('numeric', length(lindex)) | |
for (i in 1:length(lindex)) { | |
v.16d.rain[i] <- sum(x[lindex[i]:rindex[i]], na.rm = T) | |
} | |
return(v.16d.rain) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment