Downloads Global Historical Climatology Network hourly (GHCNh) data for one or more stations and a date range, returning a parsed data frame ready for use in stream metabolism modelling.
Arguments
- stations
Character vector of GHCNh station identifiers (e.g.,
"USW00023183"). These match thestation_idcolumn returned byget_noaa_stations()andclosest_noaa_stations().- start_date, end_date
Start and end of the requested period as
Dateobjects or"YYYY-MM-DD"strings.- quiet
Logical. When
TRUEprogress messages are suppressed. DefaultFALSE.
Value
A tibble with one row per station-hour. Key columns include:
station_idStation identifier.
station_nameStation name (when available).
datetimeObservation time as a UTC
POSIXct.temperatureAir temperature in degrees Celsius.
dew_point_temperatureDew-point temperature (°C).
relative_humidityRelative humidity (%).
wind_directionWind direction (degrees clockwise from north).
wind_speedWind speed (m/s).
sea_level_pressureSea-level pressure (hPa).
precipitationPrecipitation (mm).
Columns that are entirely NA across all stations and hours are
dropped from the result.
Details
GHCNh v1.1.0 data are served as pipe-separated (PSV) files from the NOAA NCEI archive, one file per station per year. Data are current through the present year. The function downloads all station-year combinations covering the requested date range in parallel.
Sentinel values of -9999 are converted to NA. Columns that
are all NA are removed.
Multiple stations and years are downloaded in parallel using up to four concurrent connections.
Examples
if (FALSE) { # \dontrun{
# Fetch WY 2025 hourly data for a station near Konza Prairie
konza <- closest_noaa_stations(
latitude = 39.1068806,
longitude = -96.6117151,
dist_km = 50
)
hourly <- get_ghcnh(
stations = konza$station_id[1],
start_date = "2024-10-01",
end_date = "2025-09-30"
)
} # }