Description Usage Arguments Value Functions Examples
View source: R/get_station_data.R
These functions are designed to take NOAA weather data organized in .dly format, extract snow depth, WESD, or other climate information, and return a neatly organized data frame.
1 2 3 4 5 | get_station_data(stations, source, elem = c("SNWD", "WESD"), progress = TRUE)
get_state_data(states, source, elem = c("SNWD", "WESD"), progress = TRUE)
get_region_data(eco_regions, source, elem = c("SNWD", "WESD"), progress = TRUE)
|
stations |
A vector of station identification codes. See the internal data set ghcnd_stations for station id's and descriptions. |
source |
If downloading from the web, source should be "ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/all/". |
elem |
The climate variables to extract. Default is snow depth in mm ("SNWD") and water depth equivalent of snowfall in mm ("WESD"). For other climate variables see section three of ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt. |
progress |
If true, a text progress bar is printed to the console. Only relevant when more than one station is requested. |
states |
A vector of states, see the internal data set ghcnd_stations for valid states and associated stations. |
eco_regions |
A vector of eco_regions, see the internal data set ghcnd_stations for valid eco_regions and associated stations. eco_regions can be either level 3 eco regions (e.g. "8.2.4"), level 2 regions (e.g. "8.2"), or level 1 regions (e.g. "8"). |
A data.frame where each row is a measurement of a climate variable in elem for a single day and station. Columns are:
ID - The station identification code. See the internal data set ghcnd_stations for station id's and descriptions.
DATE - The date of the measurement.
ELEMENT - The climate variable measured. See ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt, section 3 for a description of climate variables.
VALUE - The measurement of the ELEMENT on the given DATE.
MFLAG - A measurement flag. See ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt, section 3 for a description of the flag.
QFLAG - A quality flag. See ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt, section 3 for a description of the flag.
SFLAG - A source flag. See ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt, section 3 for a description of the flag.
ECO3 - Identifier for the EPA level 3 ecoregion where the station is located.
get_station_data
: Uses station identification codes to gather
data from the proper .dly files.
get_state_data
: Wrapper for get_station_data that extracts all
station data for a given state(s) by passing all stations from internal
data source ghcnd_stations with corresponding state(s).
get_region_data
: Wrapper for get_station_data that extracts all
station data for a given eco region(s) by passing all stations from internal
data source ghcnd_stations with corresponding eco region(s).
1 2 | get_station_data(ghcnd_stations$ID[10000],
"ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/all/")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.