Sha256: 1b5afd707aa95522be75c0666d80bc89d4f27d166febb5c80043eb37e9855302

Contents?: true

Size: 1.31 KB

Versions: 5

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 => proc { |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

5 entries across 5 versions & 1 rubygems

Version Path
earth-0.12.0 lib/earth/locality/egrid_region/data_miner.rb
earth-0.11.20 lib/earth/locality/egrid_region/data_miner.rb
earth-0.11.19 lib/earth/locality/egrid_region/data_miner.rb
earth-0.11.18 lib/earth/locality/egrid_region/data_miner.rb
earth-0.11.17 lib/earth/locality/egrid_region/data_miner.rb