Class: KNMI::Calculations
- Inherits:
-
Object
- Object
- KNMI::Calculations
- Defined in:
- lib/knmi/calculations.rb
Class Method Summary collapse
-
.convert_daily(array) ⇒ Array<Hash>
Converts Daily KNMI.get_data().data from storage to operable units.
-
.convert_hourly(array) ⇒ Array<Hash>
Converts Hourly KNMI.get_data().data from storage to operable units.
Class Method Details
.convert_daily(array) ⇒ Array<Hash>
Converts Daily KNMI.get_data().data from storage to operable units
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/knmi/calculations.rb', line 9 def convert_daily(array) x = [] array.each_with_index do |a, index| x[index] = {} x[index][:STN] = a[:STN] a.each_pair { |key,value| x[index].merge!( {key => converts_daily(key, value)} ) } end return x end |
.convert_hourly(array) ⇒ Array<Hash>
Converts Hourly KNMI.get_data().data from storage to operable units
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/knmi/calculations.rb', line 26 def convert_hourly(array) x = [] array.each_with_index do |a, index| x[index] = {} x[index][:STN] = a[:STN] a.each_pair { |key,value| x[index].merge!( {key => converts_daily(key, value)} ) } x[index][:Time] = x[index][:YYYYMMDD] + x[index][:HH] end return x end |