ghcnd_search | R Documentation |
This function uses ftp to access the Global Historical Climatology Network daily weather data from NOAA's FTP server for a single weather monitor site. It requires the site identification number for that site and will pull the entire weather dataset for the site. It will then clean this data to convert it to a tidier format and will also, if requested, filter it to a certain date range and to certain weather variables.
ghcnd_search(
stationid,
date_min = NULL,
date_max = NULL,
var = "all",
refresh = FALSE,
...
)
stationid |
(character) A character vector giving the identification of
the weather stations for which the user would like to pull data. To get a full
and current list of stations, the user can use the |
date_min |
A character string giving the earliest date of the daily weather time series that the user would like in the final output. This character string should be formatted as "yyyy-mm-dd". If not specified, the default is to keep all daily data for the queried weather site from the earliest available date. |
date_max |
A character string giving the latest date of the daily weather time series that the user would like in the final output. This character string should be formatted as "yyyy-mm-dd". If not specified, the default is to keep all daily data for the queried weather site through the most current available date. |
var |
A character vector specifying either
A full list of possible weather variables is available in NOAA's README file for the GHCND data (https://www1.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt). Most weather stations will only have a small subset of all the possible weather variables, so the data generated by this function may not include all of the variables the user specifies through this argument. |
refresh |
(logical) If |
... |
In the case of |
Messages are printed to the console about file path, file last modified time
which you can suppress with suppressMessages()
A list object with slots for each of the available specified weather variables. Each element in the list is a separate time series dataframe with daily observations, as well as flag values, for one of the weather variables. The flag values give information on the quality and source of each observation; see the NOAA README file linked above for more information. Each data.frame is sorted by date, with the earliest date first.
This function calls ghcnd()
, which will download and save
data from all available dates and weather variables for the queried
weather station. The step of limiting the dataset to only certain dates
and / or weather variables, using the date_min
, date_max
,
and var
arguments, does not occur until after the full data has
been pulled.
Scott Chamberlain myrmecocystus@gmail.com, Adam Erickson adam.erickson@ubc.ca
meteo_pull_monitors()
, meteo_tidy_ghcnd()
## Not run:
# Search based on variable and/or date
ghcnd_search("AGE00147704", var = "PRCP")
ghcnd_search("AGE00147704", var = "PRCP", date_min = "1920-01-01")
ghcnd_search("AGE00147704", var = "PRCP", date_max = "1915-01-01")
ghcnd_search("AGE00147704", var = "PRCP", date_min = "1920-01-01",
date_max = "1925-01-01")
ghcnd_search("AGE00147704", date_min = "1920-01-01", date_max = "1925-01-01")
ghcnd_search("AGE00147704", var = c("PRCP","TMIN"))
ghcnd_search("AGE00147704", var = c("PRCP","TMIN"), date_min = "1920-01-01")
ghcnd_search("AGE00147704", var = "adfdf")
# refresh the cached file
ghcnd_search("AGE00147704", var = "PRCP", refresh = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.