Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This module provides tools to parse and format Meterological Aerordome Reports. The WMO, which is the international authority for the code form, defines METAR as Aerodrome routine meteorological report and SPECI as Aerodrome routine special report. The FAA, on the other hand, uses aviation (routine|special) weather report.
This module is primarily compliant with WMO Technical Regulations - Annex II, but best efforts have been made to cater for the deviations described in the FAA Aeronautical Information Manual.
Relevant links
- WMO Technical Regulations - Annex II
- https://www.faa.gov/air_traffic/publications/media/aim.pdf
- METAR/SPECI on Wikipedia
- http://sto.iki.fi/metar
TODO: break module when implementing TAF TODO: support trend
- module Data.Icao.Location
- module Data.Icao.Time
- data ReportType
- data SpeedUnit
- data WindVariableDirection
- data WindSpeed
- data Wind
- data VisibilityTendency
- data VisibilityDistance
- data RunwayDesignator
- data ExtremeRvr
- data RunwayVisualRange
- data CompassPoint
- data Visibility
- data WeatherQualifier
- data WeatherDescriptor
- data WeatherPhenomenon
- = Drizzle
- | Rain
- | Snow
- | SnowGrains
- | IceCrystals
- | IcePellets
- | Hail
- | SmallHail
- | UnknownPrecipitation
- | Mist
- | Fog
- | Smoke
- | VolcanicAsh
- | WidespreadDust
- | Sand
- | Haze
- | Spray
- | Dust
- | Squall
- | FunnelCloud
- | Sandstorm
- | DustStorm
- data Weather
- data CloudType
- data CloudAmountType
- data CloudAmount
- data VerticalVisibility
- data NoCloudObserved
- data Clouds
- data Pressure
- data ReportModifiers
- data AerodromeReport
- cavok :: AerodromeReport -> Bool
- metar :: MonadFail m => String -> (Int, Int, Int) -> [AerodromeReport -> m AerodromeReport] -> m AerodromeReport
- speci :: MonadFail m => String -> (Int, Int, Int) -> [AerodromeReport -> m AerodromeReport] -> m AerodromeReport
- with :: MonadFail m => [AerodromeReport -> m AerodromeReport] -> AerodromeReport -> m AerodromeReport
- withModifiers :: MonadFail m => (Bool, Bool, Bool) -> AerodromeReport -> m AerodromeReport
- withWindDirection :: MonadFail m => Int -> AerodromeReport -> m AerodromeReport
- withWindSpeed :: MonadFail m => Int -> Maybe Int -> SpeedUnit -> AerodromeReport -> m AerodromeReport
- withWindVariation :: MonadFail m => Int -> Int -> AerodromeReport -> m AerodromeReport
- withPrevailingVisibility :: MonadFail m => Int -> AerodromeReport -> m AerodromeReport
- withFaaPrevailingVisibility :: MonadFail m => Maybe Int -> Maybe (Int, Int) -> AerodromeReport -> m AerodromeReport
- withLowestVisibility :: MonadFail m => Int -> Maybe CompassPoint -> AerodromeReport -> m AerodromeReport
- withRunwayVisualRange :: MonadFail m => String -> Int -> Maybe ExtremeRvr -> Maybe VisibilityTendency -> AerodromeReport -> m AerodromeReport
- withFaaRunwayVisualRange :: MonadFail m => String -> Int -> Maybe ExtremeRvr -> Maybe VisibilityTendency -> AerodromeReport -> m AerodromeReport
- withWeather :: MonadFail m => Maybe WeatherQualifier -> Maybe WeatherDescriptor -> [WeatherPhenomenon] -> AerodromeReport -> m AerodromeReport
- withCloudAmount :: MonadFail m => CloudAmountType -> Maybe Int -> Maybe CloudType -> AerodromeReport -> m AerodromeReport
- withObscuredSky :: MonadFail m => Maybe Int -> AerodromeReport -> m AerodromeReport
- withNoCloudObserved :: MonadFail m => NoCloudObserved -> AerodromeReport -> m AerodromeReport
- withTemperature :: MonadFail m => Int -> Int -> AerodromeReport -> m AerodromeReport
- withPressure :: MonadFail m => Int -> AerodromeReport -> m AerodromeReport
- withFaaPressure :: MonadFail m => Int -> AerodromeReport -> m AerodromeReport
- type Parser = ParsecT String () Identity
- data Error
- parser :: Parser AerodromeReport
- parse :: String -> Either Error AerodromeReport
Documentation
module Data.Icao.Location
module Data.Icao.Time
Data
data ReportType Source #
type of report.
Speed unit. TODO: move to Icao?
data WindVariableDirection Source #
Variable wind direction.
Wind speed in appropriate unit.
Wind group data. direction `000` and speed `00` indicates calm conditions.
data VisibilityTendency Source #
Visibility tendency at the runway.
data VisibilityDistance Source #
Visibility distance in appropriate unit.
data RunwayDesignator Source #
Runway designator: 2 digits possibly appended with L(eft) C(entral) or R(ight) for parallel runways.
data ExtremeRvr Source #
indicates an extreme value of runway visual range.
data RunwayVisualRange Source #
Runway visual range data.
data CompassPoint Source #
the 8 compass points.
data WeatherQualifier Source #
Weather qualifier.
LightWeather | light weather. |
HeavyWeather | heavy weather. |
InVicinityWeather |
data WeatherDescriptor Source #
Weather descriptor.
data WeatherPhenomenon Source #
Weather phenomenon.
Precipitation: Drizzle
to UnknownPrecipitation
.
Obscuration : Mist
to Spray
.
Drizzle | |
Rain | |
Snow | |
SnowGrains | |
IceCrystals | |
IcePellets | |
Hail | |
SmallHail | |
UnknownPrecipitation | |
Mist | visibility > 1000 m. |
Fog | visibility < 1000 m. |
Smoke | |
VolcanicAsh | |
WidespreadDust | |
Sand | |
Haze | |
Spray | |
Dust | well developed dust/sand whirls. |
Squall | |
FunnelCloud | tornado, waterspout are always +FC, i.e. heavy FunnelCloud. |
Sandstorm | |
DustStorm |
Cloud type.
data CloudAmountType Source #
Cloud amount type.
data VerticalVisibility Source #
Vertical visibility in hundreds of feet.
data NoCloudObserved Source #
Sky conditions when cloud were not observed.
Clouds observation.
data ReportModifiers Source #
Report modifiers.
data AerodromeReport Source #
an aerodrome routine or special meteorological report.
cavok :: AerodromeReport -> Bool Source #
Determines the given AerodromeReport
reports Cloud And Visibility OK (CAVOK).
CAVOK is an abbreviation for Cloud 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.
Builders
metar :: MonadFail m => String -> (Int, Int, Int) -> [AerodromeReport -> m AerodromeReport] -> m AerodromeReport Source #
Builds a periodic AerodromeReport
(METAR) for the given station and time and all given
setter.
If no setters
are provided, the METAR will contain no Wind (Calm conditions),
report cavok
conditions ISA temperature (15 degrees Celsius) and pressure (1013 hPa)
See with
and withXXXX
functions.
example = Report "ESSA" (18, 21, 48) [withWindDirection 150, withWindSpeed 40 Nothing KT]
speci :: MonadFail m => String -> (Int, Int, Int) -> [AerodromeReport -> m AerodromeReport] -> m AerodromeReport Source #
Builds a special AerodromeReport
(SPECI) for the given station and time and all given
setter.
see metar
.
with :: MonadFail m => [AerodromeReport -> m AerodromeReport] -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by running each given setter.
withModifiers :: MonadFail m => (Bool, Bool, Bool) -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the modifiers (COR, AUTO, MIS).
withWindDirection :: MonadFail m => Int -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the wind direction.
withWindSpeed :: MonadFail m => Int -> Maybe Int -> SpeedUnit -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the wind speed (spd
) and gust (@gst).
withWindVariation :: MonadFail m => Int -> Int -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the wind variation.
withPrevailingVisibility :: MonadFail m => Int -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the prevailing visibility according to the WMO standard.
the visibility is expressed in Metres.
withFaaPrevailingVisibility :: MonadFail m => Maybe Int -> Maybe (Int, Int) -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the prevailing visibility according to the FAA standard.
the visibility is expressed in statue miles (mile
and fraction
).
withLowestVisibility :: MonadFail m => Int -> Maybe CompassPoint -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the lowest visibility (Metre) and for a direction (if any).
Note: this is not supported by the FAA standard.
withRunwayVisualRange :: MonadFail m => String -> Int -> Maybe ExtremeRvr -> Maybe VisibilityTendency -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by adding a runway visual range (RVR) according to the WMO standard.
the runway visibility is expressed in Metres.
withFaaRunwayVisualRange :: MonadFail m => String -> Int -> Maybe ExtremeRvr -> Maybe VisibilityTendency -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by adding a runway visual range (RVR) according to the FAA standard.
the runway visibility is expressed in feet.
withWeather :: MonadFail m => Maybe WeatherQualifier -> Maybe WeatherDescriptor -> [WeatherPhenomenon] -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by adding a weather observation.
withCloudAmount :: MonadFail m => CloudAmountType -> Maybe Int -> Maybe CloudType -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by adding the cloud amount observation.
withObscuredSky :: MonadFail m => Maybe Int -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the obscured sky observation.
withNoCloudObserved :: MonadFail m => NoCloudObserved -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the reason why no clouds were observed.
withTemperature :: MonadFail m => Int -> Int -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the temperature and dew point.
withPressure :: MonadFail m => Int -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the pressure in Hectopascals.
withFaaPressure :: MonadFail m => Int -> AerodromeReport -> m AerodromeReport Source #
Modifies the given report
by setting the pressure in inches of mercury.
Parsers
Parsing error.
parser :: Parser AerodromeReport Source #
AerodromeReport
parser.
This parser supports both the WMO code definition and the variation defined by the FAA.
parse :: String -> Either Error AerodromeReport Source #
Parses the given textual representation of a AerodromeReport
using Parser
.
return either an Error
(Left
) or the parsed AerodromeReport
(Right
).