atmospheric 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.adoc +652 -183
  4. data/lib/atmospheric/export/altitude_attrs.rb +238 -0
  5. data/lib/atmospheric/export/altitude_convertable_model.rb +84 -0
  6. data/lib/atmospheric/export/altitude_table.rb +51 -0
  7. data/lib/atmospheric/export/hypsometrical_table.rb +38 -0
  8. data/lib/atmospheric/export/iso_25331975/group_one.rb +15 -27
  9. data/lib/atmospheric/export/iso_25331975/group_one_attrs.rb +88 -0
  10. data/lib/atmospheric/export/iso_25331975/group_three.rb +14 -27
  11. data/lib/atmospheric/export/iso_25331975/group_three_attrs.rb +87 -0
  12. data/lib/atmospheric/export/iso_25331975/group_two.rb +14 -28
  13. data/lib/atmospheric/export/iso_25331975/group_two_attrs.rb +96 -0
  14. data/lib/atmospheric/export/iso_25331975.rb +5 -17
  15. data/lib/atmospheric/export/iso_25331985/pressure_attrs.rb +19 -0
  16. data/lib/atmospheric/export/iso_25331985/table_five_six_attrs.rb +19 -0
  17. data/lib/atmospheric/export/iso_25331985.rb +42 -63
  18. data/lib/atmospheric/export/iso_25331997.rb +21 -39
  19. data/lib/atmospheric/export/iso_25332025/altitude_attrs_group.rb +27 -0
  20. data/lib/atmospheric/export/iso_25332025/combined_altitude_attrs_group.rb +44 -0
  21. data/lib/atmospheric/export/iso_25332025.rb +81 -0
  22. data/lib/atmospheric/export/pressure_attrs.rb +93 -0
  23. data/lib/atmospheric/export/{target.rb → utils.rb} +10 -13
  24. data/lib/atmospheric/export.rb +3 -1
  25. data/lib/atmospheric/isa.rb +119 -114
  26. data/lib/atmospheric/unit_value_float.rb +24 -0
  27. data/lib/atmospheric/unit_value_integer.rb +24 -0
  28. data/lib/atmospheric/version.rb +1 -1
  29. data/lib/atmospheric.rb +1 -0
  30. metadata +38 -28
  31. data/lib/atmospheric/export/hypsometrical_tables.rb +0 -34
  32. data/lib/atmospheric/export/iso_25331975/group_base.rb +0 -72
  33. data/lib/atmospheric/export/iso_25332024.rb +0 -205
  34. data/spec/fixtures/iso-2533-1975-table5.yaml +0 -18297
  35. data/spec/fixtures/iso-2533-1975-table6.yaml +0 -18298
  36. data/spec/fixtures/iso-2533-1975-table7.yaml +0 -16265
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atmospheric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-03 00:00:00.000000000 Z
11
+ date: 2025-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal
@@ -25,36 +25,37 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: lutaml-model
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '13.0'
34
- type: :development
33
+ version: 0.7.0
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '13.0'
40
+ version: 0.7.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
48
- type: :development
47
+ version: '0'
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '0'
55
55
  description: |-
56
- Implementation of International Standard Atmosphere (ISA) formulas as
57
- defined in ISO 2533:1975 and ICAO 7488/3 1994"
56
+ Implementation of the ISO Standard Atmosphere (ISA) model as
57
+ defined in ISO 2533 and ICAO 7488/3 1994.
58
+ Reference implementation used in ISO 2533:2025."
58
59
  email:
59
60
  - open.source@ribose.com
60
61
  executables: []
@@ -67,26 +68,35 @@ files:
67
68
  - README.adoc
68
69
  - lib/atmospheric.rb
69
70
  - lib/atmospheric/export.rb
70
- - lib/atmospheric/export/hypsometrical_tables.rb
71
+ - lib/atmospheric/export/altitude_attrs.rb
72
+ - lib/atmospheric/export/altitude_convertable_model.rb
73
+ - lib/atmospheric/export/altitude_table.rb
74
+ - lib/atmospheric/export/hypsometrical_table.rb
71
75
  - lib/atmospheric/export/iso_25331975.rb
72
- - lib/atmospheric/export/iso_25331975/group_base.rb
73
76
  - lib/atmospheric/export/iso_25331975/group_one.rb
77
+ - lib/atmospheric/export/iso_25331975/group_one_attrs.rb
74
78
  - lib/atmospheric/export/iso_25331975/group_three.rb
79
+ - lib/atmospheric/export/iso_25331975/group_three_attrs.rb
75
80
  - lib/atmospheric/export/iso_25331975/group_two.rb
81
+ - lib/atmospheric/export/iso_25331975/group_two_attrs.rb
76
82
  - lib/atmospheric/export/iso_25331985.rb
83
+ - lib/atmospheric/export/iso_25331985/pressure_attrs.rb
84
+ - lib/atmospheric/export/iso_25331985/table_five_six_attrs.rb
77
85
  - lib/atmospheric/export/iso_25331997.rb
78
- - lib/atmospheric/export/iso_25332024.rb
79
- - lib/atmospheric/export/target.rb
86
+ - lib/atmospheric/export/iso_25332025.rb
87
+ - lib/atmospheric/export/iso_25332025/altitude_attrs_group.rb
88
+ - lib/atmospheric/export/iso_25332025/combined_altitude_attrs_group.rb
89
+ - lib/atmospheric/export/pressure_attrs.rb
90
+ - lib/atmospheric/export/utils.rb
80
91
  - lib/atmospheric/isa.rb
92
+ - lib/atmospheric/unit_value_float.rb
93
+ - lib/atmospheric/unit_value_integer.rb
81
94
  - lib/atmospheric/version.rb
82
- - spec/fixtures/iso-2533-1975-table5.yaml
83
- - spec/fixtures/iso-2533-1975-table6.yaml
84
- - spec/fixtures/iso-2533-1975-table7.yaml
85
95
  homepage: https://github.com/metanorma/atmospheric
86
96
  licenses:
87
97
  - BSD-2-Clause
88
98
  metadata: {}
89
- post_install_message:
99
+ post_install_message:
90
100
  rdoc_options: []
91
101
  require_paths:
92
102
  - lib
@@ -94,15 +104,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
104
  requirements:
95
105
  - - ">="
96
106
  - !ruby/object:Gem::Version
97
- version: 2.5.0
107
+ version: 3.0.0
98
108
  required_rubygems_version: !ruby/object:Gem::Requirement
99
109
  requirements:
100
110
  - - ">="
101
111
  - !ruby/object:Gem::Version
102
112
  version: '0'
103
113
  requirements: []
104
- rubygems_version: 3.3.27
105
- signing_key:
114
+ rubygems_version: 3.5.22
115
+ signing_key:
106
116
  specification_version: 4
107
- summary: Implementation of International Standard Atmosphere (ISA) formulas"
117
+ summary: Implementation of the ISO Standard Atmosphere (ISA) model"
108
118
  test_files: []
@@ -1,34 +0,0 @@
1
- require_relative "./target"
2
-
3
- module Atmospheric
4
- module Export
5
-
6
- module HypsometricalTables
7
- class TableBase
8
- include Target
9
-
10
- def to_h(unit: steps_unit)
11
- d = { "rows" => [] }
12
- steps.each do |p|
13
- d["rows"] << row(p, unit: unit)
14
- end
15
- d
16
- end
17
-
18
- def steps
19
- (0..0)
20
- end
21
-
22
- def steps_unit
23
- :mbar
24
- end
25
-
26
- def row(p, unit: steps_unit)
27
- {}
28
- end
29
- end
30
-
31
- end
32
-
33
- end
34
- end
@@ -1,72 +0,0 @@
1
- require_relative "../target"
2
-
3
- module Atmospheric
4
- module Export
5
- module Iso25331975
6
- class GroupBase
7
- include Target
8
-
9
- def row_big_h(h, unit: :meters)
10
- hgpm, hgpf = values_in_m_ft(h, unit: unit)
11
- hgmm = Isa.geometric_altitude_from_geopotential(hgpm)
12
- hgmf = m_to_ft(hgmm).round
13
- height_hash(hgmm, hgmf, hgpm, hgpf)
14
- .merge(self.row_from_geopotential(hgpm))
15
- end
16
-
17
- def row_small_h(h, unit: :meters)
18
- hgmm, hgmf = values_in_m_ft(h, unit: unit)
19
- hgpm = Isa.geopotential_altitude_from_geometric(hgmm)
20
- hgpf = m_to_ft(hgpm).round
21
- height_hash(hgmm, hgmf, hgpm, hgpf)
22
- .merge(self.row_from_geopotential(hgpm))
23
- end
24
-
25
- def height_hash(hgmm, hgmf, hgpm, hgpf)
26
- {
27
- "geometrical-altitude-m" => hgmm.round,
28
- "geometrical-altitude-ft" => hgmf.round,
29
- "geopotential-altitude-m" => hgpm.round,
30
- "geopotential-altitude-ft" => hgpf.round,
31
- }
32
- end
33
-
34
- def values_in_m_ft(value, unit: :meters)
35
- case unit
36
- when :meters
37
- [value.to_f, m_to_ft(value)]
38
- when :feet
39
- [ft_to_m(value), value.to_f]
40
- end
41
- end
42
-
43
- # Step 50 from -2k to 40k, step 100 above 32k, 200 above 51k to 80k
44
- def steps
45
- (
46
- (-2000..31950).step(50) +
47
- (32000..50900).step(100) +
48
- (51000..80000).step(200)
49
- )
50
- end
51
-
52
- def steps_unit
53
- :meters
54
- end
55
-
56
- def to_h(unit: steps_unit)
57
- d = {
58
- "by-geometrical-altitude" => [],
59
- "by-geopotential-altitude" => [],
60
- }
61
-
62
- steps.each do |h|
63
- d["by-geometrical-altitude"] << row_small_h(h, unit: unit)
64
- d["by-geopotential-altitude"] << row_big_h(h, unit: unit)
65
- end
66
- d
67
- end
68
- end
69
-
70
- end
71
- end
72
- end
@@ -1,205 +0,0 @@
1
- require_relative "./target"
2
- require_relative "./hypsometrical_tables"
3
- require_relative "./iso_25331975"
4
-
5
- module Atmospheric
6
- module Export
7
-
8
- module Iso25332024
9
-
10
- module GroupBaseMeters
11
- def steps
12
- (
13
- (-5000..31950).step(50) +
14
- (32000..50900).step(100) +
15
- (51000..80000).step(200)
16
- )
17
- end
18
- end
19
-
20
- class GroupOneMeters < Iso25331975::GroupOne
21
- include Iso25332024::GroupBaseMeters
22
- end
23
-
24
- class GroupTwoMeters < Iso25331975::GroupTwo
25
- include Iso25332024::GroupBaseMeters
26
- end
27
-
28
- class GroupThreeMeters < Iso25331975::GroupThree
29
- include Iso25332024::GroupBaseMeters
30
- end
31
-
32
- module GroupBaseFeet
33
- def steps
34
- (
35
- (-16500..-13750).step(250) +
36
- (-14000..104800).step(200) +
37
- (105000..262500).step(500)
38
- )
39
- end
40
-
41
- def steps_unit
42
- :feet
43
- end
44
- end
45
-
46
- class GroupOneFeet < Iso25331975::GroupOne
47
- include Iso25332024::GroupBaseFeet
48
- end
49
-
50
- class GroupTwoFeet < Iso25331975::GroupTwo
51
- include Iso25332024::GroupBaseFeet
52
- end
53
-
54
- class GroupThreeFeet < Iso25331975::GroupThree
55
- include Iso25332024::GroupBaseFeet
56
- end
57
-
58
- class HypsometricalMbar < HypsometricalTables::TableBase
59
- # TODO: when Ruby's step does not create inaccurate floating point numbers
60
- # This is a hack to solve a Ruby bug with floating point calcuations
61
- # > (20.0..1770.9).step(0.1).to_a
62
- # ...
63
- # 1769.4,
64
- # 1769.5,
65
- # 1769.6000000000001, # <== we need to clean these
66
- # 1769.7,
67
- # 1769.8000000000002, # <== we need to clean these
68
- # The last `map` should be removed if this bug is fixed
69
- def steps
70
- (
71
- (5.0..19.99).step(0.01).to_a.map {|v| v.round(2)} +
72
- (20.0..1770.9).step(0.1).to_a.map {|v| v.round(1)}
73
- )
74
- end
75
-
76
- def steps_unit
77
- :mbar
78
- end
79
-
80
- def row(p, unit:)
81
- method_name = "geopotential_altitude_from_pressure_#{unit}"
82
- gp_h_m = Isa.send(method_name, p)
83
- gp_h_ft = m_to_ft(gp_h_m)
84
- gm_h_m = Isa.geometric_altitude_from_geopotential(gp_h_m)
85
- gm_h_ft = m_to_ft(gm_h_m)
86
- {
87
- "pressure-#{unit}" => p,
88
- "geopotential-altitude-m" => gp_h_m.round(1),
89
- "geopotential-altitude-ft" => gp_h_ft.round,
90
- "geometric-altitude-m" => gm_h_m.round(1),
91
- "geometric-altitude-ft" => gm_h_ft.round,
92
- }
93
- end
94
- end
95
-
96
- class HypsometricalGeometric < HypsometricalTables::TableBase
97
- def steps
98
- (-1000..4599).step(1)
99
- end
100
-
101
- def row(hgmm, unit:)
102
- hgpm = Isa.geopotential_altitude_from_geometric(hgmm)
103
- {
104
- "geometric-altitude-m" => hgpm,
105
- "pressure-mbar" => round_to_sig_figs(Isa.pressure_from_geopotential_mbar(hgpm.to_f), 6),
106
- # "pressure-mmhg" => round_to_sig_figs(Isa.pressure_from_geopotential_mmhg(hgpm.to_f), 6),
107
- }
108
- end
109
- end
110
-
111
- class HypsometricalGeopotential < HypsometricalTables::TableBase
112
- def steps
113
- (-1000..4599).step(1)
114
- end
115
-
116
- def row(hgpm, unit:)
117
- {
118
- "geopotential-altitude-m" => hgpm,
119
- "pressure-mbar" => round_to_sig_figs(Isa.pressure_from_geopotential_mbar(hgpm.to_f), 6),
120
- # "pressure-mmhg" => round_to_sig_figs(Isa.pressure_from_geopotential_mmhg(hgpm.to_f), 6),
121
- }
122
- end
123
- end
124
-
125
-
126
-
127
- class << self
128
- def table_5
129
- GroupOneMeters.new.to_h
130
- end
131
-
132
- def table_6
133
- GroupTwoMeters.new.to_h
134
- end
135
-
136
- def table_7
137
- GroupThreeMeters.new.to_h
138
- end
139
-
140
- def table_8
141
- GroupOneFeet.new.to_h
142
- end
143
-
144
- def table_9
145
- GroupTwoFeet.new.to_h
146
- end
147
-
148
- def table_10
149
- GroupThreeFeet.new.to_h
150
- end
151
-
152
- def table_11
153
- HypsometricalMbar.new.to_h
154
- end
155
-
156
- def table_12
157
- HypsometricalGeometric.new.to_h
158
- end
159
-
160
- def table_13
161
- HypsometricalGeopotential.new.to_h
162
- end
163
-
164
- def table_5_yaml
165
- GroupOneMeters.new.to_yaml
166
- end
167
-
168
- def table_6_yaml
169
- GroupTwoMeters.new.to_yaml
170
- end
171
-
172
- def table_7_yaml
173
- GroupThreeMeters.new.to_yaml
174
- end
175
-
176
- def table_8_yaml
177
- GroupOneFeet.new.to_yaml
178
- end
179
-
180
- def table_9_yaml
181
- GroupTwoFeet.new.to_yaml
182
- end
183
-
184
- def table_10_yaml
185
- GroupThreeFeet.new.to_yaml
186
- end
187
-
188
- def table_11_yaml
189
- HypsometricalMbar.new.to_yaml
190
- end
191
-
192
- def table_12_yaml
193
- HypsometricalGeometric.new.to_yaml
194
- end
195
-
196
- def table_13_yaml
197
- HypsometricalGeopotential.new.to_yaml
198
- end
199
-
200
- end
201
-
202
- end
203
-
204
- end
205
- end