knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", fig.width = 9, fig.height = 6 )
The goal of metar is to provide an R-built parser for METAR reports. Find more information about METAR under https://en.wikipedia.org/wiki/METAR
Install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("m-saenger/metar", upgrade = "never")
Install the latest stable version from GitHub with:
# install.packages("devtools") devtools::install_github("m-saenger/metar@0.9.0", upgrade = "never")
This package depends on data.table, stringr, readr and lubridate.
library(metar) ## read raw data from Mesonet website dat <- read_metar_mesonet("LSZH", date_start = "2021-03-15", date_end = "2021-03-28") ## parse METAR code dat.parsed <- parse_metar(x = dat$metar, t = dat$valid) # Structure (subset of columns) print(dat.parsed[1:10, .(metar, tt, qnh)])
library(data.table) # Structure (subset of columns and rows) print(metar.para[1:10, .(id_para, name_para)])
library(ggplot2) ggplot(dat.parsed, aes(time, tt)) + geom_path() + labs(title = "Recent Temperature at LSZH Airport") + theme_bw()
# Process cloud groups (1-4) dat.cld <- parse_metar_cld(dat.parsed$cld) dat.cld$time <- dat.parsed$time # Structure (subset of columns) print(dat.cld[1:10, .(time, cld_lay, cld_amt_1, cld_hgt_1, cld_type_1 )]) ggplot(dat.cld, aes(time, cld_hgt_1)) + geom_path() + labs(title = "Altitude of Lowest Cloud Level at LSZH Airport") + theme_bw()
# Parse present weather group dat.pw <- dat.parsed[, parse_metar_pw(pw)] # Structure (subset of columns) print(dat.pw[1:10, .(pw_grp_1, pw_grp_2, PP_SOLID, PP_LIQUID, sigwx)]) # Bind data dat.plot <- cbind(dat.parsed, dat.pw) plot_metargram(dat = dat.plot)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.