Package 'pmetar'

Title: Processing METAR Weather Reports
Description: Allows to download current and historical METAR weather reports extract and parse basic parameters and present main weather information. Current reports are downloaded from Aviation Weather Center <https://aviationweather.gov/data/metar/> and historical reports from Iowa Environmental Mesonet web page of Iowa State University ASOS-AWOS-METAR <http://mesonet.agron.iastate.edu/AWOS/>.
Authors: Pawel Cwiek [aut, cre], David Megginson [ctb] (Author of data set with airports list https://ourairports.com/data/), Greg Thompson [ctb] (Author of data set with airports list https://weather.ral.ucar.edu/surface/stations.txt)
Maintainer: Pawel Cwiek <[email protected]>
License: GPL (>= 3)
Version: 0.5.01
Built: 2024-11-14 23:33:10 UTC
Source: https://github.com/prcwiek/pmetar

Help Index


Get airport ICAO, International Civil Aviation Organization, code.

Description

Extract an airport ICAO code from METAR weather report.

Usage

metar_airport(x)

Arguments

x

character vector; METAR weather report or reports.

Value

a character vector with an airport ICAO code.

Examples

metar_airport("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_airport("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180")
metar_airport("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")
metar_airport("202103251800 METAR COR NFTL 251800Z 00000KT SCT017TCU BKN290 25/25 Q1014")

Get cloud coverage information.

Description

Extract and parse cloud coverage information from METAR weather report.

Usage

metar_cloud_coverage(x, sep = ";")

Arguments

x

character vector; a METAR weather report or reports.

sep

character; comma or semicolon, used for separating decoded elements of weather conditions information.

Value

a character vector with cloud coverage information.

Examples

metar_cloud_coverage("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_cloud_coverage("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180")
metar_cloud_coverage("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")
metar_cloud_coverage("202103251800 METAR COR NFTL 251800Z 00000KT SCT017TCU BKN290 25/25 Q1014")
metar_cloud_coverage("KEWR 011451Z 26015KT 10SM FEW030 FEW045 BKN065 04/M07 A2977", sep = ",")

Get day of month.

Description

Extract a day of a month from METAR weather report.

Usage

metar_day(x)

Arguments

x

character vector; a METAR weather report or reports.

Value

a numeric vector with a day of a month.

Examples

metar_day("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_day("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180")
metar_day("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")

Decode METAR report.

Description

Extract and parse information from a single METAR weather report or several reports.

Usage

metar_decode(
  x,
  metric = TRUE,
  altimeter = FALSE,
  numeric_only = FALSE,
  check = TRUE,
  sep = ";"
)

Arguments

x

character vector; a single METAR weather report or
historical METAR weather reports.

metric

logical; if TRUE wind speeds returned in m/s, distances in meters.
If FALSE, wind speeds returned in knots and distances in miles.

altimeter

logical; if FLASE pressures returned in hPa, if TRUE in mmHg.

numeric_only

logical; if TRUE only numeric values are returned.

check

logical; if TRUE the syntax of METAR reports will be checked and incorrect reports will be omitted. If FALSE, the incorrect syntax of reports can cause errors and breakdown of decoding. The default value is TRUE.

sep

character; comma or semicolon, used for separating decoded elements of weather conditions information. The default value is ";".

Details

Decoded METAR weather report consists of:

  • Remark: Don't use for flight planning or navigation! or Incorrect METAR report! Please check the column Original_METAR.

  • Airport ICAO

  • Day of Month

  • Hour (HH:mm)

  • Time zone

  • Wind speed

  • Wind speed unit (m/s or kn)

  • Gust

  • Gust unit (m/s or kn)

  • Wind shear

  • Wind direction (degrees)

  • Temperature (Celsius degrees)

  • Dew point (Celsius degrees)

  • Pressure (hPa)

  • Pressure unit (hPa or mmHg)

  • Visibility

  • Visibility unit (m or miles)

  • Cloud coverage

  • Weather conditions information from WX codes

  • Runway visibility (m or feet)

  • Airport Name

  • Longitude

  • Latitude

  • Elevation

  • Decode Date

  • Original METAR text

Value

a tibble with decoded METAR weather report or reports.

Examples

metar_decode("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_decode("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180",
altimeter = TRUE, metric = FALSE)
metar_decode("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")
metar_decode("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005", altimeter = TRUE)
metar_decode("CYWG 172000Z 30015G25KT 3/4SM R36/4000FT/D -SN M05/M08 A2992")
metar_decode("202103251800 METAR COR NFTL 251800Z 00000KT SCT017TCU BKN290 25/25 Q1014")

Get dew point temperature.

Description

Extracts a dew point temperature value from a METAR weather report or reports.

Usage

metar_dew_point(x, check = FALSE)

Arguments

x

character vector; a METAR weather report or reports.

check

logical; if TRUE the syntax of METAR reports will be checked.

Value

a numeric vector with a dew point temperature in Celsius degrees.

Examples

metar_dew_point("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_dew_point("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180")
metar_dew_point("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")
metar_dew_point("METAR KEWR 010851Z 27010KT 10SM FEW030 BKN070 BKN100 BKN210 04/M03 A2969")
metar_dew_point("201905121244 METAR KDCA 121244Z 05010KT 14/12 A2978 RMK P0002 T01390122")

Get wind direction.

Description

Extract a wind direction value from METAR weather report.

Usage

metar_dir(x, numeric_only = FALSE, check = FALSE)

Arguments

x

character vector; a METAR weather report or reports.

numeric_only

logical; the default value is FALSE and information about variability will be included. If TRUE only a numeric value of direction will be returned.

check

logical; if TRUE the syntax of METAR reports will be checked.

Value

a numeric vector with a wind direction in degrees.

Examples

metar_dir("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_dir("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180",
numeric_only = TRUE)
metar_dir("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")

Get a current METAR report for an airport.

Description

A current METAR weather report is downloaded from the web page of NOAA National Weather Service https://aviationweather.gov/data/metar/ based on an airport four letters ICAO code, International Civil Aviation Organization, or three letters IATA code, International Air Transport Association.

Usage

metar_get(airport = "EPWA")

Arguments

airport

character; ICAO or an IATA airport code.

Value

a character vector with a current METAR weather report.

Examples

metar_get("EPWA")
metar_get("CYUL")
metar_get("MAD")
metar_get("WAW")

Get historical METAR reports.

Description

Download a set of historical METAR weather reports. The default source is the Iowa Environmental Mesonet web page of Iowa State University ASOS-AWOS-METAR
https://mesonet.agron.iastate.edu/AWOS/
The secondary source of METAR reports is Weather Information Service provided by Ogimet https://www.ogimet.com/. However for this source the requested period is limited to 31 days. METAR reports are available from the year 2005.

Usage

metar_get_historical(
  airport = "EPWA",
  start_date = "2020-01-01",
  end_date = "2020-01-10",
  from = "iastate"
)

Arguments

airport

character; ICAO or IATA airport code.

start_date

character; start date in the format YYYY-MM-DD.

end_date

character; end date in the format YYYY-MM-DD.

from

character; selection of online METAR database,
the default value is "iastate" downolading METAR reports from Iowa Environmental Mesonet ASOS-AWOS-METAR https://mesonet.agron.iastate.edu/AWOS/.
Setting the parameter from to "ogimet" allows to use Weather Information Service provided by Ogimet https://www.ogimet.com/.

Value

a data frame character vectors with historical METAR weather report.

Examples

metar_get_historical("EPWA", start_date = "2017-11-20", end_date = "2017-11-25")
metar_get_historical("MAD", start_date = "2015-06-01", end_date = "2015-06-02",
from = "iastate")
metar_get_historical("CYUL", start_date = "2016-07-01", end_date = "2016-07-05",
from = "ogimet")

Get gust speed.

Description

Extract a gust speed from METAR weather report.

Usage

metar_gust(x, metric = TRUE)

Arguments

x

Input character vector; a METAR weather report or reports.

metric

For the default metric = TRUE a returned gust wind speed is in m/s. If it's FALSE, in knots.

Value

a numeric vector with a gust speed in m/s or in knots.

Examples

metar_gust("METAR EPWA 141200Z 30011G22KT 270V340 9999 -SHRA SCT007 BKN015CB 18/17 Q1011")
metar_gust("CYUL 101900Z 27015G25KT 15SM DRSN SCT028 BKN090 OVC110 M04/M10 A2973 RMK")
metar_gust("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")

Get hour and minutes.

Description

Extract and parse hour and minutes from METAR weather report.

Usage

metar_hour(x)

Arguments

x

character; a METAR weather report or reports.

Value

a character vector with the METAR time in the format HH:mm.

Examples

metar_hour("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_hour("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180")
metar_hour("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")

Convert between IATA (International Air Transport Association) airport code to ICAO (International Civil Aviation Organization) airport code or vice versa.

Description

Convert between IATA (International Air Transport Association) airport code to ICAO (International Civil Aviation Organization) airport code or vice versa.

Usage

metar_iata_icao(code = "WAW")

Arguments

code

character vector; an airport ICAO four letters code or an IATA three letters code.

Value

a character vector with an IATA code an ICAO input code or an ICAO code an IATA input code.

Examples

metar_iata_icao("EPWA")
metar_iata_icao("CYUL")
metar_iata_icao("LEMD")
metar_iata_icao("WAW")
metar_iata_icao("FRA")
metar_iata_icao("KRK")

Check if METAR report is correct.

Description

Function checks METRAR reports syntax.

Usage

metar_is_correct(x, verbose = FALSE)

Arguments

x

character vector; METAR weather report or reports.

verbose

logical; default FALSE

Details

It checks:
appearance of not allowed characters: ! \ ? . , ; : * # & ' " ) and multiple slash characters
wind speed syntax
wind direction syntax
pressure syntax
air and dew point temperature syntax
if an airport code is the first element or appear immediately after METAR, SPECI, METAR COR ro SPECI COR.

Value

if verbose = FALSE, TRUE if a METAR is correct, FALSE if not.

if verbose = TRUE, all incorrect METAR reports will be printed

Examples

metar_is_correct("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_is_correct("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5! SLP180")
metar_is_correct("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04//M03 Q1025")

Get approximated airport location.

Description

Find approximated latitude, longitude and elevation of an airport according to IATA, International Air Transport Association, or ICAO, International Civil Aviation Organization, airport code. Two source of information about airports are used. First the function search in the list of airports available at https://ourairports.com/data/ created by David Megginson. If an airport cannot be found there, the second list of airports is searched, from https://weather.ral.ucar.edu/surface/stations.txt prepared by Greg Thompson from
National Weather Service NCAR/RAP.

Usage

metar_location(x = "EPWA")

Arguments

x

character vector; an airport ICAO four letters code or an IATA three letters code.

Value

a tibble with columns with an airport information as below:

  • ICAO code

  • IATA Code

  • Airport name

  • Longitude, in degress

  • Latitude, in degress

  • Elevation, above see elevel in meters

  • Source of information

Examples

metar_location("EPWA")
metar_location("CYUL")
metar_location("LEMD")
metar_location("NCRK")
metar_location("WAW")
metar_location("FRA")

Get atmospheric pressure.

Description

Extract and parse an air pressure value from METAR weather report.

Usage

metar_pressure(x, altimeter = FALSE, check = FALSE)

Arguments

x

character vector; a METAR weather report or reports.

altimeter

boolean; if FALSE, the default value, a pressure is returned in hPa, if TRUE a pressure is returned in inHg (inch of mercury).

check

logical; if TRUE the syntax of METAR reports will be checked.

Value

a numeric vector with air pressure in inHg or hPa.

Examples

metar_pressure("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_pressure("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005", altimeter = TRUE)
metar_pressure("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025 NOSIG= NOSIG=")

Decode and print METAR report

Description

Extract, parse and print information from a single METAR weather report.

Usage

metar_print(
  x,
  metric = TRUE,
  altimeter = FALSE,
  numeric_only = FALSE,
  check = TRUE,
  sep = ";"
)

Arguments

x

character vector; a single METAR weather report.

metric

logical; if TRUE wind speeds returned in m/s, distances in meters.
If FALSE, wind speeds returned in knots and distances in miles.

altimeter

logical; if FLASE pressures returned in hPa, if TRUE in mmHg.

numeric_only

logical; if TRUE only numeric values are returned.

check

logical; if TRUE the syntax of METAR reports will be checked and incorrect reports will be omitted. If FALSE, the incorrect syntax of reports can cause errors and breakdown of decoding. The default value is TRUE.

sep

character; comma or semicolon, used for separating decoded elements of weather conditions information. The default value is ";".

Details

Function prints below decoded METAR weather report elements:

  • Remark: Don't use for flight planning or navigation! or Incorrect METAR report! Please check the column Original_METAR.

  • Airport ICAO

  • Day of Month

  • Hour (HH:mm)

  • Time zone

  • Wind speed (m/s or kn)

  • Gust (m/s or kn)

  • Wind shear

  • Wind direction (degrees)

  • Temperature (Celsius degrees)

  • Dew point (Celsius degrees)

  • Pressure (hPa or mmHg)

  • Pressure unit (hPa or mmHg)

  • Visibility (m or miles)

  • Cloud coverage

  • Weather conditions information from WX codes

  • Runway visibility (m or feet)

  • Airport Name

  • Longitude

  • Latitude

  • Elevation

  • Decode Date

  • Original METAR text

Examples

metar_print("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_print("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180",
altimeter = TRUE, metric = FALSE)
metar_print("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")
metar_print("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005", altimeter = TRUE)
metar_print("CYWG 172000Z 30015G25KT 3/4SM R36/4000FT/D -SN M05/M08 A2992")
metar_print("202103251800 METAR COR NFTL 251800Z 00000KT SCT017TCU BKN290 25/25 Q1014")

Get runway(s) visibility.

Description

Function extracts runway(s) visibility value(s) from METAR weather report.

Usage

metar_rwy_visibility(x, metric = TRUE, sep = ";")

Arguments

x

Input character vector

metric

logical; if TRUE, the default value, runway(s) visibility is returned in meters, if FALSE then in feet.

sep

character; comma or semicolon, used for separating decoded elements of weather conditions information.

Value

A numeric vector. A visibility in m/s or feet.

Examples

metar_rwy_visibility("EBBR 040220Z VRB01KT 0150 R25L/1200N R02/P1500 07/06 Q1017")
metar_rwy_visibility("EBBR 040220Z VRB01KT 0150 R25R/0600FT R02/P1500 07/06 Q1017")
metar_rwy_visibility("EDDF 220520Z 26003KT 0500 R25R/0400N R18/0650V1100N FZFG", sep = ",")
metar_rwy_visibility("CYWG 172000Z 30015G25KT 3/4SM R36/4000FT/D -SN M05/M08 A2992")
metar_rwy_visibility("EBBR 040220Z VRB01KT 0150 R25L/1200N R26R/1000 R36/4000FT/D -SN")

Get wind speed

Description

Extract a wind speed value from METAR weather report.

Usage

metar_speed(x, metric = TRUE, check = FALSE)

Arguments

x

character vector; METAR weather report or reports.

metric

logical; the default value is TRUE and a returned wind speed is in m/s; if it's FALSE then in knots.

check

logical; the default value is FALSE, if METAR report fails the syntax check, NA value will be returned. If FALSE, zero values will be returned for METAR reports with incorrect syntax.

Value

a numeric vector. A wind speed in m/s or in knots.

Examples

metar_speed("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_speed("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180", metric = FALSE)
metar_speed("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025 NOSIG= NOSIG=")
metar_speed("EPKK 141730Z VRB01KT CAVOK 21/16 Q1028")

Get temperature.

Description

Extract a temperature value from METAR weather report.

Usage

metar_temp(x, check = FALSE)

Arguments

x

character vector; a METAR weather report or reports.

check

logical; if TRUE the syntax of METAR reports will be checked.

Value

a numeric vector with temperature in degrees Celsius.

Examples

metar_temp("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_temp("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180")
metar_temp("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025 NOSIG=")
metar_temp("METAR KEWR 010851Z 27010KT 10SM BKN210 04/M03 A2969 RMK SLP054
T00391033 52012")

Get time zone.

Description

Extract a time zone of METAR weather report.

Usage

metar_time_zone(x)

Arguments

x

character; a METAR weather report or reports.

Value

a character vector with time zone.

Examples

metar_time_zone("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_time_zone("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180")
metar_time_zone("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")

Get visibility information.

Description

Extract and parse visibility information from METAR weather report.

Usage

metar_visibility(x, metric = TRUE, numeric_only = FALSE)

Arguments

x

character vector; a METAR weather report or reports.

metric

For the default metric = TRUE returned distances are in meters. If it's FALSE, in miles.

numeric_only

logical; if TRUE only a numeric value will be returned

Value

a numeric vector with visibility information, in meters or miles.

Examples

metar_visibility("EPWA 281830Z 18009KT 140V200 9999 SCT037 03/M01 Q1008 NOSIG")
metar_visibility("CYUL 281800Z 13008KT 30SM BKN240 01/M06 A3005 RMK CI5 SLP180")
metar_visibility("201711271930 METAR LEMD 271930Z 02002KT CAVOK 04/M03 Q1025")
metar_visibility("KBLV 011657Z AUTO 25015G30KT 210V290 3/8SM R32L/1000FT FG
BKN005 01/M01 A2984")

Get wind shear information.

Description

Function extracts information about wind shear from METAR weather report.

Usage

metar_windshear(x, metric = TRUE)

Arguments

x

character vector; METAR weather report or reports.

metric

For the default metric = TRUE a returned wind speed is in m/s. If it's FALSE, in knots.

Value

A character vector with information about wind shear.

Examples

metar_windshear("METAR VHHH 180800Z 12009KT 060V150 FEW010 SCT045 22/18 Q1012 WS R07R")
metar_windshear("CYWG 172000Z 30015G25KT 3/4SM R36/4000FT/D M05/M08 A2992 WS RWY36")
metar_windshear("KPIT 091730Z 091818 22020KT 3SM -SHRA BKN020 WS015/30045KT",
 metric = FALSE)

Get weather conditions information.

Description

Extract and parse weather conditions information METAR WX codes.

Usage

metar_wx_codes(x, sep = ";")

Arguments

x

Input character vector

sep

character; comma or semicolon, used for separating decoded elements of weather conditions information.

Value

A character vector. with METAR WX codes.

Examples

metar_wx_codes("METAR EPWA 132100Z 29006KT 260V320 8000 SHRA SCT009 BKN025CB 18/17 Q1011")
metar_wx_codes("CYUL 101900Z 27015G25KT 15SM DRSN SCT028 BKN090 OVC110 M04/M10 A2973 RMK")
metar_wx_codes("METAR EPKK 200300Z 23014KT 9999 -SHSN SCT009CB BKN012 01/M00 Q1008", sep = ",")
metar_wx_codes("202001190045 METAR KEWR 190045Z 19008KT 4SM -RA -PL BR FEW007 01/M01 A2995")

METAR WX weather conditions codes

Description

A dataset containing the explanations for METAR WX weather conditions codes. The variables are as follows:

Format

A data frame with 39 rows and 3 variables

Details

  • Type; type of the codes

  • Abbreviation; the codes which are included in METAR reports

  • Meaning; description of the codes

References

https://en.wikipedia.org/wiki/METAR#METAR_WX_codes


Secondary airport list

Description

A character vector containing the list of airports.

Format

A character vector with the length of 10113 items

Details

From https://www.aviationweather.gov/ A data set is in the public domain according to https://www.weather.gov/disclaimer

Author(s)

Greg Thompson from National Weather Service NCAR/RAP, NOAA National Weather Service

References

https://weather.ral.ucar.edu/surface/stations.txt,


Main list of airports

Description

#' A dataset containing the list of airports

Format

A data frame with 28935 rows and 12 variables

Details

From https://ourairports.com A data set is in the public domain according to https://ourairports.com/data/

  • id; identification number

  • ident; airport ICAO code

  • type; airport type

  • name; airport name

  • latitude_deg; geographical latitude

  • longitude_deg; geographical longitude

  • elevation_ft; airport elevation in feet

  • elevation_m; airport elevation in meters

  • iso_country; ISO country code

  • iso_region; ISO region code

  • municipality;

  • iata_code; airport IATA code

Author(s)

David Megginson

References

https://ourairports.com/data/