earth 0.11.7 → 0.11.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/README.markdown +30 -0
  2. data/bin/earth_tester.rb +1 -1
  3. data/earth.gemspec +3 -3
  4. data/lib/earth.rb +105 -90
  5. data/lib/earth/air.rb +3 -12
  6. data/lib/earth/air/aircraft.rb +9 -9
  7. data/lib/earth/air/airport.rb +3 -0
  8. data/lib/earth/air/airport/data_miner.rb +2 -0
  9. data/lib/earth/air/data_miner.rb +3 -10
  10. data/lib/earth/air/flight_segment.rb +3 -1
  11. data/lib/earth/air/flight_segment/data_miner.rb +2 -0
  12. data/lib/earth/all.rb +3 -13
  13. data/lib/earth/automobile.rb +3 -18
  14. data/lib/earth/automobile/automobile_fuel.rb +1 -3
  15. data/lib/earth/automobile/automobile_fuel/data_miner.rb +1 -0
  16. data/lib/earth/automobile/automobile_make.rb +1 -0
  17. data/lib/earth/automobile/automobile_make/data_miner.rb +1 -0
  18. data/lib/earth/automobile/automobile_make_model.rb +1 -0
  19. data/lib/earth/automobile/automobile_make_model/data_miner.rb +1 -0
  20. data/lib/earth/automobile/automobile_make_model_year.rb +1 -0
  21. data/lib/earth/automobile/automobile_make_model_year/data_miner.rb +1 -0
  22. data/lib/earth/automobile/automobile_make_model_year_variant.rb +1 -0
  23. data/lib/earth/automobile/automobile_make_model_year_variant/data_miner.rb +1 -0
  24. data/lib/earth/automobile/automobile_make_year.rb +1 -0
  25. data/lib/earth/automobile/automobile_make_year/data_miner.rb +1 -0
  26. data/lib/earth/automobile/automobile_make_year_fleet.rb +1 -0
  27. data/lib/earth/automobile/automobile_make_year_fleet/data_miner.rb +1 -0
  28. data/lib/earth/automobile/automobile_model.rb +1 -0
  29. data/lib/earth/automobile/automobile_model/data_miner.rb +1 -0
  30. data/lib/earth/automobile/automobile_size_class.rb +1 -0
  31. data/lib/earth/automobile/automobile_size_class/data_miner.rb +1 -0
  32. data/lib/earth/automobile/automobile_size_class_year.rb +1 -0
  33. data/lib/earth/automobile/automobile_size_class_year/data_miner.rb +1 -0
  34. data/lib/earth/automobile/automobile_type_fuel_control.rb +1 -0
  35. data/lib/earth/automobile/automobile_type_fuel_control/data_miner.rb +1 -0
  36. data/lib/earth/automobile/automobile_type_fuel_year.rb +1 -0
  37. data/lib/earth/automobile/automobile_type_fuel_year/data_miner.rb +1 -0
  38. data/lib/earth/automobile/automobile_type_fuel_year_age.rb +1 -0
  39. data/lib/earth/automobile/automobile_type_fuel_year_age/data_miner.rb +1 -0
  40. data/lib/earth/automobile/automobile_type_fuel_year_control.rb +1 -0
  41. data/lib/earth/automobile/automobile_type_fuel_year_control/data_miner.rb +1 -0
  42. data/lib/earth/automobile/automobile_type_year.rb +1 -0
  43. data/lib/earth/automobile/automobile_type_year/data_miner.rb +1 -0
  44. data/lib/earth/automobile/automobile_year.rb +1 -0
  45. data/lib/earth/automobile/automobile_year/data_miner.rb +1 -0
  46. data/lib/earth/automobile/data_miner.rb +3 -18
  47. data/lib/earth/bus.rb +3 -6
  48. data/lib/earth/bus/bus_class.rb +1 -0
  49. data/lib/earth/bus/bus_class/data_miner.rb +1 -0
  50. data/lib/earth/bus/bus_fuel.rb +1 -0
  51. data/lib/earth/bus/bus_fuel/data_miner.rb +1 -0
  52. data/lib/earth/bus/bus_fuel_control.rb +1 -0
  53. data/lib/earth/bus/bus_fuel_control/data_miner.rb +1 -0
  54. data/lib/earth/bus/bus_fuel_year_control.rb +1 -0
  55. data/lib/earth/bus/bus_fuel_year_control/data_miner.rb +1 -0
  56. data/lib/earth/bus/data_miner.rb +3 -6
  57. data/lib/earth/computation.rb +3 -5
  58. data/lib/earth/computation/computation_carrier.rb +1 -0
  59. data/lib/earth/computation/computation_carrier/data_miner.rb +1 -1
  60. data/lib/earth/computation/computation_carrier_instance_class.rb +1 -0
  61. data/lib/earth/computation/computation_carrier_instance_class/data_miner.rb +1 -0
  62. data/lib/earth/computation/computation_carrier_region.rb +1 -0
  63. data/lib/earth/computation/computation_carrier_region/data_miner.rb +1 -0
  64. data/lib/earth/computation/data_miner.rb +3 -5
  65. data/lib/earth/data_miner.rb +3 -13
  66. data/lib/earth/diet.rb +3 -2
  67. data/lib/earth/diet/data_miner.rb +3 -2
  68. data/lib/earth/eia.rb +11 -13
  69. data/lib/earth/fuel.rb +3 -5
  70. data/lib/earth/fuel/data_miner.rb +3 -5
  71. data/lib/earth/fuel/fuel_price.rb +1 -1
  72. data/lib/earth/hospitality.rb +3 -5
  73. data/lib/earth/hospitality/commercial_building_energy_consumption_survey_response.rb +2 -0
  74. data/lib/earth/hospitality/commercial_building_energy_consumption_survey_response/data_miner.rb +13 -7
  75. data/lib/earth/hospitality/country_lodging_class.rb +1 -0
  76. data/lib/earth/hospitality/country_lodging_class/data_miner.rb +4 -2
  77. data/lib/earth/hospitality/data_miner.rb +3 -4
  78. data/lib/earth/hospitality/lodging_class.rb +1 -10
  79. data/lib/earth/hospitality/lodging_class/data_miner.rb +7 -30
  80. data/lib/earth/hospitality/lodging_property.rb +1 -0
  81. data/lib/earth/industry.rb +3 -13
  82. data/lib/earth/industry/cbecs_energy_intensity.rb +5 -49
  83. data/lib/earth/industry/cbecs_energy_intensity/data_miner.rb +94 -42
  84. data/lib/earth/industry/data_miner.rb +3 -4
  85. data/lib/earth/industry/industry.rb +1 -0
  86. data/lib/earth/industry/industry/data_miner.rb +1 -0
  87. data/lib/earth/industry/industry_product.rb +1 -0
  88. data/lib/earth/industry/industry_product_line.rb +1 -0
  89. data/lib/earth/industry/industry_sector.rb +1 -0
  90. data/lib/earth/industry/mecs_energy.rb +3 -24
  91. data/lib/earth/industry/mecs_energy/data_miner.rb +34 -11
  92. data/lib/earth/industry/mecs_ratio.rb +6 -24
  93. data/lib/earth/industry/mecs_ratio/data_miner.rb +24 -1
  94. data/lib/earth/locality.rb +3 -15
  95. data/lib/earth/locality/census_division.rb +1 -0
  96. data/lib/earth/locality/census_division/data_miner.rb +1 -0
  97. data/lib/earth/locality/country.rb +3 -0
  98. data/lib/earth/locality/country/data_miner.rb +5 -1
  99. data/lib/earth/locality/data_miner.rb +3 -15
  100. data/lib/earth/locality/egrid_subregion.rb +1 -0
  101. data/lib/earth/locality/egrid_subregion/data_miner.rb +1 -0
  102. data/lib/earth/locality/state/data_miner.rb +11 -11
  103. data/lib/earth/locality/zip_code.rb +6 -0
  104. data/lib/earth/pet.rb +3 -4
  105. data/lib/earth/pet/data_miner.rb +3 -4
  106. data/lib/earth/rail.rb +3 -15
  107. data/lib/earth/rail/country_rail_class.rb +1 -0
  108. data/lib/earth/rail/country_rail_class/data_miner.rb +1 -0
  109. data/lib/earth/rail/country_rail_traction.rb +2 -0
  110. data/lib/earth/rail/country_rail_traction/data_miner.rb +2 -0
  111. data/lib/earth/rail/country_rail_traction_class.rb +2 -0
  112. data/lib/earth/rail/country_rail_traction_class/data_miner.rb +2 -0
  113. data/lib/earth/rail/data_miner.rb +3 -16
  114. data/lib/earth/rail/national_transit_database_company.rb +1 -0
  115. data/lib/earth/rail/national_transit_database_company/data_miner.rb +1 -0
  116. data/lib/earth/rail/national_transit_database_record.rb +1 -0
  117. data/lib/earth/rail/national_transit_database_record/data_miner.rb +1 -0
  118. data/lib/earth/rail/rail_company.rb +2 -0
  119. data/lib/earth/rail/rail_company/data_miner.rb +2 -0
  120. data/lib/earth/rail/rail_company_traction.rb +1 -0
  121. data/lib/earth/rail/rail_company_traction/data_miner.rb +1 -0
  122. data/lib/earth/rail/rail_company_traction_class.rb +1 -0
  123. data/lib/earth/rail/rail_company_traction_class/data_miner.rb +1 -0
  124. data/lib/earth/rail/rail_fuel.rb +1 -0
  125. data/lib/earth/rail/rail_fuel/data_miner.rb +1 -0
  126. data/lib/earth/residence.rb +3 -11
  127. data/lib/earth/residence/data_miner.rb +3 -11
  128. data/lib/earth/residence/residence_fuel_price.rb +1 -0
  129. data/lib/earth/residence/residence_fuel_price/data_miner.rb +1 -0
  130. data/lib/earth/residence/residential_energy_consumption_survey_response.rb +1 -0
  131. data/lib/earth/residence/residential_energy_consumption_survey_response/data_miner.rb +1 -0
  132. data/lib/earth/shipping.rb +3 -3
  133. data/lib/earth/shipping/data_miner.rb +3 -3
  134. data/lib/earth/version.rb +1 -1
  135. data/spec/earth/industry/mecs_energy_spec.rb +18 -0
  136. data/spec/earth_spec.rb +18 -29
  137. data/test/test_aircraft_match.rb +142 -142
  138. data/vendor/geokit-rails/.gitignore +2 -0
  139. data/vendor/geokit-rails/CHANGELOG.rdoc +4 -1
  140. data/vendor/geokit-rails/README.markdown +11 -3
  141. data/vendor/geokit-rails/about.yml +2 -0
  142. data/vendor/geokit-rails/lib/geokit-rails.rb +7 -4
  143. data/vendor/geokit-rails/lib/geokit-rails/acts_as_mappable.rb +15 -2
  144. data/vendor/geokit-rails/lib/geokit-rails/adapters/abstract.rb +1 -1
  145. data/vendor/geokit-rails/lib/geokit-rails/adapters/mysql2.rb +22 -0
  146. data/vendor/geokit-rails/test/database.yml +5 -0
  147. data/vendor/geokit-rails/test/ip_geocode_lookup_test.rb +1 -1
  148. data/vendor/geokit-rails/test/tasks.rake +2 -2
  149. metadata +179 -191
  150. data/lib/earth/hospitality/census_region_lodging_class.rb +0 -16
  151. data/lib/earth/hospitality/census_region_lodging_class/data_miner.rb +0 -40
@@ -1,3 +1,4 @@
1
+ require 'earth/locality'
1
2
  class Industry < ActiveRecord::Base
2
3
  set_primary_key :naics_code
3
4
 
@@ -1,3 +1,4 @@
1
+ require 'earth/locality/data_miner'
1
2
  Industry.class_eval do
2
3
  data_miner do
3
4
  import "the U.S. Census 2002 NAICS code list",
@@ -1,3 +1,4 @@
1
+ require 'earth/locality'
1
2
  class IndustryProduct < ActiveRecord::Base
2
3
  set_primary_key :naics_product_code
3
4
 
@@ -1,3 +1,4 @@
1
+ require 'earth/locality'
1
2
  class IndustryProductLine < ActiveRecord::Base
2
3
  set_primary_key :row_hash
3
4
 
@@ -1,3 +1,4 @@
1
+ require 'earth/locality'
1
2
  class IndustrySector < ActiveRecord::Base
2
3
  set_primary_key :row_hash
3
4
 
@@ -1,6 +1,8 @@
1
- require 'earth/industry/industry'
1
+ require 'earth/locality'
2
2
 
3
3
  class MecsEnergy < ActiveRecord::Base
4
+ set_primary_key :name
5
+
4
6
  col :name
5
7
  col :census_region
6
8
  col :naics_code
@@ -14,29 +16,6 @@ class MecsEnergy < ActiveRecord::Base
14
16
  col :coke_and_breeze, :type => :float
15
17
  col :other, :type => :float
16
18
 
17
- CENSUS_REGIONS = {
18
- 'Total US' => {
19
- :crop => (13..81),
20
- :code => nil
21
- },
22
- 'Northeast' => {
23
- :crop => (88..156),
24
- :code => 1
25
- },
26
- 'Midwest' => {
27
- :crop => (163..231),
28
- :code => 2
29
- },
30
- 'South' => {
31
- :crop => (238..306),
32
- :code => 3
33
- },
34
- 'West' => {
35
- :crop => (313..382),
36
- :code => 4
37
- }
38
- }
39
-
40
19
  FUELS = [:net_electricity, :residual_fuel_oil, :distillate_fuel_oil,
41
20
  :natural_gas, :lpg_and_ngl, :coal, :coke_and_breeze, :other]
42
21
 
@@ -1,28 +1,51 @@
1
1
  require 'earth/eia'
2
-
2
+ require 'earth/locality'
3
3
  MecsEnergy.class_eval do
4
+ const_set(:CENSUS_REGIONS, {
5
+ 'Total US' => {
6
+ :crop => (15..93),
7
+ :code => nil
8
+ },
9
+ 'Northeast' => {
10
+ :crop => (99..177),
11
+ :code => 1
12
+ },
13
+ 'Midwest' => {
14
+ :crop => (184..262),
15
+ :code => 2
16
+ },
17
+ 'South' => {
18
+ :crop => (267..345),
19
+ :code => 3
20
+ },
21
+ 'West' => {
22
+ :crop => (351..429),
23
+ :code => 4
24
+ }
25
+ })
26
+
4
27
  data_miner do
5
28
  MecsEnergy::CENSUS_REGIONS.each do |region, data|
6
29
  import("MECS table 3.2 #{region}",
7
30
  :url => "http://205.254.135.24/emeu/mecs/mecs2006/excel/Table3_2.xls",
8
- :crop => data[:crop]) do
31
+ :crop => data[:crop], :headers => false, :skip => 1) do
9
32
  key 'name', :synthesize => Proc.new { |row| "#{Industry.format_naics_code(row[0])}-#{data[:code]}" }
10
33
  store 'naics_code', :field_number => 0
11
34
  store :total, :field_number => 2
12
- store :net_electricity, :field_number => 3
13
- store :residual_fuel_oil, :field_number => 4
14
- store :distillate_fuel_oil, :field_number => 5
15
- store :natural_gas, :field_number => 6
16
- store :lpg_and_ngl, :field_number => 7
17
- store :coal, :field_number => 8
18
- store :coke_and_breeze, :field_number => 9
19
- store :other, :field_number => 10
35
+ store :net_electricity, :field_number => 4
36
+ store :residual_fuel_oil, :field_number => 5
37
+ store :distillate_fuel_oil, :field_number => 6
38
+ store :natural_gas, :field_number => 8
39
+ store :lpg_and_ngl, :field_number => 10
40
+ store :coal, :field_number => 12
41
+ store :coke_and_breeze, :field_number => 13
42
+ store :other, :field_number => 14
20
43
  store 'census_region', :static => data[:code]
21
44
  end
22
45
  end
23
46
 
24
47
  process :normalize_fuels do
25
- Earth::EIA.normalize(MecsEnergy, FUELS)
48
+ Earth::EIA.normalize(MecsEnergy, MecsEnergy::FUELS)
26
49
  end
27
50
  end
28
51
  end
@@ -1,33 +1,15 @@
1
+ require 'earth/locality'
2
+ require 'earth/industry/industry'
3
+
1
4
  class MecsRatio < ActiveRecord::Base
2
- belongs_to :industry
5
+ set_primary_key :name
3
6
 
4
7
  col :name
5
8
  col :census_region
6
9
  col :naics_code
7
10
  col :consumption_per_dollar_of_shipments, :type => :float
8
-
9
- CENSUS_REGIONS = {
10
- 'Total US' => {
11
- :crop => (16..94),
12
- :code => nil
13
- },
14
- 'Northeast' => {
15
- :crop => (100..178),
16
- :code => 1
17
- },
18
- 'Midwest' => {
19
- :crop => (184..262),
20
- :code => 2
21
- },
22
- 'South' => {
23
- :crop => (268..346),
24
- :code => 3
25
- },
26
- 'West' => {
27
- :crop => (352..430),
28
- :code => 4
29
- }
30
- }
11
+
12
+ belongs_to :industry
31
13
 
32
14
  def self.find_by_naics_code_and_census_region(code, census_region)
33
15
  if code.blank?
@@ -1,6 +1,29 @@
1
1
  require 'earth/eia'
2
-
2
+ require 'earth/locality/data_miner'
3
3
  MecsRatio.class_eval do
4
+ const_set(:CENSUS_REGIONS, {
5
+ 'Total US' => {
6
+ :crop => (16..94),
7
+ :code => nil
8
+ },
9
+ 'Northeast' => {
10
+ :crop => (100..178),
11
+ :code => 1
12
+ },
13
+ 'Midwest' => {
14
+ :crop => (184..262),
15
+ :code => 2
16
+ },
17
+ 'South' => {
18
+ :crop => (268..346),
19
+ :code => 3
20
+ },
21
+ 'West' => {
22
+ :crop => (352..430),
23
+ :code => 4
24
+ }
25
+ })
26
+
4
27
  data_miner do
5
28
  MecsRatio::CENSUS_REGIONS.each do |region, data|
6
29
  import( "MECS table 6.1 #{region}",
@@ -1,15 +1,3 @@
1
- require 'earth/locality/census_division'
2
- require 'earth/locality/census_region'
3
- require 'earth/locality/climate_division'
4
- require 'earth/locality/country'
5
- require 'earth/locality/egrid_country'
6
- require 'earth/locality/egrid_region'
7
- require 'earth/locality/egrid_subregion'
8
- require 'earth/locality/petroleum_administration_for_defense_district'
9
- require 'earth/locality/state'
10
- require 'earth/locality/zip_code'
11
-
12
- require 'earth/automobile' # for automobile data on Country
13
- require 'earth/fuel' # for GWPs for EgridSubregion
14
- require 'earth/hospitality' # for lodging data on Country
15
- require 'earth/rail' # for rail data on Country
1
+ # lib/earth/locality.rb
2
+ require 'earth'
3
+ Earth.require_related __FILE__
@@ -1,3 +1,4 @@
1
+ require 'earth/fuel'
1
2
  class CensusDivision < ActiveRecord::Base
2
3
  set_primary_key :number
3
4
 
@@ -1,3 +1,4 @@
1
+ require 'earth/fuel/data_miner'
1
2
  CensusDivision.class_eval do
2
3
  data_miner do
3
4
  process 'Define some unit conversions' do
@@ -1,3 +1,6 @@
1
+ require 'earth/automobile'
2
+ require 'earth/hospitality'
3
+ require 'earth/rail'
1
4
  class Country < ActiveRecord::Base
2
5
  set_primary_key :iso_3166_code
3
6
 
@@ -1,3 +1,7 @@
1
+ require 'earth/automobile/data_miner'
2
+ require 'earth/hospitality/data_miner'
3
+ require 'earth/rail/data_miner'
4
+
1
5
  Country.class_eval do
2
6
  data_miner do
3
7
  # http://www.iso.org/iso/list-en1-semic-3.txt
@@ -82,7 +86,7 @@ Country.class_eval do
82
86
 
83
87
  process "Derive average US electricity emission factor from eGRID" do
84
88
  us = united_states
85
- subregion = EgridSubregion.find_by_abbreviation 'US'
89
+ subregion = EgridSubregion.fallback
86
90
  us.electricity_emission_factor =
87
91
  (
88
92
  subregion.electricity_co2_emission_factor +
@@ -1,15 +1,3 @@
1
- require 'earth/locality/census_division/data_miner'
2
- require 'earth/locality/census_region/data_miner'
3
- require 'earth/locality/climate_division/data_miner'
4
- require 'earth/locality/country/data_miner'
5
- require 'earth/locality/egrid_country/data_miner'
6
- require 'earth/locality/egrid_region/data_miner'
7
- require 'earth/locality/egrid_subregion/data_miner'
8
- require 'earth/locality/petroleum_administration_for_defense_district/data_miner'
9
- require 'earth/locality/state/data_miner'
10
- require 'earth/locality/zip_code/data_miner'
11
-
12
- require 'earth/automobile/data_miner' # for automobile data on Country
13
- require 'earth/fuel/data_miner' # for GWPs for EgridSubregion
14
- require 'earth/hospitality/data_miner' # for lodging data on Country
15
- require 'earth/rail/data_miner' # for rail data on Country
1
+ # lib/earth/locality/data_miner.rb
2
+ require 'earth'
3
+ Earth.require_related __FILE__
@@ -1,3 +1,4 @@
1
+ require 'earth/fuel'
1
2
  class EgridSubregion < ActiveRecord::Base
2
3
  set_primary_key :abbreviation
3
4
 
@@ -1,3 +1,4 @@
1
+ require 'earth/fuel/data_miner'
1
2
  EgridSubregion.class_eval do
2
3
  data_miner do
3
4
  import "eGRID 2010 subregions and electricity emission factors",
@@ -1,21 +1,22 @@
1
1
  State.class_eval do
2
2
  data_miner do
3
- # state names, ansi codes, and postal abbreviations
3
+ # state names, FIPS codes, and postal abbreviations
4
4
  import 'the U.S. Census State ANSI Code file',
5
5
  :url => 'http://www.census.gov/geo/www/ansi/state.txt',
6
- :delimiter => '|' do
6
+ :delimiter => '|',
7
+ :select => lambda { |record| record['STATE'].to_i < 60 } do
7
8
  key 'postal_abbreviation', :field_name => 'STUSAB'
8
- store 'fips_code', :field_name => 'STATE'
9
- store 'name', :field_name => 'STATE_NAME'
9
+ store 'fips_code', :field_name => 'STATE'
10
+ store 'name', :field_name => 'STATE_NAME'
10
11
  end
11
-
12
+
12
13
  # census divisions
13
- import('the U.S. Census Geographic Terms and Definitions',
14
+ import 'state census divisions from the U.S. Census',
14
15
  :url => 'http://www.census.gov/popest/about/geo/state_geocodes_v2009.txt',
15
- :skip => 6,
16
- :headers => %w{ Region Division FIPS Name },
17
- :select => ::Proc.new { |row| row['FIPS'].to_i > 0 }) do
18
- key 'fips_code', :field_name => 'FIPS CODE STATE'
16
+ :skip => 8,
17
+ :headers => ['Region', 'Division', 'State FIPS', 'Name'],
18
+ :select => ::Proc.new { |row| row['State FIPS'].to_i > 0 } do
19
+ key 'fips_code', :field_name => 'State FIPS'
19
20
  store 'census_division_number', :field_name => 'Division'
20
21
  end
21
22
 
@@ -27,4 +28,3 @@ State.class_eval do
27
28
  end
28
29
  end
29
30
  end
30
-
@@ -1,3 +1,5 @@
1
+ require ::File.join(Earth.vendor_dir, 'geokit-rails', 'lib', 'geokit-rails')
2
+
1
3
  class ZipCode < ActiveRecord::Base
2
4
  set_primary_key :name
3
5
 
@@ -9,6 +11,10 @@ class ZipCode < ActiveRecord::Base
9
11
  Country.united_states
10
12
  end
11
13
 
14
+ def latitude_longitude
15
+ [latitude, longitude]
16
+ end
17
+
12
18
  acts_as_mappable :default_units => :kilometres,
13
19
  :lat_column_name => :latitude,
14
20
  :lng_column_name => :longitude
data/lib/earth/pet.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'earth/pet/breed'
2
- require 'earth/pet/breed_gender'
3
- require 'earth/pet/gender'
4
- require 'earth/pet/species'
1
+ # lib/earth/pet.rb
2
+ require 'earth'
3
+ Earth.require_related __FILE__
@@ -1,4 +1,3 @@
1
- require 'earth/pet/breed/data_miner'
2
- require 'earth/pet/breed_gender/data_miner'
3
- require 'earth/pet/gender/data_miner'
4
- require 'earth/pet/species/data_miner'
1
+ # lib/earth/pet/data_miner.rb
2
+ require 'earth'
3
+ Earth.require_related __FILE__
data/lib/earth/rail.rb CHANGED
@@ -1,15 +1,3 @@
1
- require 'earth/rail/country_rail_traction'
2
- require 'earth/rail/country_rail_class'
3
- require 'earth/rail/country_rail_traction_class'
4
- require 'earth/rail/rail_company'
5
- require 'earth/rail/rail_company_traction'
6
- require 'earth/rail/rail_company_traction_class'
7
- require 'earth/rail/rail_class'
8
- require 'earth/rail/rail_fuel'
9
- require 'earth/rail/rail_traction'
10
- require 'earth/rail/national_transit_database_company'
11
- require 'earth/rail/national_transit_database_mode'
12
- require 'earth/rail/national_transit_database_record'
13
-
14
- require 'earth/fuel'
15
- require 'earth/locality' # eGRID needed for US electricity emission factor in RailCompany import
1
+ # lib/earth/rail.rb
2
+ require 'earth'
3
+ Earth.require_related __FILE__
@@ -1,3 +1,4 @@
1
+ require 'earth/locality'
1
2
  class CountryRailClass < ActiveRecord::Base
2
3
  set_primary_key :name
3
4
 
@@ -1,3 +1,4 @@
1
+ require 'earth/locality/data_miner'
1
2
  CountryRailClass.class_eval do
2
3
  data_miner do
3
4
  import "a list of country-specific rail classes and their pre-calculated characteristics",
@@ -1,3 +1,5 @@
1
+ require 'earth/fuel'
2
+ require 'earth/locality'
1
3
  class CountryRailTraction < ActiveRecord::Base
2
4
  set_primary_key :name
3
5
 
@@ -1,3 +1,5 @@
1
+ require 'earth/fuel/data_miner'
2
+ require 'earth/locality/data_miner'
1
3
  CountryRailTraction.class_eval do
2
4
  data_miner do
3
5
  import "european rail traction data from the UIC",
@@ -1,3 +1,5 @@
1
+ require 'earth/fuel'
2
+ require 'earth/locality'
1
3
  class CountryRailTractionClass < ActiveRecord::Base
2
4
  set_primary_key :name
3
5
 
@@ -1,3 +1,5 @@
1
+ require 'earth/fuel/data_miner'
2
+ require 'earth/locality/data_miner'
1
3
  CountryRailTractionClass.class_eval do
2
4
  data_miner do
3
5
  import "european rail traction class data from the UIC",
@@ -1,16 +1,3 @@
1
- require 'earth/rail/country_rail_traction/data_miner'
2
- require 'earth/rail/country_rail_class/data_miner'
3
- require 'earth/rail/country_rail_traction_class/data_miner'
4
- require 'earth/rail/rail_class/data_miner'
5
- require 'earth/rail/rail_company/data_miner'
6
- require 'earth/rail/rail_company_traction/data_miner'
7
- require 'earth/rail/rail_company_traction_class/data_miner'
8
- require 'earth/rail/rail_class/data_miner'
9
- require 'earth/rail/rail_fuel/data_miner'
10
- require 'earth/rail/rail_traction/data_miner'
11
- require 'earth/rail/national_transit_database_company/data_miner'
12
- require 'earth/rail/national_transit_database_mode/data_miner'
13
- require 'earth/rail/national_transit_database_record/data_miner'
14
-
15
- require 'earth/fuel/data_miner'
16
- require 'earth/locality/data_miner' # eGRID needed for US electricity emission factor in RailCompany import
1
+ # lib/earth/rail/data_miner.rb
2
+ require 'earth'
3
+ Earth.require_related __FILE__