earth 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/earth.gemspec +1 -1
  2. data/features/automobile_fuel.feature +144 -144
  3. data/features/automobile_make.feature +24 -24
  4. data/features/automobile_make_fleet_year.feature +34 -34
  5. data/features/automobile_make_model.feature +24 -24
  6. data/features/automobile_make_model_year.feature +34 -34
  7. data/features/automobile_make_model_year_variant.feature +46 -46
  8. data/features/automobile_make_year.feature +34 -34
  9. data/features/automobile_size_class.feature +59 -59
  10. data/features/automobile_size_class_year.feature +34 -34
  11. data/features/automobile_type_fuel_age.feature +55 -55
  12. data/features/automobile_type_fuel_control.feature +34 -34
  13. data/features/automobile_type_fuel_year.feature +124 -124
  14. data/features/automobile_type_fuel_year_age.feature +94 -94
  15. data/features/automobile_type_fuel_year_control.feature +74 -74
  16. data/features/automobile_type_year.feature +64 -64
  17. data/features/bus_class.feature +39 -39
  18. data/features/bus_fuel.feature +114 -114
  19. data/features/carrier.feature +64 -64
  20. data/features/carrier_mode.feature +64 -64
  21. data/features/computation_carrier.feature +14 -14
  22. data/features/computation_carrier_instance_class.feature +24 -24
  23. data/features/egrid_region.feature +20 -20
  24. data/features/egrid_subregion.feature +134 -134
  25. data/features/fuel_year.feature +54 -54
  26. data/features/greenhouse_gas.feature +44 -44
  27. data/features/rail_class.feature +64 -64
  28. data/features/shipment_mode.feature +34 -34
  29. data/lib/earth/air.rb +1 -0
  30. data/lib/earth/air/data_miner.rb +1 -0
  31. data/lib/earth/air/flight_distance_class.rb +10 -0
  32. data/lib/earth/air/flight_distance_class/data_miner.rb +18 -2
  33. data/lib/earth/air/flight_distance_class_seat_class.rb +10 -0
  34. data/lib/earth/air/flight_distance_class_seat_class/data_miner.rb +13 -0
  35. data/lib/earth/air/flight_seat_class.rb +6 -5
  36. data/lib/earth/air/flight_seat_class/data_miner.rb +18 -6
  37. data/lib/earth/version.rb +1 -1
  38. data/spec/earth_spec.rb +2 -2
  39. metadata +187 -173
@@ -0,0 +1,10 @@
1
+ class FlightDistanceClassSeatClass < ActiveRecord::Base
2
+ set_primary_key :name
3
+
4
+ belongs_to :distance_class, :foreign_key => 'distance_class_name', :primary_key => 'name', :class_name => 'FlightDistanceClass'
5
+
6
+ col :name
7
+ col :distance_class_name
8
+ col :seat_class_name
9
+ col :multiplier, :type => :float
10
+ end
@@ -0,0 +1,13 @@
1
+ FlightDistanceClassSeatClass.class_eval do
2
+ data_miner do
3
+ import "seat classes used in the WRI GHG Protocol calculation tools",
4
+ :url => 'https://docs.google.com/spreadsheet/pub?key=0AoQJbWqPrREqdG9EdmxybG1wdC1iU3JRYXNkMGhvSnc&output=csv' do
5
+ key 'name'
6
+ store 'distance_class_name'
7
+ store 'seat_class_name'
8
+ store 'multiplier'
9
+ end
10
+
11
+ # FIXME TODO verify this
12
+ end
13
+ end
@@ -1,10 +1,11 @@
1
1
  class FlightSeatClass < ActiveRecord::Base
2
2
  set_primary_key :name
3
3
 
4
- falls_back_on :multiplier => 1
5
-
4
+ has_many :distance_class_seat_classes, :foreign_key => 'seat_class_name', :primary_key => 'name', :class_name => 'FlightDistanceClassSeatClass'
5
+
6
+ falls_back_on :name => 'fallback',
7
+ :multiplier => 1
8
+
6
9
  col :name
7
- col :distance_class_name
8
- col :seat_class_name
9
10
  col :multiplier, :type => :float
10
- end
11
+ end
@@ -1,11 +1,23 @@
1
1
  FlightSeatClass.class_eval do
2
2
  data_miner do
3
- import "seat classes used in the WRI GHG Protocol calculation tools",
4
- :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdG5zSER1QmFVVkhNcTM2cmhCMEJtWVE&hl=en&gid=0&output=csv' do
5
- key 'name'
6
- store 'distance_class_name'
7
- store 'seat_class_name'
8
- store 'multiplier'
3
+ process "Ensure that FlightDistanceClassSeatClass is populated" do
4
+ FlightDistanceClassSeatClass.run_data_miner!
5
+ end
6
+
7
+ process "Derive flight seat classes names from FlightDistanceClassSeatClass" do
8
+ FlightDistanceClassSeatClass.select("DISTINCT seat_class_name").each do |distance_class_seat_class|
9
+ FlightSeatClass.find_or_create_by_name(distance_class_seat_class.seat_class_name)
10
+ end
11
+ end
12
+
13
+ process "Calculate multipliers from FlightDistanceClassSeatClass and FlightDistanceClass" do
14
+ FlightSeatClass.find_each do |seat_class|
15
+ seat_class.multiplier =
16
+ seat_class.distance_class_seat_classes.map do |dcsc|
17
+ dcsc.multiplier * dcsc.distance_class.passengers
18
+ end.sum / seat_class.distance_class_seat_classes.map(&:distance_class).map(&:passengers).sum
19
+ seat_class.save!
20
+ end
9
21
  end
10
22
 
11
23
  # FIXME TODO verify this
data/lib/earth/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Earth
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.5"
3
3
  end
data/spec/earth_spec.rb CHANGED
@@ -23,7 +23,7 @@ describe Earth do
23
23
  describe '.resource_map' do
24
24
  it 'should get a list of resource_map' do
25
25
  resource_map = Earth.resource_map
26
- resource_map.keys.count.should == 75
26
+ resource_map.keys.count.should == 77
27
27
  resource_map['FuelType'].should == 'fuel'
28
28
  end
29
29
  it 'should exclude data_miner files' do
@@ -33,7 +33,7 @@ describe Earth do
33
33
 
34
34
  describe '.search' do
35
35
  it 'should get a list of all resource names' do
36
- Earth.search.length.should == 75
36
+ Earth.search.length.should == 77
37
37
  Earth.search.should include('Aircraft')
38
38
  Earth.search.should include('Industry')
39
39
  end
metadata CHANGED
@@ -1,270 +1,273 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: earth
3
- version: !ruby/object:Gem::Version
4
- version: 0.6.4
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.6.5
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Seamus Abshere
9
9
  - Derek Kastner
10
10
  - Andy Rossmeissl
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-06-06 00:00:00.000000000Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
14
+
15
+ date: 2011-10-05 00:00:00 +02:00
16
+ default_executable:
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
17
19
  name: data_miner
18
- requirement: &2164366140 !ruby/object:Gem::Requirement
20
+ requirement: &id001 !ruby/object:Gem::Requirement
19
21
  none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
23
- version: '1.3'
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: "1.3"
24
26
  type: :runtime
25
27
  prerelease: false
26
- version_requirements: *2164366140
27
- - !ruby/object:Gem::Dependency
28
+ version_requirements: *id001
29
+ - !ruby/object:Gem::Dependency
28
30
  name: to_regexp
29
- requirement: &2164365680 !ruby/object:Gem::Requirement
31
+ requirement: &id002 !ruby/object:Gem::Requirement
30
32
  none: false
31
- requirements:
32
- - - ! '>='
33
- - !ruby/object:Gem::Version
34
- version: '0'
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: "0"
35
37
  type: :runtime
36
38
  prerelease: false
37
- version_requirements: *2164365680
38
- - !ruby/object:Gem::Dependency
39
+ version_requirements: *id002
40
+ - !ruby/object:Gem::Dependency
39
41
  name: cohort_scope
40
- requirement: &2164365200 !ruby/object:Gem::Requirement
42
+ requirement: &id003 !ruby/object:Gem::Requirement
41
43
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
46
48
  type: :runtime
47
49
  prerelease: false
48
- version_requirements: *2164365200
49
- - !ruby/object:Gem::Dependency
50
+ version_requirements: *id003
51
+ - !ruby/object:Gem::Dependency
50
52
  name: table_warnings
51
- requirement: &2164364700 !ruby/object:Gem::Requirement
53
+ requirement: &id004 !ruby/object:Gem::Requirement
52
54
  none: false
53
- requirements:
54
- - - ! '>='
55
- - !ruby/object:Gem::Version
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
56
58
  version: 0.0.6
57
59
  type: :runtime
58
60
  prerelease: false
59
- version_requirements: *2164364700
60
- - !ruby/object:Gem::Dependency
61
+ version_requirements: *id004
62
+ - !ruby/object:Gem::Dependency
61
63
  name: remote_table
62
- requirement: &2164364180 !ruby/object:Gem::Requirement
64
+ requirement: &id005 !ruby/object:Gem::Requirement
63
65
  none: false
64
- requirements:
65
- - - ! '>='
66
- - !ruby/object:Gem::Version
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
67
69
  version: 1.2.3
68
70
  type: :runtime
69
71
  prerelease: false
70
- version_requirements: *2164364180
71
- - !ruby/object:Gem::Dependency
72
+ version_requirements: *id005
73
+ - !ruby/object:Gem::Dependency
72
74
  name: falls_back_on
73
- requirement: &2164363760 !ruby/object:Gem::Requirement
75
+ requirement: &id006 !ruby/object:Gem::Requirement
74
76
  none: false
75
- requirements:
76
- - - ! '>='
77
- - !ruby/object:Gem::Version
78
- version: '0'
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
79
81
  type: :runtime
80
82
  prerelease: false
81
- version_requirements: *2164363760
82
- - !ruby/object:Gem::Dependency
83
+ version_requirements: *id006
84
+ - !ruby/object:Gem::Dependency
83
85
  name: fixed_width-multibyte
84
- requirement: &2164363300 !ruby/object:Gem::Requirement
86
+ requirement: &id007 !ruby/object:Gem::Requirement
85
87
  none: false
86
- requirements:
87
- - - ! '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: "0"
90
92
  type: :runtime
91
93
  prerelease: false
92
- version_requirements: *2164363300
93
- - !ruby/object:Gem::Dependency
94
+ version_requirements: *id007
95
+ - !ruby/object:Gem::Dependency
94
96
  name: geokit-rails
95
- requirement: &2164362800 !ruby/object:Gem::Requirement
97
+ requirement: &id008 !ruby/object:Gem::Requirement
96
98
  none: false
97
- requirements:
98
- - - ! '>='
99
- - !ruby/object:Gem::Version
100
- version: '0'
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: "0"
101
103
  type: :runtime
102
104
  prerelease: false
103
- version_requirements: *2164362800
104
- - !ruby/object:Gem::Dependency
105
+ version_requirements: *id008
106
+ - !ruby/object:Gem::Dependency
105
107
  name: loose_tight_dictionary
106
- requirement: &2164362300 !ruby/object:Gem::Requirement
108
+ requirement: &id009 !ruby/object:Gem::Requirement
107
109
  none: false
108
- requirements:
109
- - - ! '>='
110
- - !ruby/object:Gem::Version
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
111
113
  version: 0.2.3
112
114
  type: :runtime
113
115
  prerelease: false
114
- version_requirements: *2164362300
115
- - !ruby/object:Gem::Dependency
116
+ version_requirements: *id009
117
+ - !ruby/object:Gem::Dependency
116
118
  name: weighted_average
117
- requirement: &2164361800 !ruby/object:Gem::Requirement
119
+ requirement: &id010 !ruby/object:Gem::Requirement
118
120
  none: false
119
- requirements:
120
- - - ! '>='
121
- - !ruby/object:Gem::Version
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
122
124
  version: 1.0.1
123
125
  type: :runtime
124
126
  prerelease: false
125
- version_requirements: *2164361800
126
- - !ruby/object:Gem::Dependency
127
+ version_requirements: *id010
128
+ - !ruby/object:Gem::Dependency
127
129
  name: mini_record-compat
128
- requirement: &2164361400 !ruby/object:Gem::Requirement
130
+ requirement: &id011 !ruby/object:Gem::Requirement
129
131
  none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: "0"
134
136
  type: :runtime
135
137
  prerelease: false
136
- version_requirements: *2164361400
137
- - !ruby/object:Gem::Dependency
138
+ version_requirements: *id011
139
+ - !ruby/object:Gem::Dependency
138
140
  name: activesupport
139
- requirement: &2164360920 !ruby/object:Gem::Requirement
141
+ requirement: &id012 !ruby/object:Gem::Requirement
140
142
  none: false
141
- requirements:
142
- - - ! '>='
143
- - !ruby/object:Gem::Version
144
- version: '0'
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: "0"
145
147
  type: :runtime
146
148
  prerelease: false
147
- version_requirements: *2164360920
148
- - !ruby/object:Gem::Dependency
149
+ version_requirements: *id012
150
+ - !ruby/object:Gem::Dependency
149
151
  name: activerecord
150
- requirement: &2164360500 !ruby/object:Gem::Requirement
152
+ requirement: &id013 !ruby/object:Gem::Requirement
151
153
  none: false
152
- requirements:
153
- - - ! '>='
154
- - !ruby/object:Gem::Version
155
- version: '0'
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: "0"
156
158
  type: :runtime
157
159
  prerelease: false
158
- version_requirements: *2164360500
159
- - !ruby/object:Gem::Dependency
160
+ version_requirements: *id013
161
+ - !ruby/object:Gem::Dependency
160
162
  name: bundler
161
- requirement: &2164360060 !ruby/object:Gem::Requirement
163
+ requirement: &id014 !ruby/object:Gem::Requirement
162
164
  none: false
163
- requirements:
164
- - - ! '>='
165
- - !ruby/object:Gem::Version
166
- version: '0'
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: "0"
167
169
  type: :development
168
170
  prerelease: false
169
- version_requirements: *2164360060
170
- - !ruby/object:Gem::Dependency
171
+ version_requirements: *id014
172
+ - !ruby/object:Gem::Dependency
171
173
  name: bueller
172
- requirement: &2164347840 !ruby/object:Gem::Requirement
174
+ requirement: &id015 !ruby/object:Gem::Requirement
173
175
  none: false
174
- requirements:
175
- - - ! '>='
176
- - !ruby/object:Gem::Version
177
- version: '0'
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: "0"
178
180
  type: :development
179
181
  prerelease: false
180
- version_requirements: *2164347840
181
- - !ruby/object:Gem::Dependency
182
+ version_requirements: *id015
183
+ - !ruby/object:Gem::Dependency
182
184
  name: cucumber
183
- requirement: &2164347360 !ruby/object:Gem::Requirement
185
+ requirement: &id016 !ruby/object:Gem::Requirement
184
186
  none: false
185
- requirements:
186
- - - ! '>='
187
- - !ruby/object:Gem::Version
188
- version: '0'
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: "0"
189
191
  type: :development
190
192
  prerelease: false
191
- version_requirements: *2164347360
192
- - !ruby/object:Gem::Dependency
193
+ version_requirements: *id016
194
+ - !ruby/object:Gem::Dependency
193
195
  name: rake
194
- requirement: &2164346940 !ruby/object:Gem::Requirement
196
+ requirement: &id017 !ruby/object:Gem::Requirement
195
197
  none: false
196
- requirements:
197
- - - ! '>='
198
- - !ruby/object:Gem::Version
199
- version: '0'
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: "0"
200
202
  type: :development
201
203
  prerelease: false
202
- version_requirements: *2164346940
203
- - !ruby/object:Gem::Dependency
204
+ version_requirements: *id017
205
+ - !ruby/object:Gem::Dependency
204
206
  name: rdoc
205
- requirement: &2164346520 !ruby/object:Gem::Requirement
207
+ requirement: &id018 !ruby/object:Gem::Requirement
206
208
  none: false
207
- requirements:
208
- - - ! '>='
209
- - !ruby/object:Gem::Version
210
- version: '0'
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ version: "0"
211
213
  type: :development
212
214
  prerelease: false
213
- version_requirements: *2164346520
214
- - !ruby/object:Gem::Dependency
215
+ version_requirements: *id018
216
+ - !ruby/object:Gem::Dependency
215
217
  name: rspec
216
- requirement: &2164346100 !ruby/object:Gem::Requirement
218
+ requirement: &id019 !ruby/object:Gem::Requirement
217
219
  none: false
218
- requirements:
219
- - - ! '>='
220
- - !ruby/object:Gem::Version
221
- version: '0'
220
+ requirements:
221
+ - - ">="
222
+ - !ruby/object:Gem::Version
223
+ version: "0"
222
224
  type: :development
223
225
  prerelease: false
224
- version_requirements: *2164346100
225
- - !ruby/object:Gem::Dependency
226
+ version_requirements: *id019
227
+ - !ruby/object:Gem::Dependency
226
228
  name: sqlite3-ruby
227
- requirement: &2164345640 !ruby/object:Gem::Requirement
229
+ requirement: &id020 !ruby/object:Gem::Requirement
228
230
  none: false
229
- requirements:
230
- - - ! '>='
231
- - !ruby/object:Gem::Version
232
- version: '0'
231
+ requirements:
232
+ - - ">="
233
+ - !ruby/object:Gem::Version
234
+ version: "0"
233
235
  type: :development
234
236
  prerelease: false
235
- version_requirements: *2164345640
236
- - !ruby/object:Gem::Dependency
237
+ version_requirements: *id020
238
+ - !ruby/object:Gem::Dependency
237
239
  name: mysql
238
- requirement: &2164345220 !ruby/object:Gem::Requirement
240
+ requirement: &id021 !ruby/object:Gem::Requirement
239
241
  none: false
240
- requirements:
241
- - - ! '>='
242
- - !ruby/object:Gem::Version
243
- version: '0'
242
+ requirements:
243
+ - - ">="
244
+ - !ruby/object:Gem::Version
245
+ version: "0"
244
246
  type: :development
245
247
  prerelease: false
246
- version_requirements: *2164345220
247
- - !ruby/object:Gem::Dependency
248
+ version_requirements: *id021
249
+ - !ruby/object:Gem::Dependency
248
250
  name: pg
249
- requirement: &2164344760 !ruby/object:Gem::Requirement
251
+ requirement: &id022 !ruby/object:Gem::Requirement
250
252
  none: false
251
- requirements:
252
- - - ! '>='
253
- - !ruby/object:Gem::Version
254
- version: '0'
253
+ requirements:
254
+ - - ">="
255
+ - !ruby/object:Gem::Version
256
+ version: "0"
255
257
  type: :development
256
258
  prerelease: false
257
- version_requirements: *2164344760
259
+ version_requirements: *id022
258
260
  description: An earth-simulation environment with ActiveRecord models and data
259
261
  email: andy@rossmeissl.net
260
- executables:
262
+ executables:
261
263
  - earth_tester.rb
262
264
  extensions: []
263
- extra_rdoc_files:
265
+
266
+ extra_rdoc_files:
264
267
  - LICENSE
265
268
  - LICENSE-PREAMBLE
266
269
  - README.markdown
267
- files:
270
+ files:
268
271
  - .document
269
272
  - .gitignore
270
273
  - Gemfile
@@ -377,6 +380,8 @@ files:
377
380
  - lib/earth/air/data_miner.rb
378
381
  - lib/earth/air/flight_distance_class.rb
379
382
  - lib/earth/air/flight_distance_class/data_miner.rb
383
+ - lib/earth/air/flight_distance_class_seat_class.rb
384
+ - lib/earth/air/flight_distance_class_seat_class/data_miner.rb
380
385
  - lib/earth/air/flight_seat_class.rb
381
386
  - lib/earth/air/flight_seat_class/data_miner.rb
382
387
  - lib/earth/air/flight_segment.rb
@@ -586,32 +591,41 @@ files:
586
591
  - vendor/geokit-rails/test/schema.rb
587
592
  - vendor/geokit-rails/test/tasks.rake
588
593
  - vendor/geokit-rails/test/test_helper.rb
594
+ has_rdoc: true
589
595
  homepage: https://github.com/brighterplanet/earth
590
596
  licenses: []
597
+
591
598
  post_install_message:
592
- rdoc_options:
599
+ rdoc_options:
593
600
  - --charset=UTF-8
594
- require_paths:
601
+ require_paths:
595
602
  - lib
596
- required_ruby_version: !ruby/object:Gem::Requirement
603
+ required_ruby_version: !ruby/object:Gem::Requirement
597
604
  none: false
598
- requirements:
599
- - - ! '>='
600
- - !ruby/object:Gem::Version
601
- version: '0'
602
- required_rubygems_version: !ruby/object:Gem::Requirement
605
+ requirements:
606
+ - - ">="
607
+ - !ruby/object:Gem::Version
608
+ hash: -3898759173730063628
609
+ segments:
610
+ - 0
611
+ version: "0"
612
+ required_rubygems_version: !ruby/object:Gem::Requirement
603
613
  none: false
604
- requirements:
605
- - - ! '>='
606
- - !ruby/object:Gem::Version
607
- version: '0'
614
+ requirements:
615
+ - - ">="
616
+ - !ruby/object:Gem::Version
617
+ hash: -3898759173730063628
618
+ segments:
619
+ - 0
620
+ version: "0"
608
621
  requirements: []
622
+
609
623
  rubyforge_project:
610
- rubygems_version: 1.8.6
624
+ rubygems_version: 1.6.2
611
625
  signing_key:
612
626
  specification_version: 3
613
627
  summary: Land, sky, and sea
614
- test_files:
628
+ test_files:
615
629
  - features/automobile_fuel.feature
616
630
  - features/automobile_make.feature
617
631
  - features/automobile_make_fleet_year.feature