Sha256: ce763c54bfdbdd38fb40dcf87a6a62ce5cfe51571b9cce501ef3f7ca8453f4cc
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
require 'earth/eia' require 'earth/locality/data_miner' MecsRatio.class_eval do const_set(:CENSUS_REGIONS, { 'Total US' => { :crop => (16..95), :code => nil }, 'Northeast' => { :crop => (100..179), :code => 1 }, 'Midwest' => { :crop => (184..263), :code => 2 }, 'South' => { :crop => (268..347), :code => 3 }, 'West' => { :crop => (352..431), :code => 4 } }) 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], :headers => ["NAICS Code", "Subsector and Industry", "Consumption per Employee", "Consumption per Dollar of Value Added", "Consumption per Dollar of Value of Shipments"]) do key :name, :synthesize => proc { |row| "#{Industry.format_naics_code(row["NAICS Code"])}-#{data[:code]}" } store :census_region_number, :static => data[:code] store :naics_code, :synthesize => proc { |row| Industry.format_naics_code row["NAICS Code"] } store :energy_per_dollar_of_shipments, :units => :megajoules, :synthesize => proc { |row| Earth::EIA.convert_value(row['Consumption per Dollar of Value of Shipments'], :from => :kbtus, :to => :megajoules) } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
earth-0.11.20 | lib/earth/industry/mecs_ratio/data_miner.rb |
earth-0.11.19 | lib/earth/industry/mecs_ratio/data_miner.rb |
earth-0.11.18 | lib/earth/industry/mecs_ratio/data_miner.rb |