Sha256: c1a2b610398708493c5b80e72b480083e6048babc01641dc7353cd9c3324364a

Contents?: true

Size: 746 Bytes

Versions: 4

Compression:

Stored size: 746 Bytes

Contents

require 'earth/eia'

MecsRatio.class_eval do
  data_miner do
    MecsRatio::CENSUS_REGIONS.each do |region, data|
      import( "MECS table 6.1 #{region}",
        :url => "http://205.254.135.24/emeu/mecs/mecs2006/excel/Table6_1.xls",
        :crop => data[:crop]) do
        key 'name', :synthesize => Proc.new { |row| "#{Industry.format_naics_code(row[0])}-#{data[:code]}" }
        store 'naics_code', :synthesize => Proc.new { |row| Industry.format_naics_code row[0] }
        store 'consumption_per_dollar_of_shipments', :field_number => 4
        store 'census_region', :static => data[:code]
      end
    end

    process :normalize_fuels do
      Earth::EIA.normalize(MecsRatio, [:consumption_per_dollar_of_shipments])
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
earth-0.11.7 lib/earth/industry/mecs_ratio/data_miner.rb
earth-0.11.6 lib/earth/industry/mecs_ratio/data_miner.rb
earth-0.11.5 lib/earth/industry/mecs_ratio/data_miner.rb
earth-0.11.4 lib/earth/industry/mecs_ratio/data_miner.rb