metar

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 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.

Suitable for the recognition messages from russians airports, and in the ex-USSR and European countries with some limitations. Based on the format approved by The Federal Service for Hydrometeorology and Environmental Monitoring of Russia.

Limitations
  • visibility only in meters, not miles.
  • no color codes decoded
  • only russians remarks (no RMK from auto station, etc)

Example

    import (
        "fmt"

        "github.com/urkk/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 CurYearStr, CurMonthStr, CurDayStr string

Year, month and day. 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 {
	COR       bool      // Correction to observation
	Station   string    // 4-letter ICAO station identifier
	DateTime  time.Time // Time (in ISO8601 date/time format) this METAR was observed
	Auto      bool      // METAR from automatic observing systems with no human intervention
	NIL       bool      // event of missing METAR
	wind.Wind           //	Surface wind
	// 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.
	CAVOK                        bool
	Visibility                                     // Horizontal visibility. In meters
	RWYvisibility                []rwy.VisualRange // Runway visual range
	ph.Phenomena                                   // Present Weather
	PhenomenaNotDefined          bool              // Not detected by the automatic station - “//”
	VerticalVisibility           int               // Vertical visibility (ft)
	VerticalVisibilityNotDefined bool              // “///”
	clouds.Clouds                                  // Cloud amount and height
	Temperature                  int               // Temperature in degrees Celsius
	Dewpoint                     int               // Dew point in degrees Celsius
	QNHhPa                       int               // Altimeter setting.  Atmospheric pressure adjusted to mean sea level
	// Supplementary informaton
	//Recent weather
	RecentPhenomena ph.Phenomena
	// Information on the state of the runway(s)
	RWYState []rwy.State
	// Wind shear on runway(s)
	WindShear []rwy.RunwayDesignator
	// Prevision
	TREND []Trend
	//OR NO SIGnificant changes coming within the next two hours
	NOSIG bool
	// Remarks consisting of recent operationally significant weather as well as additive and automated maintenance data
	Remarks *Remark
	// An array of tokens that couldn't be decoded
	NotDecodedTokens []string
	// contains filtered or unexported fields
}

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
	QBB       int  // Cloud base in meters
	МТOBSC    bool // Mountains obscured
	MASTOBSC  bool // Mast obscured
	OBSTOBSC  bool // Obstacle obscured
	QFE       int  // Q-code Field Elevation (mmHg)
}

Remark - Additional information not included in the main message

type TAFMessage

type TAFMessage struct {
	COR       bool      // Correction of forecast due to a typo
	AMD       bool      // Amended forecast
	NIL       bool      // event of missing TAF
	Station   string    // 4-letter ICAO station identifier
	DateTime  time.Time // Time( in ISO8601 date/time format) this TAF was issued
	ValidFrom time.Time
	ValidTo   time.Time
	CNL       bool // The previously issued TAF for the period was cancelled

	wind.Wind //	Surface wind
	// 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.
	CAVOK              bool
	Visibility                               // Horizontal visibility
	ph.Phenomena                             // Present Weather
	VerticalVisibility int                   // Vertical visibility (ft)
	clouds.Clouds                            // Cloud amount and height
	Temperature        []TemperatureForecast // Temperature extremes
	// Prevision
	TREND []Trend

	NotDecodedTokens []string
	// contains filtered or unexported fields
}

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
	Probability int // 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 // FroM (time)
	TL time.Time // unTiL (time)
	AT time.Time // AT time
	Visibility
	VerticalVisibility           int
	VerticalVisibilityNotDefined bool
	wind.Wind
	CAVOK bool
	ph.Phenomena
	clouds.Clouds
}

Trend - forecast of changes for a specified period

type TypeTrend

type TypeTrend string

TypeTrend - type of trend: temporary or permanently expected changes

type Visibility

type Visibility struct {
	Distance       int
	LowerDistance  int
	LowerDirection string
}

Visibility - prevailing visibility

func (*Visibility) ParseVisibility

func (v *Visibility) ParseVisibility(input []string) (tokensused int)

ParseVisibility - identify and parses the representation oh horizontal visibility

type WindOnRWY

type WindOnRWY struct {
	Runway string
	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