Learn R Programming

rnoaa (version 0.9.0)

lcd: Local Climitalogical Data from NOAA

Description

Local Climitalogical Data from NOAA

Usage

lcd(station, year, ...)

lcd_cleanup(x)

Arguments

station

(character) station code, e.g., "02413099999". we will allow integer/numeric passed here, but station ids can have leading zeros, so it's a good idea to keep stations as character class. required

year

(integer) year, e.g., 2017. required

...

curl options passed on to crul::verb-GET

x

result of a call to lcd(). required

Value

a data.frame, with many columns, and variable rows depending on how frequently data was collected in the given year

a data.frame with many columns. the first 10 are metadata:

  • station

  • date

  • source

  • latitude

  • longitude

  • elevation

  • name

  • report_type

  • call_sign

  • quality_control

And the rest should be all data columns. See Note about data joined together.

Other groups of fields under the following:

  • wnd: wind

  • tmp: air temperature

  • aa: LIQUID-PRECIPITATION

  • aj: snow depth

  • ay: PAST-WEATHER-OBSERVATION

  • oc: WIND-GUST-OBSERVATION

  • dew: dew point

  • slp: sea level pressure

  • cig: sky condition

  • ka: extreme air temperature

  • ma: atmospheric pressure

  • md: atmospheric pressure change

  • ga: SKY-COVER-LAYER

  • ge: SKY-CONDITION-OBSERVATION

  • gf: SKY-CONDITION-OBSERVATION

  • ia: GROUND-SURFACE-OBSERVATION

  • mw: PRESENT-WEATHER-OBSERVATION

  • rem: remarks

Details

lcd_cleanup() takes the output of lcd() and parses additional columns that have comma separated strings into separate columns with headings; so lcd_cleanup() adds many additional columns

References

https://www.ncdc.noaa.gov/cdo-web/datatools/lcd https://www1.ncdc.noaa.gov/pub/data/cdo/documentation/LCD_documentation.pdf

Examples

Run this code
# NOT RUN {
lcd(station = "01338099999", year = "2017")
lcd(station = "01338099999", year = "2015")

lcd(station = "02413099999", year = "2009")
lcd(station = "02413099999", year = "2001")

# pass curl options
lcd(station = "02413099999", year = "2002", verbose = TRUE)

# clean up columns
w <- lcd(station = "01338099999", year = "2017")
w
lcd_cleanup(w)
# }

Run the code above in your browser using DataLab