This function generates a dataframe similar to the
weather
dataset from nycflights13
for any US airports and time frame. Please
note that, even with a strong internet connection, this function
may take several minutes to download relevant data.
Source
ASOS download from Iowa Environmental Mesonet, https://mesonet.agron.iastate.edu/request/download.phtml
Arguments
- station
A character vector giving the origin US airports of interest (as the FAA LID airport code).
- year
A numeric giving the year of interest. This argument is currently not vectorized, as dataset sizes for single years are significantly large. Information for the most recent year is usually available by February or March in the following year.
- month
A numeric giving the month(s) of interest.
- dir
An optional character string giving the directory to save datasets in. By default, datasets will not be saved to file.
Value
A data frame with ~1k-25k rows and 15 variables:
origin
Weather station. Named
origin
to facilitate merging with flights datayear, month, day, hour
Time of recording, UTC
temp, dewp
Temperature and dewpoint in F
humid
Relative humidity
wind_dir, wind_speed, wind_gust
Wind direction (in degrees), speed and gust speed (in mph)
precip
Precipitation, in inches
pressure
Sea level pressure in millibars
visib
Visibility in miles
time_hour
Date and hour of the recording as a
POSIXct
date, UTC
See also
get_flights
for flight data,
get_airlines
for airlines data,
get_airports
for airports data,
get_planes
for planes data,
or anyflights
for a wrapper function.
Use the as_flights_package
function to convert this dataset
to a data-only package.
Examples
# query weather at Portland International in June 2018
if (FALSE) get_weather("PDX", 2018, 6)
# ...or the original nycflights13 weather dataset
if (FALSE) get_weather(c("JFK", "LGA", "EWR"), 2013)
# use the dir argument to indicate the folder to
# save the data in as "weather.rda"
if (FALSE) get_weather("PDX", 2018, 6, dir = tempdir())