This doucment presents an simple example of a national climate monitoring using EOBS and eobsR. The idea is that one can do a national analysis using the following steps:

period <- '2014'

Mean temperature in the Netherlands for r period

library(doParallel)
registerDoParallel(1)
library(eobsR)
library(ggplot2)
adm0 <- raster::getData('GADM', country='NL', level=0)
fadm0 = fortify(adm0)
data  <- importEOBS('tg', period, adm0, "0.50reg")
meanData <- data[, .(TGG = mean(tg)), by = .(lon, lat)]
ggplot(fadm0, aes(x = long, y = lat, group = group)) +
  geom_path() +
  coord_map() +
  geom_tile(aes(x =lon, y = lat, fill = TGG, group = NULL),
            alpha=0.5,
            data = meanData) +
  scale_fill_distiller(type='div', palette='RdBu', trans='reverse',
                       guide = guide_legend(reverse=TRUE))

Mean summer temperature in the Netherlands for r period

summer <- c(6,7,8)
setkey(data, month)
meanData <- data[month %in% summer, .(TGG = mean(tg)), by = .(lon, lat)]
ggplot(fadm0, aes(x = long, y = lat, group = group)) +
  geom_path() +
  coord_map() +
  geom_tile(aes(x =lon, y = lat, fill = TGG, group = NULL),
            alpha=0.5,
            data = meanData) +
  scale_fill_distiller(type='div', palette='RdBu', trans='reverse',
                       guide = guide_legend(reverse=TRUE))

Mean temperature in the Netherlands and Belgium for r period

library(sp)
adm01 <- raster::getData('GADM', country='NL', level=0)
adm02 <- raster::getData('GADM', country='Belgium', level=0)
adm0  <- rbind(as(adm01, 'SpatialPolygons'), as(adm02, 'SpatialPolygons'), makeUniqueIDs=TRUE)
fadm0 = fortify(adm0)
data  <- importEOBS('tg', period, adm0, "0.50reg")
meanData <- data[, .(TGG = mean(tg)), by = .(lon, lat)]
ggplot(fadm0, aes(x = long, y = lat, group = group)) +
  geom_path() +
  coord_map() +
  geom_tile(aes(x =lon, y = lat, fill = TGG, group = NULL),
            alpha=0.5,
            data = meanData) +
  scale_fill_distiller(type='div', palette='RdBu', trans='reverse',
                       guide = guide_legend(reverse=TRUE))
stopImplicitCluster()


MartinRoth/eobsR documentation built on May 7, 2019, 3:38 p.m.