Class: Atmospheric::Export::Iso25331975::GroupBase
- Inherits:
-
Object
- Object
- Atmospheric::Export::Iso25331975::GroupBase
show all
- Includes:
- Target
- Defined in:
- lib/atmospheric/export/iso_25331975/group_base.rb
Instance Method Summary
collapse
Methods included from Target
#ft_to_m, #m_to_ft, #round_to_sig_figs, #to_file, #to_yaml
Instance Method Details
#height_hash(hgmm, hgmf, hgpm, hgpf) ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/atmospheric/export/iso_25331975/group_base.rb', line 25
def height_hash(hgmm, hgmf, hgpm, hgpf)
{
"geopotential-altitude-m" => hgmm.round,
"geopotential-altitude-ft" => hgmf.round,
"geometrical-altitude-m" => hgpm.round,
"geometrical-altitude-ft" => hgpf.round,
}
end
|
#row_big_h(h, unit: :meters) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/atmospheric/export/iso_25331975/group_base.rb', line 9
def row_big_h(h, unit: :meters)
hgpm, hgpf = values_in_m_ft(h, unit: unit)
hgmm = Isa.geometric_altitude_from_geopotential(hgpm)
hgmf = m_to_ft(hgmm).round
height_hash(hgmm, hgmf, hgpm, hgpf)
.merge(self.row_from_geopotential(hgpm))
end
|
#row_small_h(h, unit: :meters) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/atmospheric/export/iso_25331975/group_base.rb', line 17
def row_small_h(h, unit: :meters)
hgmm, hgmf = values_in_m_ft(h, unit: unit)
hgpm = Isa.geopotential_altitude_from_geometric(hgmm)
hgpf = m_to_ft(hgpm).round
height_hash(hgmm, hgmf, hgpm, hgpf)
.merge(self.row_from_geopotential(hgpm))
end
|
#steps ⇒ Object
Step 50 from -2k to 40k, step 100 above 32k, 200 above 51k to 80k
44
45
46
47
48
49
50
|
# File 'lib/atmospheric/export/iso_25331975/group_base.rb', line 44
def steps
(
(-2000..31999).step(50) +
(32000..50999).step(100) +
(51000..80000).step(200)
)
end
|
#steps_unit ⇒ Object
52
53
54
|
# File 'lib/atmospheric/export/iso_25331975/group_base.rb', line 52
def steps_unit
:meters
end
|
#to_h(unit: steps_unit) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/atmospheric/export/iso_25331975/group_base.rb', line 56
def to_h(unit: steps_unit)
d = {
"by-geometrical-altitude" => [],
"by-geopotential-altitude" => []
}
steps.each do |h|
d["by-geometrical-altitude"] << row_small_h(h, unit: unit)
d["by-geopotential-altitude"] << row_big_h(h, unit: unit)
end
d
end
|
#values_in_m_ft(value, unit: :meters) ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/atmospheric/export/iso_25331975/group_base.rb', line 34
def values_in_m_ft(value, unit: :meters)
case unit
when :meters
[value.to_f, m_to_ft(value)]
when :feet
[ft_to_m(value), value.to_f]
end
end
|