Monthly Weather in Netherlands
[This article was first published on Wiekvoet, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
When I downloaded the KNMI meteorological data, the intention was to do something which takes more than just the computers memory. While it is clearly not big data, at the very least 100 years of daily data is not small either. So I took along a load of extra variables to see what trouble I would run into. I did not run out of memory, but did make some figures. Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Data
Data are acquired from KNMI. They have various sets of data, this page has a selection form which leads to the data used today. The data comes with a header explaining details, unfortunately in Dutch.Plots
Just about everybody knows days are shorter in winter. What I never realized, even within that shorter day, we get less daylight. The short days are often so clouded, we don’t get sun, meanwhile, in summer the sun does shine a bigger part of the daylight period.In real hours sunshine this results in the following plot. December clearly has the darkest hours.
What we do get, not surprising since Dutch weather is fairly similar to English weather, is rain. Not continuous rain, most of the time it is dry, but still, autumn and winter do have days where it does not seem to stop. Autumn has the bad reputation for rain, but this plot makes winter look particular bad.
All this rain gives a load of humidity. This humidity in its turn, gives rise to a weather we name ‘waterkoud’. It is above zero C but still quite cold outside. The humidity makes for air with a high heat capacity, hence one cools down quickly. Temperatures below zero can make for much nicer weather, but that can hamper traffic quite a lot. Most of the time it just doesn’t freeze.
Code
library(plyr)
library(dplyr)
library(ggplot2)
r1 <- read.csv('KNMI_20141115.edited.txt')
Sys.setlocale(category = “LC_TIME”, locale = “C”)
r2 <- mutate(r1,
date = as.Date(format(YYYYMMDD),’%Y%m%d’),
month =factor(months(date,abbreviate=TRUE),
levels=months(as.Date(
paste(‘2014’,
formatC(1:12,digits=2,width=2,flag=’0′),
’01’,sep=’-‘)),
abbreviate=TRUE)),
yearf=factor(format(date,’%Y’)),
yearn=as.numeric(substr(YYYYMMDD,1,4)),
day=format(date,’%e’))
g1 <- ggplot(r2,aes(x=month,y=SP))
g1 + geom_violin() +
ylab(‘% of longest possible sunshine’)
g1 <- ggplot(r2,aes(x=month,y=SQ/10))
g1 + geom_violin() +
ylab(‘Sunshine duration (h)’)
g1 <- ggplot(r2,aes(x=month,y=DR/10))
g1 + geom_violin() +
scale_y_continuous(‘Precipitation Duration (h)’,
breaks=c(0,6,12,18,24))
g1 <- ggplot(r2,aes(x=month,y=UG))
g1 + geom_violin() +
ylab(‘Relative Humidity (%)’)
g1 <- ggplot(r2,aes(x=month,y=TG/10))
g1 + geom_violin() +
ylab(‘Temperature (C)’)
To leave a comment for the author, please follow the link and comment on their blog: Wiekvoet.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.