meteo_tidy_ghcnd: Create a tidy GHCND dataset from a single monitor

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/helpers_ghcnd.R

Description

This function inputs an object created by ghcnd and cleans up the data into a tidy form.

Usage

1
2
3
4
5
6
7
meteo_tidy_ghcnd(
  stationid,
  keep_flags = FALSE,
  var = "all",
  date_min = NULL,
  date_max = NULL
)

Arguments

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 ghcnd_stations() function. To identify stations within a certain radius of a location, the user can use the meteo_nearby_stations() function.

keep_flags

TRUE / FALSE for whether the user would like to keep all the flags for each weather variable. The default is to not keep the flags (FALSE). See the note below for more information on these flags.

var

A character vector specifying either "all" (pull all available weather parameters for the site) or the weather parameters to keep in the final data (e.g., c("TMAX", "TMIN") to only keep maximum and minimum temperature). Example choices for this argument include:

  • PRCP: Precipitation, in tenths of millimeters

  • TAVG: Average temperature, in tenths of degrees Celsius

  • TMAX: Maximum temperature, in tenths of degrees Celsius

  • TMIN: Minimum temperature, in tenths of degrees Celsius

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.

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.

Value

A data frame of daily weather data for a single weather monitor, converted to a tidy format. All weather variables may not exist for all weather stations. Examples of variables returned are:

There are other possible weather variables in the Global Historical Climatology Network; see http://www1.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt for a full list. The variables prcp, tmax, tmin, and tavg have all been converted from tenths of their metric to the metric (e.g., from tenths of degrees Celsius to degrees Celsius). All other variables are in the units specified in the linked file.

Note

The weather flags, which are kept by specifying keep_flags = TRUE are:

More information on the interpretation of these flags can be found in the README file for the NCDC's Daily Global Historical Climatology Network's data at http://www1.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt

Author(s)

Brooke Anderson brooke.anderson@colostate.edu

See Also

meteo_pull_monitors()

Examples

1
2
3
4
5
6
7
## Not run: 
# One station in Australia is ASM00094275
meteo_tidy_ghcnd(stationid = "ASN00003003")
meteo_tidy_ghcnd(stationid = "ASN00003003", var = "tavg")
meteo_tidy_ghcnd(stationid = "ASN00003003", date_min = "1989-01-01")

## End(Not run)

rnoaa documentation built on May 19, 2021, 9:13 a.m.