atmospheric 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +269 -12
- data/lib/atmospheric/export/hypsometrical_tables.rb +6 -111
- data/lib/atmospheric/export/iso_25331975/group_one.rb +1 -1
- data/lib/atmospheric/export/iso_25331985.rb +136 -0
- data/lib/atmospheric/export/iso_25331997.rb +3 -2
- data/lib/atmospheric/export/iso_25332024.rb +201 -0
- data/lib/atmospheric/export.rb +2 -1
- data/lib/atmospheric/version.rb +1 -1
- data/spec/fixtures/iso-2533-1975-table5.yaml +4064 -4064
- metadata +4 -2
@@ -0,0 +1,201 @@
|
|
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
|
+
{
|
85
|
+
"pressure-#{unit}" => p,
|
86
|
+
"geopotential-altitude-m" => gp_h_m.round(1),
|
87
|
+
"geopotential-altitude-ft" => gp_h_ft.round,
|
88
|
+
}
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class HypsometricalGeometric < HypsometricalTables::TableBase
|
93
|
+
def steps
|
94
|
+
(-1000..4599).step(1)
|
95
|
+
end
|
96
|
+
|
97
|
+
def row(hgmm, unit:)
|
98
|
+
hgpm = Isa.geopotential_altitude_from_geometric(hgmm)
|
99
|
+
{
|
100
|
+
"geometric-altitude-m" => hgpm,
|
101
|
+
"pressure-mbar" => round_to_sig_figs(Isa.pressure_from_geopotential_mbar(hgpm.to_f), 6),
|
102
|
+
# "pressure-mmhg" => round_to_sig_figs(Isa.pressure_from_geopotential_mmhg(hgpm.to_f), 6),
|
103
|
+
}
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
class HypsometricalGeopotential < HypsometricalTables::TableBase
|
108
|
+
def steps
|
109
|
+
(-1000..4599).step(1)
|
110
|
+
end
|
111
|
+
|
112
|
+
def row(hgpm, unit:)
|
113
|
+
{
|
114
|
+
"geopotential-altitude-m" => hgpm,
|
115
|
+
"pressure-mbar" => round_to_sig_figs(Isa.pressure_from_geopotential_mbar(hgpm.to_f), 6),
|
116
|
+
# "pressure-mmhg" => round_to_sig_figs(Isa.pressure_from_geopotential_mmhg(hgpm.to_f), 6),
|
117
|
+
}
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
class << self
|
124
|
+
def table_5
|
125
|
+
GroupOneMeters.new.to_h
|
126
|
+
end
|
127
|
+
|
128
|
+
def table_6
|
129
|
+
GroupTwoMeters.new.to_h
|
130
|
+
end
|
131
|
+
|
132
|
+
def table_7
|
133
|
+
GroupThreeMeters.new.to_h
|
134
|
+
end
|
135
|
+
|
136
|
+
def table_8
|
137
|
+
GroupOneFeet.new.to_h
|
138
|
+
end
|
139
|
+
|
140
|
+
def table_9
|
141
|
+
GroupTwoFeet.new.to_h
|
142
|
+
end
|
143
|
+
|
144
|
+
def table_10
|
145
|
+
GroupThreeFeet.new.to_h
|
146
|
+
end
|
147
|
+
|
148
|
+
def table_11
|
149
|
+
HypsometricalMbar.new.to_h
|
150
|
+
end
|
151
|
+
|
152
|
+
def table_12
|
153
|
+
HypsometricalGeometric.new.to_h
|
154
|
+
end
|
155
|
+
|
156
|
+
def table_13
|
157
|
+
HypsometricalGeopotential.new.to_h
|
158
|
+
end
|
159
|
+
|
160
|
+
def table_5_yaml
|
161
|
+
GroupOneMeters.new.to_yaml
|
162
|
+
end
|
163
|
+
|
164
|
+
def table_6_yaml
|
165
|
+
GroupTwoMeters.new.to_yaml
|
166
|
+
end
|
167
|
+
|
168
|
+
def table_7_yaml
|
169
|
+
GroupThreeMeters.new.to_yaml
|
170
|
+
end
|
171
|
+
|
172
|
+
def table_8_yaml
|
173
|
+
GroupOneFeet.new.to_yaml
|
174
|
+
end
|
175
|
+
|
176
|
+
def table_9_yaml
|
177
|
+
GroupTwoFeet.new.to_yaml
|
178
|
+
end
|
179
|
+
|
180
|
+
def table_10_yaml
|
181
|
+
GroupThreeFeet.new.to_yaml
|
182
|
+
end
|
183
|
+
|
184
|
+
def table_11_yaml
|
185
|
+
HypsometricalMbar.new.to_yaml
|
186
|
+
end
|
187
|
+
|
188
|
+
def table_12_yaml
|
189
|
+
HypsometricalGeometric.new.to_yaml
|
190
|
+
end
|
191
|
+
|
192
|
+
def table_13_yaml
|
193
|
+
HypsometricalGeopotential.new.to_yaml
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
201
|
+
end
|
data/lib/atmospheric/export.rb
CHANGED
data/lib/atmospheric/version.rb
CHANGED