Learn R Programming

FluMoDL (version 0.0.3)

NOAA_getGSOD: Get daily weather summaries from NOAA

Description

Downloads the daily weather summaries for a set of weather stations and a set of years.

Usage

NOAA_getGSOD(stations, years, match.columns = "station.name",
  progress = TRUE)

Arguments

stations

A data.frame with the stations for which data are to be retrieved. It can be a subset of the data.frames returned from NOAA_allStations or NOAA_countryStations. At a minimum it should contain columns 'usaf' and 'wban'.

years

An integer vector of years (from 1901 to current year) for which data are to be retrieved.

match.columns

NULL or (optionally) a vector of column names that can be found in stations. If given, these are included in the output after matching with the respective weather stations.

progress

If TRUE (the default), a progress bar appears if more than three files are to be downloaded from NOAA. Set to FALSE to suppress the progress bar.

For example, one can include a grouping variable in stations (such as region code) and give its name in match.columns for it to be included in the function output. This facilitates aggregating the output by the grouping variable.

Value

A data.frame with the following columns (adapted from NOAA):

usaf

Air Force station ID

wban

NCDC WBAN number

date

Date (of class Date

temp

Mean temperature for the day, in degrees Celsius to tenths.

tempC

Number of observations used in calculating mean temperature.

dewp

Dew point for the day, in degrees Celsius to tenths.

dewpC

Number of observations used in calculating mean dew point.

slp

Mean sea level pressure for the day,in millibars to tenths.

slpC

Number of observations used in calculating mean sea level pressure.

stp

Mean station pressure for the day in millibars to tenths.

stpC

Number of observations used in calculating mean station pressure.

visib

Mean visibility for the day in miles to tenths.

visibC

Number of observations used in calculating mean visibility.

wdsp

Mean wind speed for the day in knots to tenths.

wdspC

Number of observations used in calculating mean wind speed.

mxspd

Maximum sustained wind speed reported for the day, in knots to tenths.

gust

Maximum wind gust reported for the day, in knots to tenths.

maxtemp

Maximum temperature reported during the day, in degrees Celsius to tenths. Time of max temp report varies by country and region, so this will sometimes not be the max for the calendar day.

maxtempF

Blank indicates max temp was taken from the explicit max temp report and not from the 'hourly' data. An asterisk (*) indicates max temp was derived from the hourly data (i.e., highest hourly or synoptic-reported temperature).

mintemp

Minimum temperature reported during the day, in degrees Celsius to tenths. Time of min temp report varies by country and region, so this will sometimes not be the min for the calendar day.

mintempF

Blank indicates min temp was taken from the explicit min temp report and not from the 'hourly' data. An asterisk (*) indicates min temp was derived from the hourly data (i.e., lowest hourly or synoptic-reported temperature).

prcp

Total precipitation (rain and/or melted snow) reported during the day, in inches and hundredths; will usually not end with the midnight observation, i.e. may include latter part of previous day. Zero indicates no measurable precipitation (includes a trace). Note: Many stations do not report '0' on days with no precipitation, therefore NA will often appear on these days. Also, for example, a station may only report a 6-hour amount for the period during which rain fell. See 'prcpF' field for source of data.

prcpF

A = 1 report of 6-hour precipitation amount. B = Summation of 2 reports of 6-hour precipitation amount. C = Summation of 3 reports of 6-hour precipitation amount. D = Summation of 4 reports of 6-hour precipitation amount. E = 1 report of 12-hour precipitation amount. F = Summation of 2 reports of 12-hour precipitation amount. G = 1 report of 24-hour precipitation amount. H = Station reported '0' as the amount for the day (eg, from 6-hour reports), but also reported at least one occurrence of precipitation in hourly observations; this could indicate a trace occurred, but should be considered as incomplete data for the day. I = Station did not report any precip data for the day and did not report any occurrences of precipitation in its hourly observations; it's still possible that precip occurred but was not reported.

sndp

Snow depth in inches to tenths--last report for the day if reported more than once. Note: Most stations do not report '0' on days with no snow on the ground--therefore, NA will often appear on these days.

frshtt

Indicators (1 = yes, 0 = no/not reported) for the occurrence during the day of: Fog ('F' - 1st digit); Rain or Drizzle ('R' - 2nd digit); Snow or Ice Pellets ('S' - 3rd digit); Hail ('H' - 4th digit); Thunder ('T' - 5th digit); Tornado or Funnel Cloud ('T' - 6th digit).

Note that, compared to the original NOAA output (for details see ftp://ftp.ncdc.noaa.gov/pub/data/gsod/readme.txt), all temperatures are automatically converted to degrees Celsius (instead of Fahrenheit) and all missing indicators are replaced with NAs.