Skip to contents

This function retrieves time series data from the NOAA GHCN-Daily dataset for a specific weather station within a given date range.

Usage

get_ghcn_daily_data(station_id, start_date, end_date, token, datatype = NULL)

Arguments

station_id

Character. The ID of the weather station.

start_date

Date or character string in "YYYY-MM-DD" format. The start date for data retrieval.

end_date

Date or character string in "YYYY-MM-DD" format. The end date for data retrieval.

token

Character. NOAA API token for authentication.

datatype

Character vector. Types of data to retrieve (e.g., "TMAX", "TMIN", "PRCP"). Default is all available types.

Value

A data frame containing the time series data for the specified station and date range, including:

date

Date. The date of the observation.

datatype

Character. The type of data (e.g., "TMAX", "TMIN", "PRCP").

value

Numeric. The recorded value for the datatype.

attributes

Character. Any attributes associated with the value.

Examples

if (FALSE) { # \dontrun{
data <- get_ghcn_daily_data(
  station_id = "USW00094728",  # Example station ID
  start_date = "2022-01-01",
  end_date = "2022-12-31",
  token = "your_noaa_token_here"
)
print(head(data))
} # }