1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
#[derive(PartialEq, Eq, Clone, Debug)] /// A struct to store time as it is represented in a METAR pub struct Time { /// The date the METAR was made pub date: u8, /// The hour the METAR was made pub hour: u8, /// The minute the METAR was made pub minute: u8, } #[derive(PartialEq, Eq, Clone, Debug)] /// A struct representing the wind speed pub enum WindSpeed { /// A wind speed measured in knots Knot(u32), /// A wind speed measured in metres per second MetresPerSecond(u32), } #[derive(PartialEq, Eq, Clone, Debug)] /// A representation of wind direction pub enum WindDirection { /// A heading defining wind direction Heading(u32), /// Wind direction is variable Variable, /// Wind speed is above 49mps or 99kt Above, } #[derive(PartialEq, Clone, Debug)] /// Horizontal visibility pub enum Visibility { /// Visibility in metres Metres(u32), /// Visibility in statute miles StatuteMiles(f32), /// Clouds and Visibility OK (CAVOK) CavOK, } #[derive(PartialEq, Eq, Clone, Debug)] /// Measured air pressure pub enum Pressure { /// Pressure in hectopascals Hectopascals(u32), /// Pressure in inches of mercury (inHg) InchesMercury(u32), } #[derive(PartialEq, Eq, Clone, Debug)] /// Vertical visibility measurement pub enum VertVisibility { /// A distance of vertical visibility Distance(u32), /// The vertical visibility value is present, so is reduced, but by an amount that hasn't or /// cannot be measured ReducedByUnknownAmount, } #[derive(PartialEq, Eq, Clone, Debug)] /// Cloud state pub enum Clouds { /// The sky is clear - also set from CavOK SkyClear, /// No cloud was detected NoCloudDetected, /// No significant cloud was detected below 5000ft NoSignificantCloud, /// Layers of cloud, described elsewhere CloudLayers, /// Only used when vertical visibility is set. Undetermined, } #[derive(PartialEq, Eq, Clone, Debug)] /// Cloud cover pub enum CloudLayer { /// Few clouds (1/8) Few(CloudType, Option<u32>), /// Scattered cloud cover (3/8) Scattered(CloudType, Option<u32>), /// Broken cloud cover (5/8) Broken(CloudType, Option<u32>), /// Overcast cloud cover (7/8) Overcast(CloudType, Option<u32>), /// Cloud cover of an unknown density Unknown(CloudType, Option<u32>), } #[derive(PartialEq, Eq, Clone, Debug)] /// A cloud type description pub enum CloudType { /// A normal cloud Normal, /// A cumulonimbus cloud Cumulonimbus, /// A towering cumulus cloud ToweringCumulus, /// An unknown cloud type Unknown, } #[derive(PartialEq, Eq, Clone, Debug)] /// A weather information block pub struct Weather { /// The intensity of this weather block pub intensity: WeatherIntensity, /// The weather condition/s this block describes. pub conditions: Vec<WeatherCondition>, } #[derive(PartialEq, Eq, Clone, Debug)] /// Intensity of weather pub enum WeatherIntensity { /// Light (-) Light, /// Moderate (no prefix) Moderate, /// Heavy (+) Heavy, /// In the vicinity (VC) InVicinity, } #[derive(PartialEq, Eq, Clone, Debug)] /// Descriptor of weather pub enum WeatherCondition { /// [Descriptor] Shallow (MI) Shallow, /// [Descriptor] Partial (PR) Partial, /// [Descriptor] Patches (BC) Patches, /// [Descriptor] Low drifting (DR) LowDrifting, /// [Descriptor] Blowing (BL) Blowing, /// [Descriptor] Showers (SH) Showers, /// [Descriptor] Thunderstorm (TS) Thunderstorm, /// [Descriptor] Freezing (FZ) Freezing, /// [Precipitation] Rain (RA) Rain, /// [Precipitation] Drizzle (DZ) Drizzle, /// [Precipitation] Snow (SN) Snow, /// [Precipitation] Snow Grains (SG) SnowGrains, /// [Precipitation] Ice Crystals (IC) IceCrystals, /// [Precipitation] Ice pellets (PL) IcePellets, /// [Precipitation] Hail (including small hail in the US) (GR) Hail, /// [Precipitation] Snow Pellets and/or Small Hail (except in US) (GS) SnowPelletsOrSmallHail, /// [Precipitation] Unknown precipitation (UP) UnknownPrecipitation, /// [Obscuration] Fog (FG) Fog, /// [Obscuration] Volcanic Ash (VA) VolcanicAsh, /// [Obscuration] Mist (BR) Mist, /// [Obscuration] Haze (HZ) Haze, /// [Obscuration] Widespread dust (DU) WidespreadDust, /// [Obscuration] Smoke (FU) Smoke, /// [Obscuration] Sand (SA) Sand, /// [Obscuration] Spray (PY) Spray, /// [Other] Squall (SQ) Squall, /// [Other] Dust or Sand Whirls (PO) Dust, /// [Other] Duststorm (DS) Duststorm, /// [Other] Sandstorm (SS) Sandstorm, /// [Other] Funnel Cloud (FC) FunnelCloud, } #[derive(PartialEq, Eq, Clone, Debug)] /// Wind information pub struct Wind { /// The wind direction, in degrees pub dir: WindDirection, /// The current wind speed pub speed: WindSpeed, /// The direction the wind may be varying between, smaller always comes first pub varying: Option<(u32, u32)>, /// The gusting speed of the wind pub gusting: Option<WindSpeed>, }