README.md

airportweather

Build Status Coverage status

The goal of airportweather is to read the current weather component(s) from "https://w1.weather.gov/xml/current_obs/" and record the information as a data frame or plot it on a US map. Find more information at "https://floatgreen.github.io/airportweather/".

Installation

You can download the package "airportweather" from github, then install (build) it with ctrl+shift+B.

Or you can also install the package using devtools:

library(devtools)
install_github("floatgreen/airportweather")

Example

Followings are some examples which show you how to use this package: Read the data of one airport. If the components' names do not exist or the data is missing, the result data frame shows NA(s).

current_weather("KAMW", c("wind_mph", "temp_f", "haha"))
current_weather("KAMW", "temp_c")

Read the data of many airports.

current_weather_more(c("KAMW", "KAIO", "KCID", "KCNC"), c("temp_f"))
current_weather_more(c("KAMW", "KAIO", "KCID", "KCNC"), c("temp_f", "wind_mph"))

Plot one numerical component of several airports on the map of US.

plot_weather_num(c("KAMW", "KAIO", "KCID", "KCNC"),
                 type = "temp_c")
plot_weather_num(c("KAMW", "KAIO", "KCID", "KCNC"),
                 type = "temp_f",
                 label = F)

Plot one categorical component of the airports chosen by user on the map of US.

plot_weather_cat(c("KAMW", "KAIO", "KCID", "KCNC"),
                 type = "wind_dir")
plot_weather_cat(c("KAMW", "KAIO", "KCID", "KCNC"),
                 type = "weather",
                 label = F)            

Plot one component of all airports on the map of US with contour lines. It takes a couple of seconds to run. The component has to be continuous.

plot_weather_us(type = "temp_c", bin = 0.5)

Retrieve history weather and temperature data for 3 days of one airport location.

obhistory("KAMW")

Plot the air temperature history for 3 days of one airport location.

plot_temp_history("KORD")

Shiny app

Launch shiny spp, and you should see the panel as below

runShiny()

alt text

Choose the airport code by typing the letter or just choose from the menu. When you type code, city or state, the menu will show all choice with your enter. You just need to know the state or city of the airport if you don't know the airport code. You can choose multiple airports.

alt text

Choose the weather feature by clicking on the box. You can also choose several weather feature on this panel.

alt text

After selection of airport code and weather feature, a map with the airport position will be shown below the tab Weather information on map. The map shows the airports you selected, with the selected weather information on the points. You can also drag, zoom in or zoom out the map.

alt text

Below the map, you can also see a table with selected weather information as well as airport location information for the selected airport.

alt text

When you switch to the tab History weather at one location, you will see a reminder if you choose more than one location. The tab shows the latest 72h temperature for an airport, so you can only choose one location.

alt text

The history temperature plot shows 3 days temperature records, which presented as three different colors.

alt text

A detailed temperature history table is shown below the temperature plot. It includes all temperature records for every hour. You can also search a certain time, weather or temperature in the search box.

alt text



floatgreen/airportweather documentation built on May 14, 2019, 3:06 a.m.