Sha256: 864092feb4ca64cb723f2ff2756d101f12ea4cb77d78dc463b0168807ddf53cd

Contents?: true

Size: 1.27 KB

Versions: 28

Compression:

Stored size: 1.27 KB

Contents

class AirConditionerUse < ActiveRecord::Base
  set_primary_key :name
  
  has_many :residences
  has_many :residential_energy_consumption_survey_responses

  falls_back_on :fugitive_emission => 0.102295.pounds_per_square_foot.to(:kilograms_per_square_metre), # https://brighterplanet.sifterapp.com/projects/30/issues/430
                :fugitive_emission_units => 'kilograms_per_square_metre'
  
  data_miner do
    schema do
      string 'name'
      float 'fugitive_emission'
      string 'fugitive_emission_units'
    end

    process "derive from ResidentialEnergyConsumptionSurveyResponse" do
      ResidentialEnergyConsumptionSurveyResponse.run_data_miner!
      connection.execute %{
        INSERT IGNORE INTO air_conditioner_uses(name)
        SELECT DISTINCT residential_energy_consumption_survey_responses.central_ac_use FROM residential_energy_consumption_survey_responses WHERE LENGTH(residential_energy_consumption_survey_responses.central_ac_use) > 0
      }
    end
    
    import "Ian's precalculated fugitive emissions values", :url => 'http://spreadsheets.google.com/pub?key=ri_380yQZAqBKeqie_TECgg' do
      key 'name', :field_name => 'air_conditioner_use_name'
      store 'fugitive_emission', :units_field_name => 'unit', :to_units => :kilograms_per_square_metre
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
earth-0.1.2 lib/earth/residence/air_conditioner_use.rb
earth-0.1.1 lib/earth/residence/air_conditioner_use.rb
earth-0.1.0 lib/earth/residence/air_conditioner_use.rb
earth-0.0.43 lib/earth/residence/air_conditioner_use.rb
earth-0.0.42 lib/earth/residence/air_conditioner_use.rb
earth-0.0.41 lib/earth/residence/air_conditioner_use.rb
earth-0.0.40 lib/earth/residence/air_conditioner_use.rb
earth-0.0.39 lib/earth/residence/air_conditioner_use.rb
earth-0.0.38 lib/earth/residence/air_conditioner_use.rb
earth-0.0.37 lib/earth/residence/air_conditioner_use.rb
earth-0.0.36 lib/earth/residence/air_conditioner_use.rb
earth-0.0.35 lib/earth/residence/air_conditioner_use.rb
earth-0.0.34 lib/earth/residence/air_conditioner_use.rb
earth-0.0.33 lib/earth/residence/air_conditioner_use.rb
earth-0.0.32 lib/earth/residence/air_conditioner_use.rb
earth-0.0.31 lib/earth/residence/air_conditioner_use.rb
earth-0.0.30 lib/earth/residence/air_conditioner_use.rb
earth-0.0.29 lib/earth/residence/air_conditioner_use.rb
earth-0.0.28 lib/earth/residence/air_conditioner_use.rb
earth-0.0.27 lib/earth/residence/air_conditioner_use.rb