524119 données collectées en 2015 depuis une station WMR200.

library(RSQLite)
library(tidyr)
library(dplyr)
library(ggplot2)
library(scales)

con <- dbConnect(SQLite(), "weewx_20160312.sq3")
rs <- dbSendQuery(con, "
  SELECT 
    dateTime AS epoch,
    rain * 25.4 AS rr,
    ((outTemp - 32) / 1.8) AS tt, 
    barometer * 33.86389 AS pp
  FROM archive 
  WHERE dateTime BETWEEN strftime('%s','2015-01-01 00:00:00') AND strftime('%s','2015-12-31 23:59:59')
")
df <- fetch(rs, n = -1)
dbHasCompleted(rs)
dbClearResult(rs)
dbDisconnect(con)

df <- df %>% 
  mutate(date =  as.POSIXct(epoch, origin = "1970-01-01", tz = "GMT"), 
         doy = as.numeric(strftime(date, format = "%j"))) 


meteo_jour <- df %>% 
  group_by(doy) %>% 
  summarise(tm = mean(tt, na.rm = TRUE), 
            tn = min(tt, na.rm = TRUE),
            tx = max(tt, na.rm = TRUE),
            rr = sum(rr, na.rm = TRUE),
            pm = mean(pp, na.rm = TRUE)) %>% 
  mutate(date = as.Date(paste0("2015-", doy), format = "%Y-%j"))



ggplot(meteo_jour, aes(date, ymin = tn, ymax = tx)) + 
  geom_linerange(aes(color = tm), size = 1.5, alpha = 1) +
  geom_point(aes(date, 40, size = meteo_jour$rr), color = "blue", alpha = 0.2) +
  scale_size_area(max_size = 40, name = "Précipitations (mm)") +
  scale_colour_gradient2(low = muted("blue"), mid = "white", high = muted("red"), midpoint = mean(meteo_jour$tm), name = "Température moyenne (°C)") +
  scale_x_date(labels = date_format("%b"), breaks = date_breaks("month")) + 
  ylim(min(meteo_jour$tn), max(meteo_jour$tx)) + 
  labs(title = "Talissieu 2015 - Précipitations, minima et maxima de température journaliers", x = "", y = "°C") +
  coord_polar() + 
  theme(legend.position = "bottom", legend.key = element_rect(fill = NA, colour = NA, size = 0.25))