atmospheric 0.4.4 → 0.5.0
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.
- checksums.yaml +4 -4
- data/README.adoc +225 -135
- data/lib/atmospheric/export/altitude_attrs.rb +160 -99
- data/lib/atmospheric/export/altitude_convertable_model.rb +22 -22
- data/lib/atmospheric/export/hypsometrical_table.rb +1 -1
- data/lib/atmospheric/export/iso_25331975/group_one_attrs.rb +46 -30
- data/lib/atmospheric/export/iso_25331975/group_three_attrs.rb +45 -29
- data/lib/atmospheric/export/iso_25331975/group_two_attrs.rb +52 -33
- data/lib/atmospheric/export/iso_25331985/pressure_attrs.rb +2 -3
- data/lib/atmospheric/export/iso_25331985/table_five_six_attrs.rb +2 -3
- data/lib/atmospheric/export/iso_25332025/altitude_attrs_group.rb +1 -1
- data/lib/atmospheric/export/iso_25332025/combined_altitude_attrs_group.rb +1 -1
- data/lib/atmospheric/export/iso_25332025.rb +8 -8
- data/lib/atmospheric/export/pressure_attrs.rb +51 -53
- data/lib/atmospheric/export/utils.rb +3 -1
- data/lib/atmospheric/unit_value_float.rb +1 -1
- data/lib/atmospheric/unit_value_integer.rb +1 -1
- data/lib/atmospheric/version.rb +1 -1
- metadata +4 -4
|
@@ -10,221 +10,282 @@ module Atmospheric
|
|
|
10
10
|
include AltitudeConvertableModel
|
|
11
11
|
|
|
12
12
|
# From Group One
|
|
13
|
-
attribute :
|
|
14
|
-
attribute :
|
|
15
|
-
attribute :
|
|
16
|
-
attribute :
|
|
17
|
-
attribute :density, UnitValueFloat
|
|
18
|
-
attribute :acceleration, UnitValueFloat
|
|
13
|
+
attribute :temperatures, UnitValueFloat, collection: true
|
|
14
|
+
attribute :pressures, UnitValueFloat, collection: true
|
|
15
|
+
attribute :densities, UnitValueFloat, collection: true
|
|
16
|
+
attribute :accelerations, UnitValueFloat, collection: true
|
|
19
17
|
|
|
20
18
|
# From Group Two
|
|
21
|
-
attribute :
|
|
22
|
-
attribute :
|
|
23
|
-
attribute :
|
|
24
|
-
attribute :
|
|
25
|
-
attribute :
|
|
26
|
-
attribute :
|
|
27
|
-
attribute :
|
|
19
|
+
attribute :ppns, UnitValueFloat, collection: true
|
|
20
|
+
attribute :rhorhons, UnitValueFloat, collection: true
|
|
21
|
+
attribute :sqrt_rhorhons, UnitValueFloat, collection: true
|
|
22
|
+
attribute :speeds_of_sound, UnitValueFloat, collection: true
|
|
23
|
+
attribute :dynamic_viscosities, UnitValueFloat, collection: true
|
|
24
|
+
attribute :kinematic_viscosities, UnitValueFloat, collection: true
|
|
25
|
+
attribute :thermal_conductivities, UnitValueFloat, collection: true
|
|
28
26
|
|
|
29
27
|
# From Group Three
|
|
30
|
-
attribute :
|
|
31
|
-
attribute :
|
|
32
|
-
attribute :
|
|
33
|
-
attribute :
|
|
34
|
-
attribute :
|
|
35
|
-
attribute :
|
|
28
|
+
attribute :pressure_scale_heights, UnitValueFloat, collection: true
|
|
29
|
+
attribute :specific_weights, UnitValueFloat, collection: true
|
|
30
|
+
attribute :air_number_densities, UnitValueFloat, collection: true
|
|
31
|
+
attribute :mean_speeds, UnitValueFloat, collection: true
|
|
32
|
+
attribute :frequencies, UnitValueFloat, collection: true
|
|
33
|
+
attribute :mean_free_paths, UnitValueFloat, collection: true
|
|
34
|
+
attribute :precision, :string, values: %w[reduced normal high]
|
|
36
35
|
|
|
37
36
|
key_value do
|
|
38
|
-
map "geometric-altitude
|
|
39
|
-
map "
|
|
40
|
-
map "geopotential-altitude-m", to: :geopotential_altitude_m
|
|
41
|
-
map "geopotential-altitude-ft", to: :geopotential_altitude_ft
|
|
37
|
+
map "geometric-altitude", to: :geometric_altitudes
|
|
38
|
+
map "geopotential-altitude", to: :geopotential_altitudes
|
|
42
39
|
|
|
43
40
|
# From Group One
|
|
44
|
-
map "temperature
|
|
45
|
-
map "
|
|
46
|
-
map "
|
|
47
|
-
map "
|
|
48
|
-
map "density", to: :density
|
|
49
|
-
map "acceleration", to: :acceleration
|
|
41
|
+
map "temperature", to: :temperatures
|
|
42
|
+
map "pressure", to: :pressures
|
|
43
|
+
map "density", to: :densities
|
|
44
|
+
map "acceleration", to: :accelerations
|
|
50
45
|
|
|
51
46
|
# From Group Two
|
|
52
|
-
map "ppn", to: :
|
|
53
|
-
map "rhorhon", to: :
|
|
54
|
-
map "sqrt-rhorhon", to: :
|
|
55
|
-
map "speed-of-sound", to: :
|
|
56
|
-
map "dynamic-viscosity", to: :
|
|
57
|
-
map "kinematic-viscosity", to: :
|
|
58
|
-
map "thermal-conductivity", to: :
|
|
47
|
+
map "ppn", to: :ppns
|
|
48
|
+
map "rhorhon", to: :rhorhons
|
|
49
|
+
map "sqrt-rhorhon", to: :sqrt_rhorhons
|
|
50
|
+
map "speed-of-sound", to: :speeds_of_sound
|
|
51
|
+
map "dynamic-viscosity", to: :dynamic_viscosities
|
|
52
|
+
map "kinematic-viscosity", to: :kinematic_viscosities
|
|
53
|
+
map "thermal-conductivity", to: :thermal_conductivities
|
|
59
54
|
|
|
60
55
|
# From Group Three
|
|
61
|
-
map "pressure-scale-height", to: :
|
|
62
|
-
map "specific-weight", to: :
|
|
63
|
-
map "air-number-density", to: :
|
|
64
|
-
map "mean-speed", to: :
|
|
65
|
-
map "frequency", to: :
|
|
66
|
-
map "mean-free-path", to: :
|
|
56
|
+
map "pressure-scale-height", to: :pressure_scale_heights
|
|
57
|
+
map "specific-weight", to: :specific_weights
|
|
58
|
+
map "air-number-density", to: :air_number_densities
|
|
59
|
+
map "mean-speed", to: :mean_speeds
|
|
60
|
+
map "frequency", to: :frequencies
|
|
61
|
+
map "mean-free-path", to: :mean_free_paths
|
|
62
|
+
|
|
63
|
+
map "precision", to: :precision
|
|
67
64
|
end
|
|
68
65
|
|
|
69
66
|
xml do
|
|
70
|
-
|
|
71
|
-
map_element "geometric-altitude
|
|
72
|
-
map_element "
|
|
73
|
-
map_element "geopotential-altitude-m", to: :geopotential_altitude_m
|
|
74
|
-
map_element "geopotential-altitude-ft", to: :geopotential_altitude_ft
|
|
67
|
+
element "atmosphere-attributes"
|
|
68
|
+
map_element "geometric-altitude", to: :geometric_altitudes
|
|
69
|
+
map_element "geopotential-altitude", to: :geopotential_altitudes
|
|
75
70
|
|
|
76
71
|
# From Group One
|
|
77
|
-
map_element "temperature
|
|
78
|
-
map_element "
|
|
79
|
-
map_element "
|
|
80
|
-
map_element "
|
|
81
|
-
map_element "density", to: :density
|
|
82
|
-
map_element "acceleration", to: :acceleration
|
|
72
|
+
map_element "temperature", to: :temperatures
|
|
73
|
+
map_element "pressure", to: :pressures
|
|
74
|
+
map_element "density", to: :densities
|
|
75
|
+
map_element "acceleration", to: :accelerations
|
|
83
76
|
|
|
84
77
|
# From Group Two
|
|
85
|
-
map_element "ppn", to: :
|
|
86
|
-
map_element "rhorhon", to: :
|
|
87
|
-
map_element "sqrt-rhorhon", to: :
|
|
88
|
-
map_element "speed-of-sound", to: :
|
|
89
|
-
map_element "dynamic-viscosity", to: :
|
|
90
|
-
map_element "kinematic-viscosity", to: :
|
|
91
|
-
map_element "thermal-conductivity", to: :
|
|
78
|
+
map_element "ppn", to: :ppns
|
|
79
|
+
map_element "rhorhon", to: :rhorhons
|
|
80
|
+
map_element "sqrt-rhorhon", to: :sqrt_rhorhons
|
|
81
|
+
map_element "speed-of-sound", to: :speeds_of_sound
|
|
82
|
+
map_element "dynamic-viscosity", to: :dynamic_viscosities
|
|
83
|
+
map_element "kinematic-viscosity", to: :kinematic_viscosities
|
|
84
|
+
map_element "thermal-conductivity", to: :thermal_conductivities
|
|
92
85
|
|
|
93
86
|
# From Group Three
|
|
94
|
-
map_element "pressure-scale-height", to: :
|
|
95
|
-
map_element "specific-weight", to: :
|
|
96
|
-
map_element "air-number-density", to: :
|
|
97
|
-
map_element "mean-speed", to: :
|
|
98
|
-
map_element "frequency", to: :
|
|
99
|
-
map_element "mean-free-path", to: :
|
|
87
|
+
map_element "pressure-scale-height", to: :pressure_scale_heights
|
|
88
|
+
map_element "specific-weight", to: :specific_weights
|
|
89
|
+
map_element "air-number-density", to: :air_number_densities
|
|
90
|
+
map_element "mean-speed", to: :mean_speeds
|
|
91
|
+
map_element "frequency", to: :frequencies
|
|
92
|
+
map_element "mean-free-path", to: :mean_free_paths
|
|
93
|
+
|
|
94
|
+
map_element "precision", to: :precision
|
|
100
95
|
end
|
|
101
96
|
|
|
102
97
|
# In meters only
|
|
103
98
|
def realize_values_from_geopotential(gp_h_m, precision: :reduced)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
]
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
99
|
+
self.precision = precision.to_s
|
|
100
|
+
|
|
101
|
+
# Group One
|
|
102
|
+
self.temperatures = [
|
|
103
|
+
calculate(gp_h_m, :temperature_k, precision: precision),
|
|
104
|
+
calculate(gp_h_m, :temperature_c, precision: precision)
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
self.pressures = [
|
|
108
|
+
calculate(gp_h_m, :pressure_mbar, precision: precision),
|
|
109
|
+
calculate(gp_h_m, :pressure_mmhg, precision: precision)
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
self.densities = [
|
|
113
|
+
calculate(gp_h_m, :density, precision: precision)
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
self.accelerations = [
|
|
117
|
+
calculate(gp_h_m, :acceleration, precision: precision)
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
# Group Two
|
|
121
|
+
self.ppns = [
|
|
122
|
+
calculate(gp_h_m, :ppn, precision: precision)
|
|
123
|
+
]
|
|
124
|
+
|
|
125
|
+
self.rhorhons = [
|
|
126
|
+
calculate(gp_h_m, :rhorhon, precision: precision)
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
self.sqrt_rhorhons = [
|
|
130
|
+
calculate(gp_h_m, :sqrt_rhorhon, precision: precision)
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
self.speeds_of_sound = [
|
|
134
|
+
calculate(gp_h_m, :speed_of_sound, precision: precision)
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
self.dynamic_viscosities = [
|
|
138
|
+
calculate(gp_h_m, :dynamic_viscosity, precision: precision)
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
self.kinematic_viscosities = [
|
|
142
|
+
calculate(gp_h_m, :kinematic_viscosity, precision: precision)
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
self.thermal_conductivities = [
|
|
146
|
+
calculate(gp_h_m, :thermal_conductivity, precision: precision)
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
# Group Three
|
|
150
|
+
self.pressure_scale_heights = [
|
|
151
|
+
calculate(gp_h_m, :pressure_scale_height, precision: precision)
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
self.specific_weights = [
|
|
155
|
+
calculate(gp_h_m, :specific_weight, precision: precision)
|
|
156
|
+
]
|
|
157
|
+
|
|
158
|
+
self.air_number_densities = [
|
|
159
|
+
calculate(gp_h_m, :air_number_density, precision: precision)
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
self.mean_speeds = [
|
|
163
|
+
calculate(gp_h_m, :mean_speed, precision: precision)
|
|
164
|
+
]
|
|
165
|
+
|
|
166
|
+
self.frequencies = [
|
|
167
|
+
calculate(gp_h_m, :frequency, precision: precision)
|
|
168
|
+
]
|
|
169
|
+
|
|
170
|
+
self.mean_free_paths = [
|
|
171
|
+
calculate(gp_h_m, :mean_free_path, precision: precision)
|
|
172
|
+
]
|
|
114
173
|
end
|
|
115
174
|
|
|
116
175
|
def calculate(gp_h_m, name, precision: :reduced)
|
|
176
|
+
isa = precision == :high ? Isa::HighPrecision.instance : Isa::NormalPrecision.instance
|
|
177
|
+
|
|
117
178
|
case name
|
|
118
179
|
when :temperature_k
|
|
119
|
-
v =
|
|
180
|
+
v = isa.temperature_at_layer_from_geopotential(gp_h_m)
|
|
120
181
|
UnitValueFloat.new(
|
|
121
|
-
value: precision == :reduced ? (v
|
|
182
|
+
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
122
183
|
unitsml: "K"
|
|
123
184
|
)
|
|
124
185
|
when :temperature_c
|
|
125
|
-
v =
|
|
186
|
+
v = isa.temperature_at_layer_celcius(gp_h_m)
|
|
126
187
|
UnitValueFloat.new(
|
|
127
|
-
value: precision == :reduced ? (v
|
|
188
|
+
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
128
189
|
unitsml: "degC"
|
|
129
190
|
)
|
|
130
191
|
when :pressure_mbar
|
|
131
|
-
v =
|
|
192
|
+
v = isa.pressure_from_geopotential_mbar(gp_h_m)
|
|
132
193
|
UnitValueFloat.new(
|
|
133
194
|
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
134
195
|
unitsml: "mbar"
|
|
135
196
|
)
|
|
136
197
|
when :pressure_mmhg
|
|
137
|
-
v =
|
|
198
|
+
v = isa.pressure_from_geopotential_mmhg(gp_h_m)
|
|
138
199
|
UnitValueFloat.new(
|
|
139
200
|
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
140
|
-
unitsml: "
|
|
201
|
+
unitsml: "mm_Hg"
|
|
141
202
|
)
|
|
142
203
|
when :density
|
|
143
|
-
v =
|
|
204
|
+
v = isa.density_from_geopotential(gp_h_m)
|
|
144
205
|
UnitValueFloat.new(
|
|
145
206
|
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
146
207
|
unitsml: "kg*m^-3"
|
|
147
208
|
)
|
|
148
209
|
when :acceleration
|
|
149
|
-
v =
|
|
210
|
+
v = isa.gravity_at_geopotential(gp_h_m)
|
|
150
211
|
UnitValueFloat.new(
|
|
151
212
|
value: precision == :reduced ? v.round(4) : v,
|
|
152
213
|
unitsml: "m*s^-2"
|
|
153
214
|
)
|
|
154
215
|
when :ppn
|
|
155
|
-
v =
|
|
216
|
+
v = isa.p_p_n_from_geopotential(gp_h_m)
|
|
156
217
|
UnitValueFloat.new(
|
|
157
218
|
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
158
219
|
unitsml: nil
|
|
159
220
|
)
|
|
160
221
|
when :rhorhon
|
|
161
|
-
v =
|
|
222
|
+
v = isa.rho_rho_n_from_geopotential(gp_h_m)
|
|
162
223
|
UnitValueFloat.new(
|
|
163
224
|
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
164
225
|
unitsml: nil
|
|
165
226
|
)
|
|
166
227
|
when :sqrt_rhorhon
|
|
167
|
-
v =
|
|
228
|
+
v = isa.root_rho_rho_n_from_geopotential(gp_h_m)
|
|
168
229
|
UnitValueFloat.new(
|
|
169
230
|
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
170
231
|
unitsml: nil
|
|
171
232
|
)
|
|
172
233
|
when :speed_of_sound
|
|
173
|
-
v =
|
|
234
|
+
v = isa.speed_of_sound_from_geopotential(gp_h_m)
|
|
174
235
|
UnitValueFloat.new(
|
|
175
|
-
value: precision == :reduced ? (v
|
|
236
|
+
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
176
237
|
unitsml: "m*s^-1"
|
|
177
238
|
)
|
|
178
239
|
when :dynamic_viscosity
|
|
179
|
-
v =
|
|
240
|
+
v = isa.dynamic_viscosity_from_geopotential(gp_h_m)
|
|
180
241
|
UnitValueFloat.new(
|
|
181
242
|
value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
|
|
182
243
|
unitsml: "Pa*s"
|
|
183
244
|
)
|
|
184
245
|
when :kinematic_viscosity
|
|
185
|
-
v =
|
|
246
|
+
v = isa.kinematic_viscosity_from_geopotential(gp_h_m)
|
|
186
247
|
UnitValueFloat.new(
|
|
187
248
|
value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
|
|
188
249
|
unitsml: "m^2*s^-1"
|
|
189
250
|
)
|
|
190
251
|
when :thermal_conductivity
|
|
191
|
-
v =
|
|
252
|
+
v = isa.thermal_conductivity_from_geopotential(gp_h_m)
|
|
192
253
|
UnitValueFloat.new(
|
|
193
254
|
value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
|
|
194
255
|
unitsml: "W*m^-1*K^-1"
|
|
195
256
|
)
|
|
196
257
|
when :pressure_scale_height
|
|
197
|
-
v =
|
|
258
|
+
v = isa.pressure_scale_height_from_geopotential(gp_h_m)
|
|
198
259
|
UnitValueFloat.new(
|
|
199
260
|
value: precision == :reduced ? v.round(1) : v,
|
|
200
261
|
unitsml: "m"
|
|
201
262
|
)
|
|
202
263
|
when :specific_weight
|
|
203
|
-
v =
|
|
264
|
+
v = isa.specific_weight_from_geopotential(gp_h_m)
|
|
204
265
|
UnitValueFloat.new(
|
|
205
266
|
value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
|
|
206
267
|
unitsml: "N*m^-3"
|
|
207
268
|
)
|
|
208
269
|
when :air_number_density
|
|
209
|
-
v =
|
|
270
|
+
v = isa.air_number_density_from_geopotential(gp_h_m)
|
|
210
271
|
UnitValueFloat.new(
|
|
211
272
|
value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
|
|
212
273
|
unitsml: "m^-3"
|
|
213
274
|
)
|
|
214
275
|
when :mean_speed
|
|
215
|
-
v =
|
|
276
|
+
v = isa.mean_air_particle_speed_from_geopotential(gp_h_m)
|
|
216
277
|
UnitValueFloat.new(
|
|
217
278
|
value: precision == :reduced ? v.round(2) : v,
|
|
218
279
|
unitsml: "m*s^-1"
|
|
219
280
|
)
|
|
220
281
|
when :frequency
|
|
221
|
-
v =
|
|
282
|
+
v = isa.air_particle_collision_frequency_from_geopotential(gp_h_m)
|
|
222
283
|
UnitValueFloat.new(
|
|
223
284
|
value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
|
|
224
285
|
unitsml: "s^-1"
|
|
225
286
|
)
|
|
226
287
|
when :mean_free_path
|
|
227
|
-
v =
|
|
288
|
+
v = isa.mean_free_path_of_air_particles_from_geopotential(gp_h_m)
|
|
228
289
|
UnitValueFloat.new(
|
|
229
290
|
value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
|
|
230
291
|
unitsml: "m"
|
|
@@ -11,10 +11,8 @@ module Atmospheric
|
|
|
11
11
|
|
|
12
12
|
def self.included(base)
|
|
13
13
|
base.class_eval do
|
|
14
|
-
attribute :
|
|
15
|
-
attribute :
|
|
16
|
-
attribute :geopotential_altitude_m, UnitValueInteger
|
|
17
|
-
attribute :geopotential_altitude_ft, UnitValueInteger
|
|
14
|
+
attribute :geometric_altitudes, UnitValueInteger, collection: true
|
|
15
|
+
attribute :geopotential_altitudes, UnitValueInteger, collection: true
|
|
18
16
|
end
|
|
19
17
|
end
|
|
20
18
|
|
|
@@ -54,25 +52,27 @@ module Atmospheric
|
|
|
54
52
|
end
|
|
55
53
|
|
|
56
54
|
def realize_altitudes(hgmm, hgmf, hgpm, hgpf, precision: :reduced)
|
|
57
|
-
self.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
self.geometric_altitudes = [
|
|
56
|
+
UnitValueInteger.new(
|
|
57
|
+
value: precision == :reduced ? hgmm.round : hgmm,
|
|
58
|
+
unitsml: "m"
|
|
59
|
+
),
|
|
60
|
+
UnitValueInteger.new(
|
|
61
|
+
value: precision == :reduced ? hgmf.round : hgmf,
|
|
62
|
+
unitsml: "ft"
|
|
63
|
+
)
|
|
64
|
+
]
|
|
61
65
|
|
|
62
|
-
self.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
self.geopotential_altitude_ft = UnitValueInteger.new(
|
|
73
|
-
value: precision == :reduced ? hgpf.round : hgpf,
|
|
74
|
-
unitsml: "ft"
|
|
75
|
-
)
|
|
66
|
+
self.geopotential_altitudes = [
|
|
67
|
+
UnitValueInteger.new(
|
|
68
|
+
value: precision == :reduced ? hgpm.round : hgpm,
|
|
69
|
+
unitsml: "m"
|
|
70
|
+
),
|
|
71
|
+
UnitValueInteger.new(
|
|
72
|
+
value: precision == :reduced ? hgpf.round : hgpf,
|
|
73
|
+
unitsml: "ft"
|
|
74
|
+
)
|
|
75
|
+
]
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def realize_values_from_geopotential(gp_h_m, precision:)
|
|
@@ -9,71 +9,87 @@ module Atmospheric
|
|
|
9
9
|
class GroupOneAttrs < Lutaml::Model::Serializable
|
|
10
10
|
include AltitudeConvertableModel
|
|
11
11
|
|
|
12
|
-
attribute :
|
|
13
|
-
attribute :
|
|
14
|
-
attribute :
|
|
15
|
-
attribute :
|
|
16
|
-
attribute :density, UnitValueFloat
|
|
17
|
-
attribute :acceleration, UnitValueFloat
|
|
12
|
+
attribute :temperatures, UnitValueInteger, collection: true
|
|
13
|
+
attribute :pressures, UnitValueFloat, collection: true
|
|
14
|
+
attribute :densities, UnitValueFloat, collection: true
|
|
15
|
+
attribute :accelerations, UnitValueFloat, collection: true
|
|
18
16
|
|
|
19
17
|
key_value do
|
|
20
|
-
map "geometric-altitude
|
|
21
|
-
map "
|
|
22
|
-
map "
|
|
23
|
-
map "
|
|
24
|
-
map "
|
|
25
|
-
map "
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
map "geometric-altitude", to: :geometric_altitudes
|
|
19
|
+
map "geopotential-altitude", to: :geopotential_altitudes
|
|
20
|
+
map "temperature", to: :temperatures
|
|
21
|
+
map "pressure", to: :pressures
|
|
22
|
+
map "density", to: :densities
|
|
23
|
+
map "acceleration", to: :accelerations
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
xml do
|
|
27
|
+
element "group-one-attrs"
|
|
28
|
+
map_element "geometric-altitude", to: :geometric_altitudes
|
|
29
|
+
map_element "geopotential-altitude", to: :geopotential_altitudes
|
|
30
|
+
map_element "temperature", to: :temperatures
|
|
31
|
+
map_element "pressure", to: :pressures
|
|
32
|
+
map_element "density", to: :densities
|
|
33
|
+
map_element "acceleration", to: :accelerations
|
|
30
34
|
end
|
|
31
35
|
|
|
32
36
|
# In meters only
|
|
33
37
|
def realize_values_from_geopotential(gp_h_m, precision: :reduced)
|
|
34
|
-
|
|
35
|
-
temperature_k
|
|
36
|
-
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
self.temperatures = [
|
|
39
|
+
calculate(gp_h_m, :temperature_k, precision: precision),
|
|
40
|
+
calculate(gp_h_m, :temperature_c, precision: precision)
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
self.pressures = [
|
|
44
|
+
calculate(gp_h_m, :pressure_mbar, precision: precision),
|
|
45
|
+
calculate(gp_h_m, :pressure_mmhg, precision: precision)
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
self.densities = [
|
|
49
|
+
calculate(gp_h_m, :density, precision: precision)
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
self.accelerations = [
|
|
53
|
+
calculate(gp_h_m, :acceleration, precision: precision)
|
|
54
|
+
]
|
|
41
55
|
end
|
|
42
56
|
|
|
43
57
|
def calculate(gp_h_m, name, precision: :reduced)
|
|
58
|
+
isa = precision == :high ? Isa::HighPrecision.instance : Isa::NormalPrecision.instance
|
|
59
|
+
|
|
44
60
|
case name
|
|
45
61
|
when :temperature_k
|
|
46
|
-
v =
|
|
62
|
+
v = isa.temperature_at_layer_from_geopotential(gp_h_m)
|
|
47
63
|
UnitValueInteger.new(
|
|
48
64
|
value: precision == :reduced ? (v * 1000.0).round : v,
|
|
49
65
|
unitsml: "K"
|
|
50
66
|
)
|
|
51
67
|
when :temperature_c
|
|
52
|
-
v =
|
|
68
|
+
v = isa.temperature_at_layer_celcius(gp_h_m)
|
|
53
69
|
UnitValueInteger.new(
|
|
54
70
|
value: precision == :reduced ? (v * 1000.0).round : v,
|
|
55
71
|
unitsml: "degC"
|
|
56
72
|
)
|
|
57
73
|
when :pressure_mbar
|
|
58
|
-
v =
|
|
74
|
+
v = isa.pressure_from_geopotential_mbar(gp_h_m)
|
|
59
75
|
UnitValueFloat.new(
|
|
60
76
|
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
61
77
|
unitsml: "mbar"
|
|
62
78
|
)
|
|
63
79
|
when :pressure_mmhg
|
|
64
|
-
v =
|
|
80
|
+
v = isa.pressure_from_geopotential_mmhg(gp_h_m)
|
|
65
81
|
UnitValueFloat.new(
|
|
66
82
|
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
67
|
-
unitsml: "
|
|
83
|
+
unitsml: "mm_Hg"
|
|
68
84
|
)
|
|
69
85
|
when :density
|
|
70
|
-
v =
|
|
86
|
+
v = isa.density_from_geopotential(gp_h_m)
|
|
71
87
|
UnitValueFloat.new(
|
|
72
88
|
value: precision == :reduced ? round_to_sig_figs(v, 6) : v,
|
|
73
89
|
unitsml: "kg*m^-3"
|
|
74
90
|
)
|
|
75
91
|
when :acceleration
|
|
76
|
-
v =
|
|
92
|
+
v = isa.gravity_at_geopotential(gp_h_m)
|
|
77
93
|
UnitValueFloat.new(
|
|
78
94
|
value: precision == :reduced ? v.round(4) : v,
|
|
79
95
|
unitsml: "m*s^-2"
|