class NoaaDegreeDayParser
Public Class Methods
new(options = {})
click to toggle source
# File lib/earth/locality/climate_division_month/data_miner.rb, line 92 def initialize(options = {}) # nothing end
Public Instance Methods
apply(row)
click to toggle source
# File lib/earth/locality/climate_division_month/data_miner.rb, line 96 def apply(row) virtual_rows = [] if row['year'].to_i > 2010 %w{ jan feb mar apr may jun jul aug sep oct nov dec }.each do |month| if row[month].to_i >= 0 new_row = ActiveSupport::OrderedHash.new new_row['climate_division_name'] = STATE_CODES[row['state_code'].to_i] + row['division_number'].to_i.to_s new_row['year'] = row['year'] new_row['month'] = MONTH_CODES[month] new_row['name'] = new_row['climate_division_name'] + '-' + new_row['year'] + '-' + new_row['month'].to_s new_row['degree_days'] = row[month] virtual_rows << new_row end end end virtual_rows end