knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)

fmir

Travis build status Coverage status lifecycle

fmir provides simple tools for easily accessing up to date, open weather data from Finland. The data are made available by the Finnish Meteorological Institute and are licensed under CC-BY 4.0. See FMI's open data manual for details.

Key features in fmir include:

FMI provides varying types of data in several different formats in their API, implemented using OGC Web Feature Service (WFS). Currently the only format supported by fmir is the "simple" weather format. For a more comprehensive and feature-rich package for accessing the FMI API, check out https://github.com/rOpenGov/fmi.

Installation

At the moment, the easiest way to install fmir is from github with devtools:

# install.packages("devtools")
devtools::install_github("mikmart/fmir")

Usage

You can construct query URLs to the API with fmi_query(), and then execute them with fmi_data(). A simple query with only a place parameter will return weather observations with a 10-minute interval for the past 12 hours:

library(fmir)
library(ggplot2)

# generate a query url with fmi_query
q <- fmi_query(place = c("Espoo", "Oulu", "Rovaniemi"))

# download the data corresponding to your query
weather <- fmi_data(q)
weather

# draw a simple line graph of the recent temperature
ggplot(weather, aes(time, t2m)) + geom_line(aes(colour = place))

In the wild

For a real use-case, check out Pasi Haapakorva's blog post (in Finnish) looking at the trend in monthly average temperatures in Oulu in 1955--2018. Spoiler alert: it's been getting warmer.



mikmart/fmir documentation built on Feb. 28, 2021, 6:53 p.m.