notam 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 82e0d9749642d667ef8b547cb0fea44184dd695889258798302ca5875b019947
4
+ data.tar.gz: 7a7b5ebd3fe9fcd0b8368e66911b24228672283048d3e83cfc87ab2c923e1805
5
+ SHA512:
6
+ metadata.gz: a98c7ae52e81387a1699c3d668e1fae0536112ef6cbc5ae071f5a98d4c096c33f0a71a25174c9c4c6bec6a183f75a7ebc03aa23ff44de87033895b7746ff4a28
7
+ data.tar.gz: 72811552016bbd955f52cab2fac066ffbafae6683eefb4f19f738c9186d736db6b4948b30dab04440d9b08f4e863d00e74af517bb0f20f45e9b438da277b8d76
checksums.yaml.gz.sig ADDED
Binary file
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ ## Main
2
+
3
+ Nothing so far
4
+
5
+ ## 0.1.0
6
+
7
+ #### Initial Implementation
8
+ * Require Ruby 3.0
9
+ * `NOTAM::Message` and `NOTAM::Item` (Header, Q, A-G, Footer)
10
+ * `NOTAM::Schedule` with useful tools like `slice` and `resolve`
11
+ * Expansion of contractions on E item
12
+ * Tests against live NOTAM
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Sven Schwyn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,223 @@
1
+ [![Version](https://img.shields.io/gem/v/notam.svg?style=flat)](https://rubygems.org/gems/notam)
2
+ [![Tests](https://img.shields.io/github/workflow/status/svoop/notam/Test.svg?style=flat&label=tests)](https://github.com/svoop/notam/actions?workflow=Test)
3
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/notam/notam.svg?style=flat)](https://codeclimate.com/github/svoop/notam/)
4
+ [![Donorbox](https://img.shields.io/badge/donate-on_donorbox-yellow.svg)](https://donorbox.org/bitcetera)
5
+
6
+ # NOTAM
7
+
8
+ Parser for [NOTAM (Notice to Airmen)](https://www.icao.int/safety/istars/pages/notams.aspx) messages in Ruby.
9
+
10
+ * [Homepage](https://github.com/svoop/notam)
11
+ * [API](https://www.rubydoc.info/gems/notam)
12
+ * Author: [Sven Schwyn - Bitcetera](https://bitcetera.com)
13
+
14
+ ## Install
15
+
16
+ ### Security
17
+
18
+ This gem is [cryptographically signed](https://guides.rubygems.org/security/#using-gems) in order to assure it hasn't been tampered with. Unless already done, please add the author's public key as a trusted certificate now:
19
+
20
+ ```
21
+ gem cert --add <(curl -Ls https://raw.github.com/svoop/notam/main/certs/svoop.pem)
22
+ ```
23
+
24
+ ### Bundler
25
+
26
+ Add the following to the `Gemfile` or `gems.rb` of your [Bundler](https://bundler.io) powered Ruby project:
27
+
28
+ ```ruby
29
+ gem notam
30
+ ```
31
+
32
+ And then install the bundle:
33
+
34
+ ```
35
+ bundle install --trust-policy MediumSecurity
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```ruby
41
+ raw_notam_text_message = <<~END
42
+ W0902/22 NOTAMN
43
+ Q) LSAS/QRRCA/V/BO/W/000/148/4624N00702E004
44
+ A) LSAS B) 2204110900 C) 2205131400 EST
45
+ D) APR 11 SR MINUS15-1900, 20-21 26-28 MAY 03-05 10-12 0530-2100, APR
46
+ 14 22 29 MAY 06 13 0530-1400, APR 19 25 MAY 02 09 0800-2100
47
+ E) R-AREA LS-R7 HONGRIN ACT DUE TO FRNG.
48
+ F) GND
49
+ G) 14800FT AMSL
50
+ CREATED: 11 Apr 2022 06:10:00
51
+ SOURCE: LSSNYNYX
52
+ END
53
+
54
+ notam = NOTAM.parse(raw_notam_text_message)
55
+ notam.data # => Hash
56
+ ```
57
+
58
+ The resulting hash for this example looks as follows:
59
+
60
+ ```ruby
61
+ {
62
+ id: "W0902/22",
63
+ id_series: "W",
64
+ id_number: 902,
65
+ id_year: 2022,
66
+ new?: true,
67
+ fir: "LSAS",
68
+ subject: :restricted_area,
69
+ condition: :activated,
70
+ traffic: :vfr,
71
+ purpose: [:operational_significance, :flight_operations],
72
+ scope: [:navigation_warning],
73
+ lower_limit: #<AIXM::Z 14800 ft QNH>,
74
+ upper_limit: #<AIXM::Z 0 ft QFE>,
75
+ center_point: #<AIXM::XY 46.40000000N 007.03333333E>,
76
+ radius: #<AIXM::D 4.0 nm>,
77
+ locations: ["LSAS"],
78
+ part_index: 1,
79
+ part_index_max: 1,
80
+ effective_at: 2022-04-11 09:00:00 UTC,
81
+ expiration_at: 2022-05-13 14:00:00 UTC,
82
+ estimated_expiration?: false,
83
+ no_expiration?: true,
84
+ schedules: [
85
+ #<NOTAM::Schedule actives: [2022-04-11], times: [sunrise-15min..19:00 UTC], inactives: []>,
86
+ #<NOTAM::Schedule actives: [2022-04-20..2022-04-21, 2022-04-26..2022-04-28, 2022-05-03..2022-05-05, 2022-05-10..2022-05-12], times: [05:30 UTC..21:00 UTC], inactives: []>,
87
+ #<NOTAM::Schedule actives: [2022-04-14, 2022-04-22, 2022-04-29, 2022-05-06, 2022-05-13], times: [05:30 UTC..14:00 UTC], inactives: []>,
88
+ #<NOTAM::Schedule actives: [2022-04-19, 2022-04-25, 2022-05-02, 2022-05-09], times: [08:00 UTC..21:00 UTC], inactives: []>
89
+ ],
90
+ five_day_schedules: [
91
+ #<NOTAM::Schedule actives: [2022-04-11], times: [04:35 UTC..19:00 UTC], inactives: []>,
92
+ #<NOTAM::Schedule actives: [2022-04-14], times: [05:30 UTC..14:00 UTC], inactives: []>
93
+ ],
94
+ content: "R-AREA LS-R7 HONGRIN ACT DUE TO FRNG.",
95
+ translated_content: "R-AREA LS-R7 HONGRIN ACTIVE DUE TO FRNG.",
96
+ created: 2022-04-11 06:10:00 UTC,
97
+ source: "LSSNYNYX"
98
+ }
99
+ ```
100
+
101
+ A few highlights to note here:
102
+
103
+ * Value classes of the [AIXM gem](https://rubygems.org/gems/aixm) are used to ease further processing.
104
+ * Schedules can be pretty complex, therefore a simpler `five_day_schedule` is calculated for the day the NOTAM becomes effective and the four subsequent days. This short term schedule does not contain exceptions nor events such as sunrises anymore. Furthermore, you can calculate different custom sub-schedules using `slice` and `resolve`.
105
+ * Content is processed to `translated_content`. As of now, known english contractions are expanded. Feel free to contribute non-english locale files read by the [I18n gem](https://rubygems.org/gems/i18n).
106
+
107
+ Since NOTAM may contain a certain level of redundancy, the parser does some integrity checks, fixes the payload if possible and issues a warning.
108
+
109
+ You get a `NOTAM::ParseError` in case the raw NOTAM text message fails to be parsed. If you're sure the NOTAM is correct, please [submit an issue](#development) or fix the bug and [submit a pull request](#development).
110
+
111
+ See the [API documentation](https://www.rubydoc.info/gems/notam) for more.
112
+
113
+ ⚠️ Only NOTAM compatible with the ICAO annex 15 are supported for now. Most notably in the USA other NOTAM formats exist which cannot be parsed using this gem.
114
+
115
+ ### FIR
116
+
117
+ Four letter FIR codes assigned by the ICAO follow some logic, albeit there exist exceptions and inconsistencies e.g. for historical reasons. Let's take an easy example:
118
+
119
+ ```
120
+ L F M M
121
+ ┬ ┬ ─┬─
122
+ │ │ └─ global area: L => lower Europe
123
+ │ └──── geopolitical unit: F => France
124
+ └────── subsection: MM => Marseille
125
+ ```
126
+
127
+ The informal use of only the first two letters often stands for a combination of all subsections contained therein. Example: `LF` is a combination of `LFBB`, `LFEE`, `LFFF`, `LFMM` and `LFRR`.
128
+
129
+ FIR codes ending with `XX` specify more than one subsection. Example: `LFXX` is a combination of two subsections with in `LF`. In NOTAM, this notation may be used on the Q item if (and only if) the affected subsections are listed on the A item.
130
+
131
+ ### Series
132
+
133
+ The first letter of the NOTAM ID is identifying the series. The following example is part of series `S`:
134
+
135
+ ```
136
+ S0054/02 NOTAMN
137
+ ```
138
+
139
+ AIS are free to define series as they please, however, a few conventions have emerged:
140
+
141
+ * **Series A**<br>General rules, en-route navigation and communication facilities, airspace restrictions and activities taking place above FL 245 as well as information concerning major international aerodromes.
142
+ * **Series B**<br>Information on airspace restrictions, on activities taking place at or below FL 245 and on other international aerodromes at which IFR flights are permitted.
143
+ * **Series C**<br>Information on other international aerodromes at which only VFR flights are permitted.
144
+ * **Series D**<br>Information on national aerodromes
145
+ * **Series E**<br>Information on heliports
146
+ * **Series S** (aka: SNOWTAM)<br>Surface condition reports
147
+ * **Series T**<br>Reserved for NOTAM processing units in cases when basic operational information was not triggered by the issuing AIS.
148
+ * **Series V** (aka: ASHTAM)<br>Volcano ash condition reports
149
+
150
+ ### Special NOTAM
151
+
152
+ #### Checklist
153
+
154
+ Checklist NOTAM are periodically issued lists of all currently effective NOTAM. They are used for cross checking and can usually be ignored for flight planning. Their Q item contain `Q..KK` which is decoded as "condition: :checklist", here's an example:
155
+
156
+ ```
157
+ Q) EDXX/QKKKK/K /K /K /000/999/5123N01018E999
158
+ ```
159
+
160
+ #### Trigger
161
+
162
+ Trigger NOTAM are referring to another source of information such as AIP SUP (AIP supplement). Their Q item contain `Q..TT` which is decoded as "condition: :trigger", here's an example:
163
+
164
+ ```
165
+ Q) LFXX/QRTTT/IV/BO /W /000/035/4708N00029E010
166
+ ```
167
+
168
+ Note: Trigger NOTAM are never published as series `T`.
169
+
170
+ ### Schedules
171
+
172
+ For compatibility, schedule dates and times are expressed using the corresponding classes from the [AIXM gem](https://rubygems.org/gems/aixm):
173
+
174
+ * [Date](https://www.rubydoc.info/gems/aixm/AIXM/Schedule/Date)
175
+ * [Day](https://www.rubydoc.info/gems/aixm/AIXM/Schedule/Day)
176
+ * [Time](https://www.rubydoc.info/gems/aixm/AIXM/Schedule/Time)
177
+
178
+ ### References
179
+
180
+ * [ICAO Annex 15 on NOTAM](https://www.bazl.admin.ch/bazl/en/home/specialists/regulations-and-guidelines/legislation-and-directives/anhaenge-zur-konvention-der-internationalen-zivilluftfahrtorgani.html)
181
+ * [NOTAM Q Codes](https://www.faa.gov/air_traffic/publications/atpubs/notam_html/appendix_b.html)
182
+ * [Guide de la consultation NOTAM (fr)](https://www.sia.aviation-civile.gouv.fr/pub/media/news/file/g/u/guide_de_la_consultation_notam_05-10-2017-1.pdf)
183
+ * [NOTAM Contractions](https://www.notams.faa.gov/downloads/contractions.pdf)
184
+ * [NOTAM format cheat sheet](http://vat-air.dk/files/ICAO%20NOTAM%20format.pdf)
185
+ * [Introduction on Wikipedia](https://en.wikipedia.org/wiki/NOTAM)
186
+
187
+ ## Translations
188
+
189
+ You find the translations for each available language in `lib/locales/`. Additional translations are very welcome provided you have sufficient aeronautical background knowledge.
190
+
191
+ Please [create a translation request issue](https://github.com/svoop/notam/issues), then duplicate the `lib/locales/en.yml` reference language file and translate it.
192
+
193
+ ## Tests and Fixtures
194
+
195
+ The test suite may run against live NOTAM if you set the `SPEC_SCOPE` environment variable:
196
+
197
+ ```
198
+ export SPEC_SCOPE=all # run against all NOTAM fixtures
199
+ export SPEC_SCOPE=all-fast # run against all NOTAM fixtures but exit on the first failure
200
+ export SPEC_SCOPE=W0214/22 # run against given NOTAM fixture only
201
+ ```
202
+
203
+ The NOTAM fixtures are written to `spec/fixtures`, you can manage them using a Rake tasks:
204
+
205
+ ```
206
+ rake --tasks fixtures
207
+ ```
208
+
209
+ ## Development
210
+
211
+ To install the development dependencies and then run the test suite:
212
+
213
+ ```
214
+ bundle install
215
+ bundle exec rake # run tests once
216
+ bundle exec guard # run tests whenever files are modified
217
+ ```
218
+
219
+ You're welcome to [submit issues](https://github.com/svoop/notam/issues) and contribute code by [forking the project and submitting pull requests](https://docs.github.com/en/get-started/quickstart/fork-a-repo).
220
+
221
+ ## License
222
+
223
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).