CHIRPS

Monthly variabliity

library(RODBC)
library(ggplot2)
library(mgcv)
## Loading required package: nlme
## This is mgcv 1.7-27. For overview type 'help("mgcv-package")'.
con <- odbcConnect("clima")

##

query <- "select * from chirps.by_mun"
d <- sqlQuery(con, query)
library(ggplot2)
aa <- split(d, d$nom_mun)

f <- function(d) {
    d <- subset(d, d$yr < 2014)
    g0 <- ggplot(d, aes(x = fdate, y = prec))
    g1 <- g0 + geom_line() + facet_wrap(~nom_mun) + geom_smooth(method = "loess")
    print(g1)
    g0 <- ggplot(d, aes(x = mn, y = prec))
    g1 <- g0 + geom_line() + facet_wrap(~yr)
    print(g1)
    g0 <- ggplot(d, aes(x = mn, y = prec, color = as.factor(yr)))
    g1 <- g0 + geom_line()
    print(g1)
    prec <- ts(d$prec, start = c(1981, 1), frequency = 12)
    a <- stl(prec, s.window = 12)
    plot(a)
}
lapply(aa[1:20], f)

plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4 plot of chunk unnamed-chunk-4