daily_stations: NOAA NCDC station IDs per county.

View source: R/daily_helpers.R

daily_stationsR Documentation

NOAA NCDC station IDs per county.

Description

Returns a dataframe with NOAA NCDC station IDs for a single U.S. county. This function has options to filter stations based on maximum and minimum dates, as well as percent data coverage.

Usage

daily_stations(
  fips,
  date_min = NULL,
  date_max = NULL,
  limit_20_longest = FALSE,
  exclude_less_than_one_year = TRUE
)

Arguments

fips

A string with the five-digit U.S. FIPS code of a county in numeric, character, or factor format.

date_min

A string with the desired starting date in character, ISO format ("yyyy-mm-dd"). The dataframe returned will include only stations that have data for dates including and after the specified date. In other words, if you specify that this equals "1981-02-16", then it will return only the stations with at least some data recorded after Feb. 16, 1981. If a station stopped recording data before Feb. 16, 1981, it will be removed from the set of stations. If not specified, the function will include available stations, regardless of the date when the station started recording data.

date_max

A string with the desired ending date in character, ISO format ("yyyy-mm-dd"). The dataframe returned will include only stations that have data for dates up to and including the specified date. If not specified, the function will include available stations, regardless of the date when the station stopped recording data.

limit_20_longest

A logical value, indicating whether the stations should be limited to the 20 with the longest records of data (otherwise, there may be so many stations that it will take extremely long to pull data from all of them). The default is FALSE, but you may want to change to TRUE if it is taking a long time to pull your data.

exclude_less_than_one_year

A logical value, indicating whether stations with less than one year's worth of data should be automatically excluded. The default value is TRUE.

Value

A dataframe with NOAA NCDC station IDs for a single U.S. county.

Note

Because this function uses the NOAA API to identify the weather monitors within a U.S. county, you will need to get an access token from NOAA to use this function. Visit NOAA's token request page (http://www.ncdc.noaa.gov/cdo-web/token) to request a token by email. You then need to set that API code in your R session (e.g., using options(noaakey = "your key"), replacing "your key" with the API key you've requested from NOAA). See the package vignette for more details.

Examples

## Not run: 
stations_36005 <- daily_stations("36005")
stations_36005

miami_stations <- daily_stations("12086", date_min = "1999-01-01",
                                 date_max = "2012-12-31")
miami_stations

## End(Not run)


leighseverson/countyweather documentation built on April 9, 2022, 11:38 a.m.