Sha256: d1e294eaf63f6e14ec3866647248a62b172297d60bae06eb8230d1bfe54b6032
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
AutomobileActivityYearType.class_eval do data_miner do process "Start from scratch" do delete_all end import "annual automobile air conditioning emissions derived from the 2010 EPA GHG Inventory", :url => "file://#{Earth::DATA_DIR}/automobile/hfc_emissions.csv" do key 'name' store 'activity_year' store 'type_name' store 'hfc_emissions', :from_units => :teragrams_co2e, :to_units => :kilograms_co2e end process "Ensure AutomobileActivityYearTypeFuel is populated" do AutomobileActivityYearTypeFuel.run_data_miner! end process "Derive hfc emission factor from AutomobileActivityYearTypeFuel" do safe_find_each do |ayt| ayt.update_attributes!( :hfc_emission_factor => ayt.hfc_emissions / ayt.activity_year_type_fuels.sum(:distance), :hfc_emission_factor_units => ayt.hfc_emissions_units + '_per_' + ayt.activity_year_type_fuels.first.distance_units.singularize ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
earth-0.12.4 | lib/earth/automobile/automobile_activity_year_type/data_miner.rb |