Skip to contents

This function retrieves GHCN-D data for specified station(s), time period, and variable(s) directly from the NOAA GHCN-D S3 bucket.

Usage

get_data_aws(station_id, start_date, end_date, variables, format = "wide")

Arguments

station_id

Character vector. One or more 11-character GHCN station identification code(s).

start_date

Character. Start date in format YYYY, YYYY-MM, or YYYY-MM-DD.

end_date

Character. End date in format YYYY, YYYY-MM, or YYYY-MM-DD.

variables

Character vector. GHCN-D element code(s) to retrieve (e.g., c("TMAX", "TMIN", "PRCP")).

format

Character. Output format, either "wide" (default) or "long".

Value

A data.table containing the requested GHCN-D data.

Examples

# Retrieve temperature data for a station from January 2020 to January 2023
nyc_temp_data <- get_data_aws("USC00305816", "2020-01", "2023-01", c("TMAX", "TMIN"))