Package 'stationaRy'

Title: Detailed Meteorological Data from Stations All Over the World
Description: Acquire hourly meteorological data from stations located all over the world. There is a wealth of data available, with historic weather data accessible from nearly 30,000 stations. The available data is automatically downloaded from a data repository and processed into a 'tibble' for the exact range of years requested. A relative humidity approximation is provided using the 'August-Roche-Magnus' formula, which was adapted from Alduchov and Eskridge (1996) <doi:10.1175%2F1520-0450%281996%29035%3C0601%3AIMFAOS%3E2.0.CO%3B2>.
Authors: Richard Iannone [aut, cre]
Maintainer: Richard Iannone <[email protected]>
License: MIT + file LICENSE
Version: 0.5.1
Built: 2024-11-07 02:56:16 UTC
Source: https://github.com/rich-iannone/stationary

Help Index


Get data from a meteorological station

Description

Obtain one or more years of meteorological data for a particular station.

Usage

get_met_data(
  station_id,
  years = NULL,
  full_data = FALSE,
  add_fields = NULL,
  make_hourly = TRUE,
  local_file_dir = NULL
)

Arguments

station_id

A station identifier composed of the station's USAF and WBAN numbers, separated by a hyphen.

years

The years for which station met data will be collected. If not specified then all records for all available years will be obtained for the station.

full_data

Include all additional meteorological data found in the dataset's additional data section?

add_fields

A vector of categories for additional meteorological data to include (instead of all available categories).

make_hourly

Transforms data to force values to the start of each hour. All data is bucketed by hour and all missing hours are filled with NAs. This regularizes each year of data, where the number of records per year of data will be either 8760 or 8784 (depending on whether a year is a leap year). By default to this is TRUE.

local_file_dir

Path to local meteorological data files. If specified, then data files will be downloaded to and retrieved from this location and not from the remote data store.

Value

Returns a tibble with at least 10 variables. While times are recorded using the Universal Time Code (UTC) in the source data, they are adjusted here to local standard time for the station's locale.

id

A character string identifying the fixed weather station from the USAF Master Station Catalog identifier and the WBAN identifier.

time

A datetime value representing the observation time.

temp

Air temperature measured in degrees Celsius. Conversions to degrees Fahrenheit may be calculated with (temp * 9) / 5 + 32.

wd

The angle of wind direction, measured in a clockwise direction, between true north and the direction from which the wind is blowing. For example, wd = 90 indicates the wind is blowing from due east. wd = 225 indicates the wind is blowing from the south west. The minimum value is 1, and the maximum value is 360.

ws

Wind speed in meters per second. Wind speed in feet per second can be estimated by ws * 3.28084.

atmos_pres

The air pressure in hectopascals relative to Mean Sea Level (MSL).

dew_point

The temperature in degrees Celsius to which a given parcel of air must be cooled at constant pressure and water vapor content in order for saturation to occur.

rh

Relative humidity, measured as a percentage, as calculated using the August-Roche-Magnus approximation.

ceil_hgt

The height above ground level of the lowest cloud cover or other obscuring phenomena amounting to at least 5/8 sky coverage. Measured in meters. Unlimited height (no obstruction) is denoted by the value 22000.

visibility

The horizontal distance at which an object can be seen and identified. Measured in meters. Values greater than 16000 are entered as 16000 (which constitutes 10 mile visibility).

Examples

## Not run: 
# Obtain two years of data from the
# met station with the ID value of
# "999999-63897" 
met_data <- 
  get_met_data(
    station_id = "999999-63897",
    years = 2013:2014
  )

## End(Not run)

Get a table of metadata for meteorological stations

Description

Obtain a tibble containing information on all of the stations that have data.

Usage

get_station_metadata()

Value

Returns a tibble with 16 columns.

id

A character string that is a unique identifier for the weather station.

usaf

A character string identifying the fixed weather station from the USAF Master Station Catalog. USAF is an acronym for United States Air Force.

wban

A character string for the fixed weather station NCDC WBAN identifier. NCDC is an acronym for National Climatic Data Center. WBAN is an acronym for Weather Bureau, Air Force and Navy.

name

A character string with the station name.

country

A character string with the two character country code where the station is located. Not identical to country_code.

state

Character string of the two character abbreviation of a US state (when applicable).

icao

The ICAO identifier for the station.

lat

Latitude (degrees) rounded to three decimal places.

lon

Longitude (degrees) rounded to three decimal places.

elev

Numeric value for the elevation as measured in meters. The minimum value is -400 with a maximum of 8850. Elevation in feet can be approximated by elev * 3.28084

begin_date

The earliest date for which data are available.

end_date

The latest date for which data are available.

begin_year

The earliest year for which data are available.

end_year

The latest year for which data are available.

tz_name

The time zone name.

Examples

# Obtain a data frame with all available met stations
get_station_metadata()

Find out which additional data fields a station has recorded

Description

Get a tibble of information on which additional data fields a particular station has during a specified year range.

Usage

station_coverage(
  station_id,
  years = NULL,
  wide_tbl = FALSE,
  grouping = NULL,
  local_file_dir = NULL
)

Arguments

station_id

A station identifier composed of the station's USAF and WBAN numbers, separated by a hyphen.

years

The years for which station met data will be collected. If not specified then all records for all available years will be obtained for the station.

wide_tbl

A wide table of a single row for the station can be generated by setting this to TRUE. In this arrangement, additional data field categories will appear as columns (having counts of observations as values for the period of years). This is useful when collecting station coverage tables for multiple stations, since the rows can be safely bound together. By default, this is set to FALSE.

grouping

An option to group and summarize counts of observations by "year" or by "month". If these keywords aren't provided then summarization will occur over the entire period specified by years.

local_file_dir

Path to local meteorological data files. If specified, then data files will be downloaded to and retrieved from this location and not from the remote data store.

Value

A tibble.

Examples

## Not run: 
# Obtain a coverage report of the
# additional data that the met
# station with the ID value of
# "999999-63897" has over a two-
# year period
met_data <- 
  station_coverage(
    station_id = "999999-63897",
    years = 2013:2014
  )

## End(Not run)