Sha256: a5f86355c82f4b6e1e906a6cbf0b889a8cca503020dd663144b4932f5a48b3c4
Contents?: true
Size: 1.31 KB
Versions: 6
Compression:
Stored size: 1.31 KB
Contents
EgridRegion.class_eval do data_miner do import "eGRID 2010 regions and loss factors", :url => 'http://www.epa.gov/cleanenergy/documents/egridzips/eGRID2010V1_1_STIE_USGC.xls', :sheet => 'STIE07', :skip => 4, :select => lambda { |row| row['eGRID2010 year 2007 file state sequence number'].to_i.between?(1, 51) } do key 'name', :field_name => 'Grid region (E=Eastern grid, W=Western grid, AK=Alaska, HI=Hawaii, TX=Texas)' store 'country_name', :static => 'US' store 'loss_factor', :field_name => 'Year 2007 grid gross loss factor' end # DEPRECATED but don't remove until confirmed that all emitters use EgridRegion.fallback rather than EgridRegion.find_by_abbreviation 'US' # (ElectricityUse and Meeting) process "Ensure EgridCountry is populated" do EgridCountry.run_data_miner! end # DEPRECATED but don't remove until confirmed that all emitters use EgridRegion.fallback rather than EgridRegion.find_by_abbreviation 'US' # (ElectricityUse and Meeting) process "Calculate national averages" do us_average = find_or_create_by_name 'US' us_average.loss_factor = (EgridCountry.us.generation + EgridCountry.us.imports - EgridCountry.us.consumption) / EgridCountry.us.generation us_average.save! end end end
Version data entries
6 entries across 6 versions & 1 rubygems