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'
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))
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))
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.