earth 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,8 +48,8 @@ CommercialBuildingEnergyConsumptionSurveyResponse.class_eval do
48
48
  :skip => 1,
49
49
  :headers => ["PUBID8", "REGION8", "CENDIV8", "SQFT8", "SQFTC8", "YRCONC8", "PBA8", "ELUSED8", "NGUSED8", "FKUSED8", "PRUSED8", "STUSED8", "HWUSED8", "ADJWT8", "STRATUM8", "PAIR8", "NGCNS8", "NGBTU8", "NGEXP8", "ZNGCNS8", "ZNGEXP8", "FKCNS8", "FKBTU8", "FKEXP8", "ZFKCNS8", "ZFKEXP8", "DHUSED8", "DHHT18", "DHHT28", "DHCOOL8", "DHWATR8", "DHCOOK8", "DHMANU8", "DHOTH8", "DHCNS8", "DHBTU8", "DHEXP8", "ZDHCNS8", "ZDHEXP8"] do
50
50
  key 'id', :field_name => 'PUBID8'
51
- store 'natural_gas_use', :field_name => 'NGBTU8', :units => :kbtus
52
- store 'fuel_oil_use', :field_name => 'FKBTU8', :units => :kbtus
51
+ store 'natural_gas_use', :synthesize => lambda { |row| row['NGBTU8'].to_i == 0 ? nil : row['NGBTU8'] }, :units => :kbtus
52
+ store 'fuel_oil_use', :synthesize => lambda { |row| row['FKBTU8'].to_i == 0 ? nil : row['FKBTU8'] }, :units => :kbtus
53
53
  store 'district_heat_use', :field_name => 'DHBTU8', :units => :kbtus
54
54
  end
55
55
  end
@@ -1,46 +1,48 @@
1
1
  CbecsEnergyIntensity.class_eval do
2
2
  data_miner do
3
- CENSUS_DIVISIONS.each do |division, data|
3
+ NAICS_CODE_SYNTHESIZER = Proc.new do |row|
4
+ case row[0].gsub(/\./, '')
5
+ when 'Education' then
6
+ 611110
7
+ when 'Food Sales' then
8
+ 445
9
+ when 'Food Service' then
10
+ 722
11
+ when 'Health Care' then
12
+ 622110
13
+ when 'Inpatient' then
14
+ 622110
15
+ when 'Outpatient' then
16
+ 622111
17
+ when 'Lodging' then
18
+ 721
19
+ when 'Retail (Other Than Mall)' then
20
+ 44
21
+ when 'Office' then
22
+ #TODO
23
+ when 'Public Assembly' then
24
+ #TODO
25
+ when 'Public Order and Safety' then
26
+ 922120
27
+ when 'Religious Worship' then
28
+ 813110
29
+ when 'Service' then
30
+ #TODO
31
+ when 'Warehouse and Storage' then
32
+ 493110
33
+ when 'Other' then
34
+ #TODO
35
+ when 'Vacant' then
36
+ #TODO
37
+ end
38
+ end
39
+
40
+ CbecsEnergyIntensity::CENSUS_DIVISIONS.each do |division, data|
4
41
  import "2003 CBECS #{data[:table].capitalize} - Electricity Consumption and Intensity - #{division}",
5
- :url => "http://www.eia.gov/emeu/cbecs/cbecs2003/detailed_tables_2003/2003set10/2003excel/#{data[:table]}.xls"
6
- :crop => (21..36)) do
42
+ :url => "http://www.eia.gov/emeu/cbecs/cbecs2003/detailed_tables_2003/2003set10/2003excel/#{data[:table]}.xls",
43
+ :crop => (21..36) do
7
44
  key :name, :synthesize => Proc.new { |row| "#{Industry.format_naics_code(row[0])}-#{data[:code]}" }
8
- store :naics_code, :synthesize => Proc.new do |row|
9
- case row[0].gsub(/\./, '')
10
- when 'Education' then
11
- 611110
12
- when 'Food Sales' then
13
- 445
14
- when 'Food Service' then
15
- 722
16
- when 'Health Care' then
17
- 622110
18
- when 'Inpatient' then
19
- 622110
20
- when 'Outpatient' then
21
- 622111
22
- when 'Lodging' then
23
- 721
24
- when 'Retail (Other Than Mall)' then
25
- 44
26
- when 'Office' then
27
- #TODO
28
- when 'Public Assembly' then
29
- #TODO
30
- when 'Public Order and Safety' then
31
- 922120
32
- when 'Religious Worship' then
33
- 813110
34
- when 'Service' then
35
- #TODO
36
- when 'Warehouse and Storage' then
37
- 493110
38
- when 'Other' then
39
- #TODO
40
- when 'Vacant' then
41
- #TODO
42
- end
43
- end
45
+ store :naics_code, :synthesize => NAICS_CODE_SYNTHESIZER
44
46
  store :census_division_number, :static => data[:code]
45
47
  store :total_electricity_consumption, :field_number => data[:column] + 1
46
48
  store :total_floorspace, :field_number => data[:column] + 4
@@ -52,3 +54,4 @@ CbecsEnergyIntensity.class_eval do
52
54
  EIA.normalize(CbecsEnergyIntensity, [:total_electricity_consumption, :total_floorspace, :electricity_intensity])
53
55
  end
54
56
  end
57
+ end
@@ -2,7 +2,7 @@ require 'earth/eia'
2
2
 
3
3
  MecsEnergy.class_eval do
4
4
  data_miner do
5
- CENSUS_REGIONS.each do |region, data|
5
+ MecsEnergy::CENSUS_REGIONS.each do |region, data|
6
6
  import("MECS table 3.2 #{region}",
7
7
  :url => "http://205.254.135.24/emeu/mecs/mecs2006/excel/Table3_2.xls",
8
8
  :crop => data[:crop]) do
@@ -2,7 +2,7 @@ require 'earth/eia'
2
2
 
3
3
  MecsRatio.class_eval do
4
4
  data_miner do
5
- CENSUS_REGIONS.each do |region, data|
5
+ MecsRatio::CENSUS_REGIONS.each do |region, data|
6
6
  import( "MECS table 6.1 #{region}",
7
7
  :url => "http://205.254.135.24/emeu/mecs/mecs2006/excel/Table6_1.xls",
8
8
  :crop => data[:crop]) do
@@ -1,3 +1,3 @@
1
1
  module Earth
2
- VERSION = "0.11.3"
2
+ VERSION = "0.11.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: earth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.11.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ date: 2011-12-16 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: data_miner
18
- requirement: &2154813320 !ruby/object:Gem::Requirement
18
+ requirement: &2154155380 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '1.3'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2154813320
26
+ version_requirements: *2154155380
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: to_regexp
29
- requirement: &2154812900 !ruby/object:Gem::Requirement
29
+ requirement: &2154154940 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *2154812900
37
+ version_requirements: *2154154940
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: cohort_scope
40
- requirement: &2154812420 !ruby/object:Gem::Requirement
40
+ requirement: &2154150020 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *2154812420
48
+ version_requirements: *2154150020
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: table_warnings
51
- requirement: &2154811720 !ruby/object:Gem::Requirement
51
+ requirement: &2154149280 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: 0.0.6
57
57
  type: :runtime
58
58
  prerelease: false
59
- version_requirements: *2154811720
59
+ version_requirements: *2154149280
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: remote_table
62
- requirement: &2154800400 !ruby/object:Gem::Requirement
62
+ requirement: &2154148580 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: 1.2.3
68
68
  type: :runtime
69
69
  prerelease: false
70
- version_requirements: *2154800400
70
+ version_requirements: *2154148580
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: falls_back_on
73
- requirement: &2154799440 !ruby/object:Gem::Requirement
73
+ requirement: &2154148160 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: '0'
79
79
  type: :runtime
80
80
  prerelease: false
81
- version_requirements: *2154799440
81
+ version_requirements: *2154148160
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: fixed_width-multibyte
84
- requirement: &2154798640 !ruby/object:Gem::Requirement
84
+ requirement: &2154147560 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
- version_requirements: *2154798640
92
+ version_requirements: *2154147560
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: geokit-rails
95
- requirement: &2154797720 !ruby/object:Gem::Requirement
95
+ requirement: &2154146940 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ! '>='
@@ -100,10 +100,10 @@ dependencies:
100
100
  version: '0'
101
101
  type: :runtime
102
102
  prerelease: false
103
- version_requirements: *2154797720
103
+ version_requirements: *2154146940
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: loose_tight_dictionary
106
- requirement: &2154795920 !ruby/object:Gem::Requirement
106
+ requirement: &2154146240 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
109
  - - ! '>='
@@ -111,10 +111,10 @@ dependencies:
111
111
  version: 0.2.3
112
112
  type: :runtime
113
113
  prerelease: false
114
- version_requirements: *2154795920
114
+ version_requirements: *2154146240
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: weighted_average
117
- requirement: &2154793780 !ruby/object:Gem::Requirement
117
+ requirement: &2154144800 !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
120
120
  - - ! '>='
@@ -122,10 +122,10 @@ dependencies:
122
122
  version: 1.0.2
123
123
  type: :runtime
124
124
  prerelease: false
125
- version_requirements: *2154793780
125
+ version_requirements: *2154144800
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: mini_record-compat
128
- requirement: &2154792680 !ruby/object:Gem::Requirement
128
+ requirement: &2154144160 !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
131
  - - ! '>='
@@ -133,10 +133,10 @@ dependencies:
133
133
  version: '0'
134
134
  type: :runtime
135
135
  prerelease: false
136
- version_requirements: *2154792680
136
+ version_requirements: *2154144160
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: activesupport
139
- requirement: &2154790860 !ruby/object:Gem::Requirement
139
+ requirement: &2154143000 !ruby/object:Gem::Requirement
140
140
  none: false
141
141
  requirements:
142
142
  - - ! '>='
@@ -144,10 +144,10 @@ dependencies:
144
144
  version: '0'
145
145
  type: :runtime
146
146
  prerelease: false
147
- version_requirements: *2154790860
147
+ version_requirements: *2154143000
148
148
  - !ruby/object:Gem::Dependency
149
149
  name: activerecord
150
- requirement: &2154789920 !ruby/object:Gem::Requirement
150
+ requirement: &2154137480 !ruby/object:Gem::Requirement
151
151
  none: false
152
152
  requirements:
153
153
  - - ! '>='
@@ -155,10 +155,10 @@ dependencies:
155
155
  version: '0'
156
156
  type: :runtime
157
157
  prerelease: false
158
- version_requirements: *2154789920
158
+ version_requirements: *2154137480
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: bundler
161
- requirement: &2154789280 !ruby/object:Gem::Requirement
161
+ requirement: &2154136560 !ruby/object:Gem::Requirement
162
162
  none: false
163
163
  requirements:
164
164
  - - ! '>='
@@ -166,10 +166,10 @@ dependencies:
166
166
  version: '0'
167
167
  type: :development
168
168
  prerelease: false
169
- version_requirements: *2154789280
169
+ version_requirements: *2154136560
170
170
  - !ruby/object:Gem::Dependency
171
171
  name: bueller
172
- requirement: &2154788780 !ruby/object:Gem::Requirement
172
+ requirement: &2154135700 !ruby/object:Gem::Requirement
173
173
  none: false
174
174
  requirements:
175
175
  - - ! '>='
@@ -177,10 +177,10 @@ dependencies:
177
177
  version: '0'
178
178
  type: :development
179
179
  prerelease: false
180
- version_requirements: *2154788780
180
+ version_requirements: *2154135700
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: cucumber
183
- requirement: &2154788100 !ruby/object:Gem::Requirement
183
+ requirement: &2154134140 !ruby/object:Gem::Requirement
184
184
  none: false
185
185
  requirements:
186
186
  - - ! '>='
@@ -188,10 +188,10 @@ dependencies:
188
188
  version: '0'
189
189
  type: :development
190
190
  prerelease: false
191
- version_requirements: *2154788100
191
+ version_requirements: *2154134140
192
192
  - !ruby/object:Gem::Dependency
193
193
  name: rake
194
- requirement: &2154787440 !ruby/object:Gem::Requirement
194
+ requirement: &2154133360 !ruby/object:Gem::Requirement
195
195
  none: false
196
196
  requirements:
197
197
  - - ! '>='
@@ -199,10 +199,10 @@ dependencies:
199
199
  version: '0'
200
200
  type: :development
201
201
  prerelease: false
202
- version_requirements: *2154787440
202
+ version_requirements: *2154133360
203
203
  - !ruby/object:Gem::Dependency
204
204
  name: rdoc
205
- requirement: &2154786780 !ruby/object:Gem::Requirement
205
+ requirement: &2154132360 !ruby/object:Gem::Requirement
206
206
  none: false
207
207
  requirements:
208
208
  - - ! '>='
@@ -210,10 +210,10 @@ dependencies:
210
210
  version: '0'
211
211
  type: :development
212
212
  prerelease: false
213
- version_requirements: *2154786780
213
+ version_requirements: *2154132360
214
214
  - !ruby/object:Gem::Dependency
215
215
  name: rspec
216
- requirement: &2154786100 !ruby/object:Gem::Requirement
216
+ requirement: &2154117760 !ruby/object:Gem::Requirement
217
217
  none: false
218
218
  requirements:
219
219
  - - ! '>='
@@ -221,10 +221,10 @@ dependencies:
221
221
  version: '0'
222
222
  type: :development
223
223
  prerelease: false
224
- version_requirements: *2154786100
224
+ version_requirements: *2154117760
225
225
  - !ruby/object:Gem::Dependency
226
226
  name: sqlite3-ruby
227
- requirement: &2154785400 !ruby/object:Gem::Requirement
227
+ requirement: &2154116800 !ruby/object:Gem::Requirement
228
228
  none: false
229
229
  requirements:
230
230
  - - ! '>='
@@ -232,10 +232,10 @@ dependencies:
232
232
  version: '0'
233
233
  type: :development
234
234
  prerelease: false
235
- version_requirements: *2154785400
235
+ version_requirements: *2154116800
236
236
  - !ruby/object:Gem::Dependency
237
237
  name: mysql
238
- requirement: &2154784660 !ruby/object:Gem::Requirement
238
+ requirement: &2154116180 !ruby/object:Gem::Requirement
239
239
  none: false
240
240
  requirements:
241
241
  - - ! '>='
@@ -243,10 +243,10 @@ dependencies:
243
243
  version: '0'
244
244
  type: :development
245
245
  prerelease: false
246
- version_requirements: *2154784660
246
+ version_requirements: *2154116180
247
247
  - !ruby/object:Gem::Dependency
248
248
  name: pg
249
- requirement: &2154770840 !ruby/object:Gem::Requirement
249
+ requirement: &2154115520 !ruby/object:Gem::Requirement
250
250
  none: false
251
251
  requirements:
252
252
  - - ! '>='
@@ -254,7 +254,7 @@ dependencies:
254
254
  version: '0'
255
255
  type: :development
256
256
  prerelease: false
257
- version_requirements: *2154770840
257
+ version_requirements: *2154115520
258
258
  description: An earth-simulation environment with ActiveRecord models and data
259
259
  email: andy@rossmeissl.net
260
260
  executables: