metar

package module
v0.0.0-...-d01e91e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

Build Status Coverage

METAR

METAR (METeorological Aerodrome Report) and TAF (terminal aerodrome forecast) message decoder for use in bots, templates and other data visualization. Raw text messages (as is) are used for decoding.

Based on the format approved by The Federal Service for Hydrometeorology and Environmental Monitoring of Russia.

Now supported

  • In metars
    • Header: station location, date/time, auto/cor/nil
    • Wind (Wind Variability)
    • Visibility
    • Runway Visual Range
    • Type of Weather
    • Clouds
    • Temperature/Dewpoint
    • Altimeter Setting
  • Metar supplementary informaton
    • Type of recent weather
    • State of the runway(s) (as R24/010060)
    • Wind shear on runway(s) (as WS R24 or WS ALL RWY)
  • In tafs
    • Header: station location, date/time, cor/amd/nil/cnl
    • Wind
    • Visibility
    • Type of Weather
    • Clouds
    • Temperatures
  • Both - change expected: wind, visibility, type of Weather, clouds
Supported units
  • Wind speed: knots, meters per second or kilometer per hour
  • Horizontal visibility: meters or american land miles
  • Runway visual range: meters or feet
  • QNH pressure: hectopascal or inch of mercury
Limitations
  • no color codes decoded
  • only russian style remarks (no RMK from auto station, etc)

Example

    import (
        "fmt"

        "github.com/vasya4k/metar"
    )

    msg, err := metar.NewMETAR("URSS 220630Z 02003MPS 9999 -SHRA SCT050CB OVC086 20/16 Q1015 R02/290060 R06/290060 TEMPO -TSRA BKN030CB RMK R06/03002MPS QFE760")
    if err == nil {
        fmt.Printf("%+v\n", msg)
    }

Documentation

Overview

Package metar provides METAR (METeorological Aerodrome Report) message decoding

Index

Constants

View Source
const (
	// BECMG - Weather development (BECoMinG)
	BECMG = "BECMG"
	// TEMPO - TEMPOrary existing weather phenomena
	TEMPO = "TEMPO"
	// FM - FroM (in TAF reports)
	FM = "FM"
)

Variables

View Source
var CurDayStr string

CurDayStr - day of message

View Source
var CurMonthStr string

CurMonthStr - month of message

View Source
var CurYearStr string

CurYearStr - year of message. By default read all messages in the current date. Can be redefined if necessary

Functions

This section is empty.

Types

type MetarMessage

type MetarMessage struct {
	RawData                      string                 `json:"raw_data"`  // The raw METAR
	COR                          bool                   `json:"corrected"` // Correction to observation
	Station                      string                 `json:"station"`   // 4-letter ICAO station identifier
	DateTime                     time.Time              `json:"issued"`    // Time (in ISO8601 date/time format) this METAR was observed
	Auto                         bool                   `json:"auto"`      // METAR from automatic observing systems with no human intervention
	NIL                          bool                   `json:"nil"`       // event of missing METAR
	wind.Wind                                           //	Surface wind
	CAVOK                        bool                   `json:"cavok"` // Ceiling And Visibility OK, indicating no cloud below 5,000 ft (1,500 m) or the highest minimum sector altitude and no cumulonimbus or towering cumulus at any level, a visibility of 10 km (6 mi) or more and no significant weather change.
	vis.Visibility                                      // Horizontal visibility
	RWYvisibility                []rwy.VisualRange      `json:"visual_range"` // Runway visual range
	ph.Phenomena                 `json:"phenomena"`     // Present Weather
	PhenomenaNotDefined          bool                   `json:"phenomena_not_defined"`           // Not detected by the automatic station - “//”
	VerticalVisibility           int                    `json:"vertical_visibility"`             // Vertical visibility (ft)
	VerticalVisibilityNotDefined bool                   `json:"vertical_visibility_not_defined"` // “///”
	clouds.Clouds                `json:"clouds"`        // Cloud amount and height
	Temperature                  int                    `json:"temperature"`
	Dewpoint                     int                    `json:"dew_point"` // Dew point in degrees Celsius
	QNHhPa                       int                    `json:"qnh_hpa"`   // Altimeter setting.  Atmospheric pressure adjusted to mean sea level
	RecentPhenomena              ph.Phenomena           `json:"recent_phenomena"`
	RWYState                     []rwy.State            `json:"runway_state"`
	WindShear                    []rwy.RunwayDesignator `json:"wind_shear"`
	TREND                        []Trend                `json:"trend"`
	NOSIG                        bool                   `json:"no_sig"`             //OR NO SIGnificant changes coming within the next two hours
	Remarks                      *Remark                `json:"remarks"`            //OR NO SIGnificant changes coming within the next two hours
	NotDecodedTokens             []string               `json:"not_decoded_tokens"` // An array of tokens that couldn't be decoded
}

MetarMessage - Meteorological report presented as a data structure

func NewMETAR

func NewMETAR(inputtext string) (*MetarMessage, error)

NewMETAR - creates a new METAR based on the original message

func (*MetarMessage) RAW

func (m *MetarMessage) RAW() string

RAW - returns the original message text

type Remark

type Remark struct {
	WindOnRWY []WindOnRWY `json:"wind_on_rwy"`
	QBB       int         `json:"qbb"`      // Cloud base in meters
	МТOBSC    bool        `json:"мтobsc"`   // Mountains obscured
	MASTOBSC  bool        `json:"mastobsc"` // Mast obscured
	OBSTOBSC  bool        `json:"obstobsc"` // Obstacle obscured
	QFE       int         `json:"qfe"`      // Q-code Field Elevation (mmHg)
}

Remark - Additional information not included in the main message

type TAFMessage

type TAFMessage struct {
	RawData            string                `json:"raw_data"`  // The raw TAF
	COR                bool                  `json:"corrected"` // Correction of forecast due to a typo
	AMD                bool                  `json:"amended"`   // Amended forecast
	NIL                bool                  `json:"nil"`       // event of missing TAF
	Station            string                `json:"station"`   // 4-letter ICAO station identifier
	DateTime           time.Time             `json:"date_time"` // Time( in ISO8601 date/time format) this TAF was issued
	ValidFrom          time.Time             `json:"valid_from"`
	ValidTo            time.Time             `json:"valid_to"`
	CNL                bool                  `json:"cancelled"` // The previously issued TAF for the period was cancelled
	wind.Wind                                //	Surface wind
	CAVOK              bool                  `json:"cavok"` // Ceiling And Visibility OK, indicating no cloud below 5,000 ft (1,500 m) or the highest minimum sector altitude and no cumulonimbus or towering cumulus at any level, a visibility of 10 km (6 mi) or more and no significant weather change.
	v.Visibility                             // Horizontal visibility
	ph.Phenomena       `json:"phenomena"`    // Present Weather
	VerticalVisibility int                   `json:"vertical_visibility"` // Vertical visibility (ft)
	clouds.Clouds      `json:"clouds"`       // Cloud amount and height
	Temperature        []TemperatureForecast `json:"temperature_forecast"` // Temperature extremes
	TREND              []Trend               `json:"trend"`
	NotDecodedTokens   []string              `json:"not_decoded_tokens"`
}

TAFMessage - Terminal Aerodrome Forecast struct

func NewTAF

func NewTAF(inputtext string) *TAFMessage

NewTAF - creates a new TAF forecast based on the original message

func (*TAFMessage) RAW

func (t *TAFMessage) RAW() string

RAW - returns the original message text

type TemperatureForecast

type TemperatureForecast struct {
	Temp     int
	DateTime time.Time
	IsMax    bool
	IsMin    bool
}

TemperatureForecast - Forecast Max and Min temperature

type Trend

type Trend struct {
	Type        TypeTrend `json:"trend_type"`
	Probability int       `json:"probability"`
	// used only in TAFs. Maybe only 30 or 40. The PROBdd group is not used in conjunction with BECMG and FM
	// In case of in metar use values indicated time of changes. hh:mm (BECMG FM1030 TL1130)
	// In TAFs used from - until fields as date/time. ddhh/ddhh (TEMPO 2208/2218)
	FM time.Time `json:"from_time"`
	// FroM (time)
	TL time.Time `json:"till_time"`
	// unTiL (time)
	AT time.Time `json:"at_time"`
	// AT time
	v.Visibility
	VerticalVisibility           int  `json:"vertical_visibility"`
	VerticalVisibilityNotDefined bool `json:"vertical_visibility_not_defined"`
	wind.Wind
	CAVOK         bool `json:"cavok"`
	ph.Phenomena  `json:"phenomena"`
	clouds.Clouds `json:"clouds"`
	ParsingErrors []error `json:"parsing_errors"`
}

Trend - forecast of changes for a specified period

type TypeTrend

type TypeTrend string

TypeTrend - type of trend: temporary or permanently expected changes

type WindOnRWY

type WindOnRWY struct {
	Runway string `json:"runway"`
	wind.Wind
}

WindOnRWY - surface wind observations on the runways

Directories

Path Synopsis
Package clouds describe cloud amount and height for metar message decoding
Package clouds describe cloud amount and height for metar message decoding

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL