Sha256: 45d0474f1fda893c55ee8bfce13887e6911382f4a90cb5dab8872e7829708ec0

Contents?: true

Size: 1.64 KB

Versions: 4

Compression:

Stored size: 1.64 KB

Contents

require 'earth/fuel'
class CensusDivision < ActiveRecord::Base
  self.primary_key = "number"
  
  belongs_to :census_region, :foreign_key => 'census_region_number'
  has_many :states, :foreign_key => 'census_division_number'
  has_many :zip_codes, :through => :states
  has_many :climate_divisions, :through => :states
  has_many :residential_energy_consumption_survey_responses, :foreign_key => 'census_division_number'
  
  # https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdFJ3U3VaSG1oQW1yclY3M3FsRzRDNFE&hl=en&output=html
  falls_back_on :name => 'fallback',
                :meeting_building_natural_gas_intensity => 0.0004353615 * 100.cubic_feet.to(:cubic_metres) / 1.square_feet.to(:square_metres),
                :meeting_building_fuel_oil_intensity => 0.0000925593.gallons.to(:litres) / 1.square_feet.to(:square_metres),
                :meeting_building_electricity_intensity => 0.0084323684 / 1.square_feet.to(:square_metres),
                :meeting_building_district_heat_intensity => 0.0004776370.kbtus.to(:megajoules) / 1.square_feet.to(:square_metres)
  
  col :number, :type => :integer
  col :name
  col :census_region_name
  col :census_region_number, :type => :integer
  col :meeting_building_natural_gas_intensity, :type => :float
  col :meeting_building_natural_gas_intensity_units
  col :meeting_building_fuel_oil_intensity, :type => :float
  col :meeting_building_fuel_oil_intensity_units
  col :meeting_building_electricity_intensity, :type => :float
  col :meeting_building_electricity_intensity_units
  col :meeting_building_district_heat_intensity, :type => :float
  col :meeting_building_district_heat_intensity_units

  warn_unless_size 9
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
earth-0.12.4 lib/earth/locality/census_division.rb
earth-0.12.3 lib/earth/locality/census_division.rb
earth-0.12.2 lib/earth/locality/census_division.rb
earth-0.12.1 lib/earth/locality/census_division.rb