Copyright | (C) 2014-2016, Hans-Christian Esperer |
---|---|
License | MIT |
Maintainer | Hans-Christian Esperer <hc@hcesperer.org> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Parse aviation weather reports. A qualified import is recommended.
- weatherParser :: (Monad f, CharParsing f) => f Weather
- data Weather
- = METAR {
- _reporttype :: ReportType
- _metardate :: Date
- _station :: Station
- _flags :: [Flag]
- _metarwind :: Maybe Wind
- _metarvisibility :: [Visibility]
- _runwayvis :: [(Runway, [Visibility], Maybe VisTrend)]
- _runwaycond :: [RunwayCondition]
- _wx :: [WeatherPhenomenon]
- _clouds :: [Cloud]
- _metarpressure :: Maybe Pressure
- _temperature :: Maybe Int
- _dewPoint :: Maybe Int
- _weathertrend :: [Trend]
- _remark :: Maybe Text
- _maintenance :: Bool
- | ATIS
- | SPECI
- | TAF {
- _reporttype :: ReportType
- _tafissuedat :: Date
- _flags :: [Flag]
- _station :: Station
- _tafvalidfrom :: Date
- _tafvaliduntil :: Date
- _tafinitialconditions :: [Transition]
- _tafchanges :: [Trend]
- | AIRMET
- | SIGMET
- | GAMET
- = METAR {
- class HasWeather c where
- class AsWeather r where
- data Date = Date {}
- class HasDate c where
- newtype Station = ICAO Text
- data Flag
- class HasFlag c where
- class AsFlag r where
- data Wind = Wind {}
- class HasWind c where
- data Visibility
- class HasVisibility c where
- class AsVisibility r where
- data Runway
- = AllRunways
- | SpecificRunway { }
- class HasRunway c where
- class AsRunway r where
- data VisTrend
- class HasVisTrend c where
- class AsVisTrend r where
- data RunwayCondition
- class HasRunwayCondition c where
- class AsRunwayCondition r where
- data WeatherPhenomenon = Phenomenon {}
- class HasWeatherPhenomenon c where
- data Cloud
- class HasCloud c where
- class AsCloud r where
- data Pressure
- class HasPressure c where
- class AsPressure r where
- data Trend
- = BECMG { }
- | TEMPO {
- _tempoFrom :: Maybe Date
- _tempoTo :: Maybe Date
- _tempoTransitions :: [Transition]
- | PROB Int Trend
- | NOSIG
- | NOTAVAIL
- class HasTrend c where
- class AsTrend r where
- data WPDesc
- class HasWPDesc c where
- class AsWPDesc r where
- data WPPrecipitation
- class HasWPPrecipitation c where
- class AsWPPrecipitation r where
- data WPObfuscation
- class HasWPObfuscation c where
- class AsWPObfuscation r where
- data WPOther
- class HasWPOther c where
- class AsWPOther r where
- data Distance
- class HasDistance c where
- class AsDistance r where
- data Direction
- class HasDirection c where
- class AsDirection r where
- data RwyCoverType
- = RCTDry
- | RCTMoist
- | RCTWet
- | RCTRime
- | RCTDrySnow
- | RCTWetSnow
- | RCTSlush
- | RCTIce
- | RCTFZRut
- | RCTUnknown
- class HasRwyCoverType c where
- class AsRwyCoverType r where
- data RunwayBraking
- class HasRunwayBraking c where
- class AsRunwayBraking r where
- data Vertical
- class HasVertical c where
- class AsVertical r where
- data WindDirection
- class HasWindDirection c where
- class AsWindDirection r where
- data Cover
- = FEW
- | SCT
- | BKN
- | OVC
- | CoverNotSpecified
- class HasCover c where
- class AsCover r where
- data CloudType
- class HasCloudType c where
- class AsCloudType r where
- data WPIntensity
- class HasWPIntensity c where
- class AsWPIntensity r where
- data Transition
- = TransWind Wind
- | TransVis [Visibility]
- | TransRunwayVis [(Runway, [Visibility], Maybe VisTrend)]
- | TransWX [WeatherPhenomenon]
- | TransClouds [Cloud]
- | TransPressure [Pressure]
- class HasTransition c where
- class AsTransition r where
- data Unit
- class HasUnit c where
- class AsUnit r where
- data ReportType
Documentation
weatherParser :: (Monad f, CharParsing f) => f Weather Source #
An attoparsec parser that can parse METAR messages.
Aviation weather, currently only METARs and TAFs are supported.
METAR | A METeorological Aerodrome Report |
| |
ATIS | An automatic terminal information service report |
SPECI | A non-scheduled METAR |
TAF | A terminal aerodrome forecast |
| |
AIRMET | An aviation wx hazard message of moderate severity |
SIGMET | A significant meteorological information message |
GAMET | A general aviation forecast message |
class HasWeather c where Source #
weather :: Lens' c Weather Source #
clouds :: Traversal' c [Cloud] Source #
dewPoint :: Traversal' c (Maybe Int) Source #
flags :: Traversal' c [Flag] Source #
maintenance :: Traversal' c Bool Source #
metardate :: Traversal' c Date Source #
metarpressure :: Traversal' c (Maybe Pressure) Source #
metarvisibility :: Traversal' c [Visibility] Source #
metarwind :: Traversal' c (Maybe Wind) Source #
remark :: Traversal' c (Maybe Text) Source #
reporttype :: Traversal' c ReportType Source #
runwaycond :: Traversal' c [RunwayCondition] Source #
runwayvis :: Traversal' c [(Runway, [Visibility], Maybe VisTrend)] Source #
station :: Traversal' c Station Source #
tafchanges :: Traversal' c [Trend] Source #
tafinitialconditions :: Traversal' c [Transition] Source #
tafissuedat :: Traversal' c Date Source #
tafvalidfrom :: Traversal' c Date Source #
tafvaliduntil :: Traversal' c Date Source #
temperature :: Traversal' c (Maybe Int) Source #
weathertrend :: Traversal' c [Trend] Source #
wx :: Traversal' c [WeatherPhenomenon] Source #
class AsWeather r where Source #
_Weather :: Prism' r Weather Source #
_METAR :: Prism' r (ReportType, Date, Station, [Flag], Maybe Wind, [Visibility], [(Runway, [Visibility], Maybe VisTrend)], [RunwayCondition], [WeatherPhenomenon], [Cloud], Maybe Pressure, Maybe Int, Maybe Int, [Trend], Maybe Text, Bool) Source #
_SPECI :: Prism' r () Source #
_TAF :: Prism' r (ReportType, Date, [Flag], Station, Date, Date, [Transition], [Trend]) Source #
_AIRMET :: Prism' r () Source #
An obersvation date.
An aeronautical weather station designator.
A flag describing an aviation meteorological report
Wind information.
Wind | |
|
data Visibility Source #
Vertical visibility.
TenOrMore | Ten kilometres or more. This is also used for P6SM which means 6 statute miles or more. Do note that 6SM is a little less than 10km (9.6km) |
FiftyMetresOrLess | Fifty metres or less. |
TwoOrMore | Two kilometres or more. |
SpecificVisibility Distance (Maybe Direction) | A specific visibility. |
class HasVisibility c where Source #
visibility :: Lens' c Visibility Source #
class AsVisibility r where Source #
_Visibility :: Prism' r Visibility Source #
_TenOrMore :: Prism' r () Source #
_FiftyMetresOrLess :: Prism' r () Source #
_TwoOrMore :: Prism' r () Source #
_SpecificVisibility :: Prism' r (Distance, Maybe Direction) Source #
Runway specification.
AllRunways | All runways. |
SpecificRunway | A specific runway. |
|
A visibility trend specifically for runway conditions
VisTrendUpward | Visibility will improve (maybe do wait a bit) |
VisTrendDownward | Visibility will deteriorate (still, don't rush the take off and use proper phraseology at all times) |
VisTrendNoDistinctTendency | No expected change in runway visibility conditions |
class HasVisTrend c where Source #
class AsVisTrend r where Source #
data RunwayCondition Source #
Runway conditions.
SpecificRunwayCondition | Specific runway conditions exist. |
| |
RwyClosed | The runway is closed. |
| |
ADClosed | The whole aerodrome is closed. |
class HasRunwayCondition c where Source #
runwayCondition :: Lens' c RunwayCondition Source #
rwclosedRunway :: Traversal' c Runway Source #
rwcondBrkCoeff :: Traversal' c RunwayBraking Source #
rwcondCover :: Traversal' c RwyCoverType Source #
rwcondCoverHeight :: Traversal' c (Maybe Int) Source #
rwcondRunway :: Traversal' c Runway Source #
rwcondSpread :: Traversal' c (Maybe Int) Source #
class AsRunwayCondition r where Source #
data WeatherPhenomenon Source #
A weather phenomenon. This can be an observed phenomenon in the case of METARs or an expected phenomenon in the case of TAFs.
Phenomenon | |
|
class HasWeatherPhenomenon c where Source #
A cloud specification.
A pressure value. This is intentionally coded individually and not converted to a specific reference.
QNH Int | The QNH value in hectopascals. QNH is the current pressure at sea level, corrected for pressure and temperature changes at the station level. |
Altimeter Int | The same as QNH, only in inches (Do you know the old joke?: * ATC: Liner 1723 descend to 3,000ft, the QNH is 1013mb. * Liner 1723: Uh, approach, can we have that in inches please? * ATC: Liner 1723 descend to 36,000 inches, the QNH is 1013mb. |
QFE Int | The current pressure at station level in hectopascals. |
QFF Int | The current pressure at sea level in hectopascals. |
class HasPressure c where Source #
class AsPressure r where Source #
The trend part of an observation message specifies expected changes in weather conditions within the next two hours. A Trend/Transition part of a TAF message specified expected changes in weather conditions within the specified range.
BECMG | A transition that will start within the defined time frame and be completed at the end of the defined time frame |
| |
TEMPO | A transition that will start within the defined time frame and be finished at the end of the defined time frame |
| |
PROB Int Trend | A probability specification. As one of my FIs (ex-atc at EDDF) used to put it: 30% means "I'm quite sure it won't happen but will still put it in here, in case it does after all." 40% means "I'm certain it will happen but will still put it with 40%, in case it does not happen after all." |
NOSIG | NOSIG is only applicable to METARs. It means that no significant changes are expected within the next two hours. |
NOTAVAIL | NOTAVAIL is only applicable to METARs. It means that the METAR message in question does not contain a TREND section. |
class HasTrend c where Source #
trend :: Lens' c Trend Source #
becmgFinished :: Traversal' c (Maybe Date) Source #
becmgStart :: Traversal' c (Maybe Date) Source #
becmgTransitions :: Traversal' c [Transition] Source #
tempoFrom :: Traversal' c (Maybe Date) Source #
tempoTo :: Traversal' c (Maybe Date) Source #
tempoTransitions :: Traversal' c [Transition] Source #
The description of a weather phenomenon.
Shallow | Shallow. |
Patches | Patches. |
WXPartial | Partial. |
LowDrifting | Low, drifting. |
Blowing | Blowing. |
Shower | Shower. |
Thunderstorm | Thunderstorm. |
Freezing | Freezing. |
data WPPrecipitation Source #
The type of the precipitation
Drizzle | Drizzle. |
Rain | Rain. |
Snow | Snow. |
ShowGrains | Snow grains. |
IceCrystals | Ice crystals. |
IcePellets | Ice pellets. |
Hail | Hail. |
SnowPellets | Snow pellets. |
NoPrecipitationDetected | No precipication detected (fully automated measurement) |
UnknownPrecipitation | Unknown type of precipitation. |
class HasWPPrecipitation c where Source #
class AsWPPrecipitation r where Source #
_WPPrecipitation :: Prism' r WPPrecipitation Source #
_Drizzle :: Prism' r () Source #
_ShowGrains :: Prism' r () Source #
_IceCrystals :: Prism' r () Source #
_IcePellets :: Prism' r () Source #
_SnowPellets :: Prism' r () Source #
_NoPrecipitationDetected :: Prism' r () Source #
_UnknownPrecipitation :: Prism' r () Source #
data WPObfuscation Source #
Effects on the visibility by a weather phenomenon
class HasWPObfuscation c where Source #
class AsWPObfuscation r where Source #
_WPObfuscation :: Prism' r WPObfuscation Source #
_Smoke :: Prism' r () Source #
_VolcanicAsh :: Prism' r () Source #
Other important information about a weather phenomenon.
DustOrSandwhirls | Dust or sand whirls. |
Squalls | Squalls. |
Tornado | Tornado. |
Sandstorm | Sand storm. |
Duststorm | Dust storm. |
class HasWPOther c where Source #
The Distance.
class HasDistance c where Source #
class AsDistance r where Source #
Directions.
North | North. |
South | South. |
East | East. |
West | West. |
NorthWest | Northwest. |
NorthEast | Northeast. |
SouthWest | Southwest. |
SouthEast | Southeast. |
NDV | No direction could be determined |
RWYLeft | Left runway for runways of the same QFU (part of the runway designator) |
RWYRight | Right runway for runways of the same QFU (part of the runway designator) |
RWYCenter | Centre runway for runways of the same QFU (part of the runway designator) |
class HasDirection c where Source #
class AsDirection r where Source #
_Direction :: Prism' r Direction Source #
_North :: Prism' r () Source #
_South :: Prism' r () Source #
_NorthWest :: Prism' r () Source #
_NorthEast :: Prism' r () Source #
_SouthWest :: Prism' r () Source #
_SouthEast :: Prism' r () Source #
_RWYLeft :: Prism' r () Source #
_RWYRight :: Prism' r () Source #
_RWYCenter :: Prism' r () Source #
data RwyCoverType Source #
The runway contamination type.
RCTDry | The runway is not contaminated. |
RCTMoist | The runway is moist. |
RCTWet | The runway is wet. |
RCTRime | The runway is convered with rime. |
RCTDrySnow | The runway is covered with dry snow. |
RCTWetSnow | The runway is covered with wet snow. |
RCTSlush | The runway is covered with slush. |
RCTIce | The runway is covered with ice. |
RCTFZRut | The runway is covered with frozen ruts or ridges. |
RCTUnknown | The runway contamination type is unknown. |
class HasRwyCoverType c where Source #
rwyCoverType :: Lens' c RwyCoverType Source #
class AsRwyCoverType r where Source #
_RwyCoverType :: Prism' r RwyCoverType Source #
_RCTDry :: Prism' r () Source #
_RCTMoist :: Prism' r () Source #
_RCTWet :: Prism' r () Source #
_RCTRime :: Prism' r () Source #
_RCTDrySnow :: Prism' r () Source #
_RCTWetSnow :: Prism' r () Source #
_RCTSlush :: Prism' r () Source #
_RCTIce :: Prism' r () Source #
_RCTFZRut :: Prism' r () Source #
_RCTUnknown :: Prism' r () Source #
data RunwayBraking Source #
The measured brake efficiency of a specific runway.
BrakingFriction Int | The friction coefficient. |
BrakingEffect Int | The braking coefficient. |
class HasRunwayBraking c where Source #
class AsRunwayBraking r where Source #
_RunwayBraking :: Prism' r RunwayBraking Source #
_BrakingFriction :: Prism' r Int Source #
_BrakingEffect :: Prism' r Int Source #
A vertical position specification.
Height Int | A vertical position with reference to the ground in feet. |
Altitude Int | A vertical position with reference to the mean sea level/QNH in feet. |
FlightLevel Int | A pressure altitude with reference to the standard QNH of 1013 hectopascals in hundrets of feet. |
VertNotSpec | Vertical position is not specified. |
class HasVertical c where Source #
class AsVertical r where Source #
data WindDirection Source #
The direction the wind is blowing from.
Variable | The wind is blowing in equal or almost equal strength from a wide variety of directions. |
Degrees Int | The wind is blowing from the specified direction. Directions can be given with reference to true or magnetic north, depending on the type of weather observation/forecast message. |
Varying | The wind is blowing from a specific direction range. |
class HasWindDirection c where Source #
windDirection :: Lens' c WindDirection Source #
windfrom :: Traversal' c Int Source #
windmean :: Traversal' c Int Source #
windto :: Traversal' c Int Source #
class AsWindDirection r where Source #
The area that is covered.
FEW | 1-2 eights are covered. |
SCT | 3-4 eights are covered. |
BKN | 5-7 eights are covered. |
OVC | More than 7 eights are covered. |
CoverNotSpecified | Cover not specified |
The type of cloud.
Cumulonimbus | A cumulonimbus cloud. |
ToweringCumulus | A developing cb cloud. |
Stratus | A stratus cloud. |
Cumulus | A cumulus cloud. |
Stratocumulus | A stratocumulus cloud. |
Altostratus | An altostratus cloud. |
Altocumulus | An altocumulus cloud. |
Cirrostratus | A cirrostratus cloud. |
Cirrus | A cirrus cloud. |
Unclassified | An unclassified cloud. |
class HasCloudType c where Source #
class AsCloudType r where Source #
_CloudType :: Prism' r CloudType Source #
_Cumulonimbus :: Prism' r () Source #
_ToweringCumulus :: Prism' r () Source #
_Stratus :: Prism' r () Source #
_Cumulus :: Prism' r () Source #
_Stratocumulus :: Prism' r () Source #
_Altostratus :: Prism' r () Source #
_Altocumulus :: Prism' r () Source #
_Cirrostratus :: Prism' r () Source #
_Cirrus :: Prism' r () Source #
_Unclassified :: Prism' r () Source #
data WPIntensity Source #
The intensity of an observed or expected weather phenomenon.
Light | Light |
Moderate | Moderate |
Heavy | Heavy |
Vicinity | Only applicable to METARs. The weather phenomenon was observed in the vicinity of the observed area, not within the observed area itself. |
Recent | Only applicable to METARs. The weather phenomenon was recently observed in the past, but was not observed at the time the report was issued. |
class HasWPIntensity c where Source #
wPIntensity :: Lens' c WPIntensity Source #
class AsWPIntensity r where Source #
data Transition Source #
A transition in weather conditions. A transition can either be temporary or permanent; this will be encoded in the container structure.
TransWind Wind | A change of wind strength or direction |
TransVis [Visibility] | A change of visibility |
TransRunwayVis [(Runway, [Visibility], Maybe VisTrend)] | A change of visibility for a specific runway |
TransWX [WeatherPhenomenon] | A change of weather phenomenon |
TransClouds [Cloud] | A change of ceiling or cloud layers |
TransPressure [Pressure] | A change of ceiling or cloud layers |
class HasTransition c where Source #
transition :: Lens' c Transition Source #
class AsTransition r where Source #
_Transition :: Prism' r Transition Source #
_TransWind :: Prism' r Wind Source #
_TransVis :: Prism' r [Visibility] Source #
_TransRunwayVis :: Prism' r [(Runway, [Visibility], Maybe VisTrend)] Source #
_TransWX :: Prism' r [WeatherPhenomenon] Source #
_TransClouds :: Prism' r [Cloud] Source #
_TransPressure :: Prism' r [Pressure] Source #
A speed unit.