earth 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,9 +15,10 @@ class FlightSegment < ActiveRecord::Base
15
15
  belongs_to :service_class, :class_name => 'FlightService'
16
16
  belongs_to :domesticity, :class_name => 'FlightDomesticity'
17
17
 
18
- falls_back_on :load_factor => lambda { weighted_average(:load_factor, :weighted_by => :passengers) }, # 0.78222911236768
19
- :freight_share => lambda { weighted_average(:freight_share, :weighted_by => :passengers) }, # 0.024017329363736
20
- :seats => lambda { weighted_average :seats, :weighted_by => :passengers }
18
+ falls_back_on :distance => lambda { weighted_average(:distance, :weighted_by => :passengers) }, # 2077.1205 data1 10-12-2010
19
+ :seats => lambda { weighted_average(:seats, :weighted_by => :passengers) }, # 144.15653537046 data1 10-12-2010
20
+ :load_factor => lambda { weighted_average(:load_factor, :weighted_by => :passengers) }, # 0.78073233770097 data1 10-12-2010
21
+ :freight_share => lambda { weighted_average(:freight_share, :weighted_by => :passengers) } # 0.022567224170157 data1 10-12-2010
21
22
 
22
23
  data_miner do
23
24
  tap "Brighter Planet's sanitized T100 data", Earth.taps_server
@@ -181,7 +181,7 @@ FlightSegment.class_eval do
181
181
  integer 'air_time'
182
182
  float 'load_factor'
183
183
  float 'freight_share'
184
- integer 'distance'
184
+ float 'distance'
185
185
  integer 'departures_scheduled'
186
186
  string 'airline_iata_code'
187
187
  string 'dot_airline_id_code'
@@ -9,6 +9,8 @@ FuelType.class_eval do
9
9
  string 'name'
10
10
  float 'emission_factor'
11
11
  string 'emission_factor_units'
12
+ float 'density'
13
+ string 'density_units'
12
14
  float 'average_purchase_volume'
13
15
  string 'average_purchase_volume_units'
14
16
  # float 'energy_content'
@@ -25,11 +27,12 @@ FuelType.class_eval do
25
27
  # Conversions.register :carbon, :carbon_dioxide, 3.66666667
26
28
  # end
27
29
 
28
- import "a list of fuels and their emissions factors",
29
- :url => 'http://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdDR3RjlTcWlsLTc2TzQ0cERTMElJbHc' do
30
+ import "a list of fuels and their emissions factors and densities",
31
+ :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdDR3RjlTcWlsLTc2TzQ0cERTMElJbHc&single=true&gid=0&output=csv' do
30
32
  key 'name', :field_name => 'fuel'
31
33
  store 'emission_factor', :units_field_name => 'emission_factor_units'
32
34
  store 'average_purchase_volume', :units_field_name => 'average_purchase_volume_units'
35
+ store 'density', :units_field_name => 'density_units'
33
36
  # store 'energy_content', :field_name => 'energy_content', :units_field_name => 'energy_content_units', :to_units => 'FIXME' # FIXME need different conversions for different rows...
34
37
  # store 'carbon_content', :field_name => 'carbon_content', :units_field_name => 'carbon_content_units', :to_units => :kilograms_per_joule
35
38
  end
@@ -1,6 +1,8 @@
1
1
  class Country < ActiveRecord::Base
2
2
  set_primary_key :iso_3166_code
3
3
 
4
+ falls_back_on :flight_route_inefficiency_factor => 1.10 # for international flights - this is the larger (European) factor from Kettunen et al. (2005) http://www.atmseminar.org/seminarContent/seminar6/papers/p_055_MPM.pdf
5
+
4
6
  data_miner do
5
7
  tap "Brighter Planet's sanitized countries list", Earth.taps_server
6
8
  end
@@ -1,8 +1,9 @@
1
1
  Country.class_eval do
2
2
  data_miner do
3
3
  schema Earth.database_options do
4
- string 'iso_3166_code'
5
- string 'name'
4
+ string 'iso_3166_code'
5
+ string 'name'
6
+ float 'flight_route_inefficiency_factor'
6
7
  end
7
8
 
8
9
  import 'the official ISO country list',
@@ -14,6 +15,11 @@ Country.class_eval do
14
15
  key 'iso_3166_code', :field_number => 1
15
16
  store 'name', :field_number => 0
16
17
  end
18
+
19
+ import 'country-specific flight route inefficiency factors derived from Ketteunen et al. (2005)',
20
+ :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdG0yc3BxYUkybWV5M3RKb2t4X0JUOFE&hl=en&single=true&gid=0&output=csv' do
21
+ key 'iso_3166_code'
22
+ store 'flight_route_inefficiency_factor'
23
+ end
17
24
  end
18
25
  end
19
-
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: earth
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 4
10
- version: 0.2.4
9
+ - 5
10
+ version: 0.2.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Seamus Abshere
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-10-04 00:00:00 -04:00
20
+ date: 2010-10-14 00:00:00 -07:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency