Sha256: b5fd41719c74d682ebafc1a6f3ccca8a161872092d324fb2d7c765725da34cac

Contents?: true

Size: 1.89 KB

Versions: 24

Compression:

Stored size: 1.89 KB

Contents

FuelType.class_eval do
  # FIXME TODO phase 2
  # annual emissions factors
  # annual energy contents
  # gas-specific emissions factors

  data_miner do
    schema :options => Earth.database_options do
      string 'name'
      float  'emission_factor'
      string 'emission_factor_units'
      float  'average_purchase_volume'
      string 'average_purchase_volume_units'
      # float    'energy_content'
      # string   'energy_content_units'
      # float    'carbon_content'
      # string   'carbon_content_units'
    end
    
    # process "Define some necessary conversions" do
    #   Conversions.register :teragrams_per_quadrillion_british_thermal_units, :kilograms_per_joule,         0.000000000947817123
    #   Conversions.register :million_british_thermal_units_per_short_ton,     :joules_per_kilogram,         1.16300000
    #   Conversions.register :million_british_thermal_units_per_cubic_foot,    :joules_per_cubic_metre, 37_258.9457
    #   Conversions.register :million_british_thermal_units_per_barrel,        :joules_per_litre,            6.63610165
    #   Conversions.register :carbon,                                          :carbon_dioxide,              3.66666667
    # end
    
    import "a list of fuels and their emissions factors",
           :url => 'http://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdDR3RjlTcWlsLTc2TzQ0cERTMElJbHc' do
      key 'name', :field_name => 'fuel'
      store 'emission_factor', :units_field_name => 'emission_factor_units'
      store 'average_purchase_volume', :units_field_name => 'average_purchase_volume_units'
      # store 'energy_content', :field_name => 'energy_content', :units_field_name => 'energy_content_units', :to_units => 'FIXME' # FIXME need different conversions for different rows...
      # store 'carbon_content', :field_name => 'carbon_content', :units_field_name => 'carbon_content_units', :to_units => :kilograms_per_joule
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
earth-0.0.42 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.41 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.40 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.39 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.38 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.37 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.36 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.35 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.34 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.33 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.32 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.31 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.30 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.29 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.28 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.27 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.26 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.24 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.23 lib/earth/fuel/fuel_type/data_miner.rb
earth-0.0.22 lib/earth/fuel/fuel_type/data_miner.rb