Cold Summer in Davis, CA?
August 30th, 2010I think everyone will agree that the summer of 2010 has been unusual. Spells of heat, long spells of cool, rain, and wind have all been experienced. The one thing we haven't had is an extended heat wave. But has Davis been appreciably cooler than previous years?
Using the cimis package for R, I put together the following graph. In the graph, the response variable is cumulative degree day - a measure of the amount of heat accumulated throughout the year. It starts in May and goes through July. August will be added as soon as August data becomes available from CIMIS. The heavier red line is 2010 and the lighter lines are the years 2000 - 2009 (see legend).
It appears that is has been the coolest year in the last decade so far. 2004 was also on the cool side. So there you go - 2010 has been cooler than normal.
The code to generate the above graph is included below. The explicit loop was used because for some reason con() was throwing an error when including cimismonthly inside of an lapply().
#coolness of 2010
library(lattice)
library(cimis)
prev = mcimisannual("006", 2000:2009)
prev.s = split(prev, prev$year)
cdd = function(df){
keep = months(df$datetime) %in% c("May", "June", "July")
dd = df$avg_air[keep]
dd[is.na(dd)] = 0
dd = dd - 50
cdd = cumsum(ifelse(dd < 0, 0, dd))
}
prev.cdd = lapply(prev.s, cdd)
prev.df = data.frame(day = rep(1:92, times = 10),
cdd = unlist(prev.cdd), year = rep(2000:2009, each = 92))
thismonths = c("may", "jun", "jul", "aug")
this = vector("list", 4)
for(i in 1:4){
this[[i]] = cimismonthly("006", thismonths[i])
}
#august from last year until done
this = this[-4]
this.cdd = cdd(do.call("rbind", this))
xyplot(cdd ~ day, groups = year,
data = prev.df, type = "l",
panel = function(...){
panel.xyplot(...)
panel.xyplot(x = seq(this.cdd), y = this.cdd,
col = "red", lwd = 2, type = "l")
},
auto.key=list(columns = 5),
xlab = c("day starting May 1"),
ylab = "cumulative degree day"
)



















