hourly_fips: Return average hourly weather data and a plot showing the...

Description Usage Arguments Value Note Examples

View source: R/hourly_fips.R

Description

Given a particular county FIPS code, this function returns a list with two elements: data, a dataframe of hourly average weather values, and plot, a plot showing the location of weather stations contributing to the average weather in data.

Usage

1
2
hourly_fips(fips, year, var = "all", coverage = NULL, average_data = TRUE,
  station_label = FALSE, verbose = TRUE)

Arguments

fips

A character string of the five-digit U.S. FIPS code of a U.S. county.

year

A four-digit number or vector of numbers indicating the year or years for which you want to pull hourly data. Values for year can be in the range from 1901 to the current year.

var

A character vector specifying desired weather variables. For example, var = c("wind_speed", "temperature") pulls data on hourly wind speed and temperature. The core weather variables available include "wind_direction", "wind_speed", "ceiling_height", "visibility_distance", "temperature", "temperature_dewpoint", "air_pressure". Alternatively, you can specify var = "all" to include additional flag and quality codes.

coverage

A numeric value in the range of 0 to 1 that specifies the desired percentage coverage for the weather variable (i.e., what percent of each weather variable must be non-missing to include data from a monitor when calculating daily values averaged across monitors).

average_data

TRUE / FALSE to indicate if you want the function to average daily weather data across multiple monitors.

station_label

TRUE / FALSE to indicate if you want your plot of weather station locations to include labels indicating station usaf id numbers.

verbose

TRUE / FALSE to indicate if you want the function to print out the name of the county it's processing.

Value

A list with six elements. The first element (hourly_data) is a dataframe of daily weather data averaged across multiple stations, as well as columns ("var"_reporting) for each weather variable showing the number of stations contributing to the average for that variable for that hour. The second element (station_metadata) is a dataframe of station metadata for stations included in the daily_data dataframe, as well as statistical information about the values contriuted to each weather variable by each station. The third element (station_map) is a plot showing points for all weather stations for a particular county satisfying the conditions present in hourly_fips's arguments (year, coverage, and/or weather variables). radius is the calculated radius within which stations were pulled from the county's center. Elements lat_center and lon_center are the latitude and longitude of the county's center.

Note

Observation times are based on Coordinated Universal Time Code (UTC).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 

ex <- hourly_fips("12086", coverage = 0.90, year = c(1994, 1995),
                   var = "temperature")

data <- ex$hourly_data
station_data <- ex$station_metadata
station_map <- ex$station_map

## End(Not run)

countyweather documentation built on May 29, 2017, 9:10 a.m.