Loads and cleans weather data for a given NOAA station ID and year. Returns a dataframe containing a time series of air temperature, atmospheric pressure, wind speed, and wind direction the NOAA FTP server at ftp://ftp.ncei.noaa.gov/pub/data/noaa/.

get_weather_data(station_number, year)

Arguments

station_number

character

year

integer

Value

data.frame

Details

station_number is a combination of the USAF station ID and the NCDC WBAN number in the form '(USAF ID)-(WBAN ID)'. If a WBAN ID does not exist, a value of '99999' should be used in its place.

Examples

get_weather_data('911803-99999', 2015)
#> # A tibble: 6 x 6 #> stn datetime air_temp atm_press wind_spd wind_dir #> <chr> <dttm> <dbl> <dbl> <dbl> <dbl> #> 1 911803-99999 2015-05-15 04:48:00 250 990. 25.7 340 #> 2 911803-99999 2015-05-15 05:55:00 251 986. 26.8 340 #> 3 911803-99999 2015-05-15 06:12:00 250 986. 28.3 340 #> 4 911803-99999 2015-05-15 07:18:00 250 980. 32.9 340 #> 5 911803-99999 2015-05-15 07:55:00 251 976 32.4 340 #> 6 911803-99999 2015-05-15 09:00:00 253 972. 34 310