Class: Atmospheris::Export::Iso25332025::HypsometricalMbar

Inherits:
HypsometricalTable
  • Object
show all
Defined in:
lib/atmospheris/export/iso_25332025.rb

Instance Method Summary collapse

Methods inherited from HypsometricalTable

#initialize_attrs, #set_attrs

Instance Method Details

#stepsObject

TODO: when Ruby’s step does not create inaccurate floating point numbers This is a hack to solve a Ruby bug with floating point calcuations > (20.0..1770.9).step(0.1).to_a

...
1769.4,
1769.5,
1769.6000000000001, # <== we need to clean these
1769.7,
1769.8000000000002, # <== we need to clean these

The last ‘map` should be removed if this bug is fixed



50
51
52
53
54
55
# File 'lib/atmospheris/export/iso_25332025.rb', line 50

def steps
  (
    (5.0..19.99).step(0.01).to_a.map { |v| v.round(2) } +
    (20.0..1770.9).step(0.1).to_a.map { |v| v.round(1) }
  )
end

#steps_unitObject



57
58
59
# File 'lib/atmospheris/export/iso_25332025.rb', line 57

def steps_unit
  :mbar
end