Sha256: 77b3c23523960c052e9a6a994298d360a21e40f2165493a74a2e55195b1245c8

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

class AutomobileYear < ActiveRecord::Base
  self.primary_key = "year"
  
  # Estimate of % of vehicles currently in use that were manufactured in each year
  # Derived from 2012 EPA GHG inventory appendix tables A-91, A-92, and A-95
  # Used by AutomobileMakeModelYear and AutomobileMakeYear to get weighting so other classes can derive weighted fuel efficiency
  def self.weighting(year)
    {
      2012 => 0.0607,
      2011 => 0.0491,
      2010 => 0.0560,
      2009 => 0.0669,
      2008 => 0.0677,
      2007 => 0.0668,
      2006 => 0.0641,
      2005 => 0.0620,
      2004 => 0.0624,
      2003 => 0.0625,
      2002 => 0.0610,
      2001 => 0.0546,
      2000 => 0.0467,
      1999 => 0.0410,
      1998 => 0.0347,
      1997 => 0.0289,
      1996 => 0.0244,
      1995 => 0.0189,
      1994 => 0.0139,
      1993 => 0.0112,
      1992 => 0.0094,
      1991 => 0.0084,
      1990 => 0.0066,
      1989 => 0.0056,
      1988 => 0.0047,
      1987 => 0.0037,
      1986 => 0.0025,
      1985 => 0.0054
    }[year]
  end
  
  col :year, :type => :integer

  warn_unless_size 28
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
earth-0.12.4 lib/earth/automobile/automobile_year.rb
earth-0.12.3 lib/earth/automobile/automobile_year.rb
earth-0.12.2 lib/earth/automobile/automobile_year.rb
earth-0.12.1 lib/earth/automobile/automobile_year.rb
earth-0.12.0 lib/earth/automobile/automobile_year.rb