earth 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/Rakefile +0 -3
- data/TODO +1 -1
- data/ar17.html +2093 -0
- data/data/air/aircraft.csv +7 -0
- data/data/air/airports.csv +1 -0
- data/earth.gemspec +4 -3
- data/errata/airline/bts_carrier_codes_errata.csv +74 -10
- data/errata/airport/openflights_errata.csv +7 -0
- data/errata/flight_segment/bts_errata.csv +1 -0
- data/lib/earth/air/aircraft.rb +1 -1
- data/lib/earth/air/aircraft/data_miner.rb +1 -1
- data/lib/earth/air/airline.rb +1 -1
- data/lib/earth/air/airline/data_miner.rb +6 -10
- data/lib/earth/air/airport.rb +6 -6
- data/lib/earth/air/bts_aircraft.rb +1 -1
- data/lib/earth/air/flight_segment.rb +1 -1
- data/lib/earth/automobile/automobile_activity_year_type.rb +1 -1
- data/lib/earth/automobile/automobile_activity_year_type_fuel/data_miner.rb +3 -3
- data/lib/earth/automobile/automobile_make_model_year_variant.rb +2 -2
- data/lib/earth/automobile/automobile_make_model_year_variant/data_miner.rb +1 -1
- data/lib/earth/automobile/automobile_type_fuel_year.rb +1 -1
- data/lib/earth/automobile/automobile_type_fuel_year/data_miner.rb +2 -2
- data/lib/earth/automobile/automobile_type_fuel_year_control.rb +1 -1
- data/lib/earth/insolation_scopes.rb +10 -0
- data/lib/earth/loader.rb +0 -7
- data/lib/earth/locality/climate_division.rb +3 -3
- data/lib/earth/locality/climate_division_month.rb +28 -0
- data/lib/earth/locality/climate_division_month/data_miner.rb +140 -0
- data/lib/earth/locality/direct_normal_insolation.rb +37 -0
- data/lib/earth/locality/direct_normal_insolation/data_miner.rb +41 -0
- data/lib/earth/locality/egrid_subregion.rb +4 -1
- data/lib/earth/locality/electricity_mix.rb +9 -1
- data/lib/earth/locality/global_horizontal_insolation.rb +37 -0
- data/lib/earth/locality/global_horizontal_insolation/data_miner.rb +41 -0
- data/lib/earth/locality/photovoltaic_insolation.rb +37 -0
- data/lib/earth/locality/photovoltaic_insolation/data_miner.rb +41 -0
- data/lib/earth/locality/zip_code.rb +9 -15
- data/lib/earth/residence/residence_fuel_price.rb +1 -1
- data/lib/earth/tasks.rb +5 -0
- data/lib/earth/version.rb +1 -1
- data/spec/data_mining_spec.rb +1 -1
- data/spec/earth/air/aircraft_spec.rb +2 -2
- data/spec/earth/air/airline_spec.rb +1 -1
- data/spec/earth/air/airport_spec.rb +1 -1
- data/spec/earth/air/bts_aircraft_spec.rb +1 -1
- data/spec/earth/air/flight_segment_spec.rb +19 -21
- data/spec/earth/automobile/automobile_make_model_year_variant_spec.rb +1 -1
- data/spec/earth/locality/climate_division_month_spec.rb +23 -0
- data/spec/earth/locality/direct_normal_insolation_spec.rb +8 -0
- data/spec/earth/locality/global_horizontal_insolation_spec.rb +8 -0
- data/spec/earth/locality/photovoltaic_insolation_spec.rb +8 -0
- data/spec/earth/locality/zip_code_spec.rb +1 -10
- data/spec/earth_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +261 -410
- data/data/air/airlines.csv +0 -45
- data/vendor/geokit-rails/.gitignore +0 -2
- data/vendor/geokit-rails/CHANGELOG.rdoc +0 -49
- data/vendor/geokit-rails/MIT-LICENSE +0 -20
- data/vendor/geokit-rails/README.markdown +0 -569
- data/vendor/geokit-rails/Rakefile +0 -18
- data/vendor/geokit-rails/about.yml +0 -11
- data/vendor/geokit-rails/assets/api_keys_template +0 -61
- data/vendor/geokit-rails/init.rb +0 -2
- data/vendor/geokit-rails/install.rb +0 -14
- data/vendor/geokit-rails/lib/geokit-rails.rb +0 -28
- data/vendor/geokit-rails/lib/geokit-rails/acts_as_mappable.rb +0 -469
- data/vendor/geokit-rails/lib/geokit-rails/adapters/abstract.rb +0 -31
- data/vendor/geokit-rails/lib/geokit-rails/adapters/mysql.rb +0 -22
- data/vendor/geokit-rails/lib/geokit-rails/adapters/mysql2.rb +0 -22
- data/vendor/geokit-rails/lib/geokit-rails/adapters/postgresql.rb +0 -22
- data/vendor/geokit-rails/lib/geokit-rails/adapters/sqlserver.rb +0 -43
- data/vendor/geokit-rails/lib/geokit-rails/defaults.rb +0 -22
- data/vendor/geokit-rails/lib/geokit-rails/geocoder_control.rb +0 -16
- data/vendor/geokit-rails/lib/geokit-rails/ip_geocode_lookup.rb +0 -46
- data/vendor/geokit-rails/test/acts_as_mappable_test.rb +0 -474
- data/vendor/geokit-rails/test/boot.rb +0 -25
- data/vendor/geokit-rails/test/database.yml +0 -25
- data/vendor/geokit-rails/test/fixtures/companies.yml +0 -7
- data/vendor/geokit-rails/test/fixtures/custom_locations.yml +0 -54
- data/vendor/geokit-rails/test/fixtures/locations.yml +0 -54
- data/vendor/geokit-rails/test/fixtures/mock_addresses.yml +0 -17
- data/vendor/geokit-rails/test/fixtures/mock_families.yml +0 -2
- data/vendor/geokit-rails/test/fixtures/mock_houses.yml +0 -9
- data/vendor/geokit-rails/test/fixtures/mock_organizations.yml +0 -5
- data/vendor/geokit-rails/test/fixtures/mock_people.yml +0 -5
- data/vendor/geokit-rails/test/fixtures/stores.yml +0 -0
- data/vendor/geokit-rails/test/ip_geocode_lookup_test.rb +0 -77
- data/vendor/geokit-rails/test/models/company.rb +0 -3
- data/vendor/geokit-rails/test/models/custom_location.rb +0 -12
- data/vendor/geokit-rails/test/models/location.rb +0 -4
- data/vendor/geokit-rails/test/models/mock_address.rb +0 -4
- data/vendor/geokit-rails/test/models/mock_family.rb +0 -3
- data/vendor/geokit-rails/test/models/mock_house.rb +0 -3
- data/vendor/geokit-rails/test/models/mock_organization.rb +0 -4
- data/vendor/geokit-rails/test/models/mock_person.rb +0 -4
- data/vendor/geokit-rails/test/models/store.rb +0 -3
- data/vendor/geokit-rails/test/schema.rb +0 -60
- data/vendor/geokit-rails/test/tasks.rake +0 -31
- data/vendor/geokit-rails/test/test_helper.rb +0 -23
@@ -0,0 +1,7 @@
|
|
1
|
+
icao_code,manufacturer_name,model_name,aircraft_type,engine_type,engines,weight_class,source,
|
2
|
+
A388,AIRBUS,A380-800,Landplane,Jet,4,Heavy,Brighter Planet
|
3
|
+
B77L,BOEING,777-200LR,Landplane,Jet,2,Heavy,Brighter Planet
|
4
|
+
B788,BOEING,787-800,Landplane,Jet,2,Heavy,Brighter Planet
|
5
|
+
C130,LOCKHEED,L-100 Hercules,Landplane,Turboprop,4,Medium,Brighter Planet
|
6
|
+
FA7X,DASSAULT,Falcon 7X,Landplane,Jet,3,Medium,Brighter Planet
|
7
|
+
G150,GULFSTREAM AEROSPACE,Gulfstream G150,Landplane,Jet,2,Medium,Brighter Planet
|
data/data/air/airports.csv
CHANGED
@@ -9,3 +9,4 @@ AMO,Mao,Mao,Chad,8.248,16.663,Brighter Planet
|
|
9
9
|
BTZ,Bursa,Bursa,Turkey,40.234,29.01,Brighter Planet
|
10
10
|
NBC,Naberevnye Chelny,Naberevnye Chelny,Russian Federation,55.564,52.103,Brighter Planet
|
11
11
|
QUG,Chichester/Goodwood,Chichester,United Kingdom,50.859,-0.759,Brighter Planet
|
12
|
+
MAY,Clarence A. Bain,Mangrove Cay,Bahamas,24.287664,-77.684613,Great Circle Mapper
|
data/earth.gemspec
CHANGED
@@ -24,17 +24,18 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_runtime_dependency 'falls_back_on'
|
25
25
|
s.add_runtime_dependency 'fixed_width-multibyte'
|
26
26
|
s.add_runtime_dependency 'fuzzy_match', '>=1.3.3'
|
27
|
-
s.add_runtime_dependency '
|
28
|
-
s.add_runtime_dependency 'remote_table', '>=2.0.2'
|
27
|
+
s.add_runtime_dependency 'remote_table', '>=2.1.0'
|
29
28
|
s.add_runtime_dependency 'table_warnings', '>=1.0.1'
|
30
29
|
s.add_runtime_dependency 'to_regexp'
|
31
30
|
s.add_runtime_dependency 'weighted_average', '>=1.0.2'
|
32
31
|
s.add_runtime_dependency 'timeframe'
|
33
|
-
s.
|
32
|
+
s.add_runtime_dependency 'geocoder'
|
34
33
|
s.add_development_dependency 'bundler'
|
35
34
|
s.add_development_dependency 'charisma'
|
36
35
|
s.add_development_dependency 'cucumber'
|
36
|
+
s.add_development_dependency 'dbf'
|
37
37
|
s.add_development_dependency 'factory_girl'
|
38
|
+
s.add_development_dependency 'georuby'
|
38
39
|
s.add_development_dependency 'mysql2' # for bin/earth_tester.rb; use mysql2 for utf-8 compatibility
|
39
40
|
s.add_development_dependency 'pg'
|
40
41
|
s.add_development_dependency 'rake'
|
@@ -1,46 +1,110 @@
|
|
1
1
|
date,name,email,type,section,action,x,y,condition,notes
|
2
2
|
5/15/12,Ian Hough,ian@brighterplanet.com,meta,Intended use,,http://www.transtats.bts.gov/Download_Lookup.asp?Lookup=L_UNIQUE_CARRIERS,,,
|
3
|
+
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Code,reject,0YQ,,,duplicate name; not the code we have flights for
|
4
|
+
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Code,reject,FDM,,,duplicate name; not the code we have flights for
|
5
|
+
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Code,reject,ISL,,,duplicate name; not the code we have flights for
|
6
|
+
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Code,reject,IS,,,duplicate name; not the code we have flights for
|
7
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Code,reject,4C,,,now LAN Colombia
|
3
8
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,.,,,
|
4
9
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,",",,,
|
10
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,(
|
11
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,)
|
5
12
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ ca$/i,,,
|
6
13
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ co(rp)?(oration)?$/i,,,
|
14
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,/ co /i, ,,
|
7
15
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete, GmbH,,,
|
8
16
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ inc(orporated)?/i,,,
|
9
17
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ llc/i,,,
|
10
18
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ l(imi)?te?d/i,,,
|
11
19
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ lt$/i,,,
|
20
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ ltd$/i,,,
|
21
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,/ ltd /i, ,,
|
22
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ nv$/i,,,
|
12
23
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ plc( and)?/i,,,
|
24
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ pty$/i,,,
|
13
25
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ sa( de cv)?$/i,,,
|
14
26
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ sa de cv/i,,,
|
15
27
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ s a( aerogal)?$/i,,,
|
16
28
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ spa$/i,,,
|
17
|
-
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/
|
29
|
+
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete,/ merged with.+/i,,,
|
18
30
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,delete, and Everts Air Cargo,,,
|
19
31
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,/internat'l/i,international,,
|
32
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,/.+/i,Atlantic Southeast Airlines,bts EV,match name for ICAO/IATA codes
|
33
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,/.+/i,ExpressJet,bts XE,match name for ICAO/IATA codes
|
34
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,/.+/i,SkyWest Airlines USA,bts OO,match name for ICAO/IATA codes
|
20
35
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,AAA-Action Air Carrier,Action Air Carrier,,
|
36
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,ABC Aerolineas dba Interjet,Interjet,,match name for ICAO/IATA codes
|
21
37
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,ABSA-Aerolinhas Brasileiras,ABSA Cargo|Aerolineas Brasileiras,,match name for ICAO/IATA codes
|
38
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Aeroenlaces Nacionales,vivaAerobus,,match name for ICAO/IATA codes
|
39
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Aerolineas Galapagos,Aerogal,,match name for ICAO/IATA codes
|
40
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Aerolitoral,Aeromexico Connect,,match name for ICAO/IATA codes
|
22
41
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Aeropostal Alas De Venezuel,Aeropostal Alas de Venezuela,,match name for ICAO/IATA codes
|
23
42
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Aerovias Nac'l De Colombia,Avianca|Aerovias Nacionales de Colombia,,
|
24
43
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Aerovias Venezolanas-Avensa,Avensa|Aerovias Venezolanas,,
|
25
44
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Aerosvit Ukranian Airlines,Aerosvit Airlines,,
|
26
|
-
|
45
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Air North,Air North Airlines,,match name for ICAO/IATA codes
|
46
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Air Wisconsin Airlines,Air Wisconsin,,match name for ICAO/IATA codes
|
47
|
+
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Alia-The Royal Jordanian,Royal Jordanian|Alia,,
|
48
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Arik Air International,Arik Air,,match name for ICAO/IATA codes
|
27
49
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Arrow Air,Arrow Cargo,,match name for ICAO/IATA codes
|
50
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Bahamasair Holding,Bahamasair,,match name for ICAO/IATA codes
|
51
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Bemidji Airlines,Bemidji Aviation,,match name for ICAO/IATA codes
|
52
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,British Midland Airways,British Midland International,,match name for ICAO/IATA codes
|
53
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Britannia Airways,Thomson Airways,,match name for ICAO/IATA codes
|
54
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Cargolux Airlines International,Cargolux,,match name for ICAO/IATA codes
|
55
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Casino Express,Xtra Airways,,match name for ICAO/IATA codes
|
56
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Cielos De Peru,Cielos Airlines,,match name for ICAO/IATA codes
|
57
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Compagnia Aerea Italiana,Alitalia,,match name for ICAO/IATA codes
|
58
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Compagnie Nat'l Air France,Air France,,match name for ICAO/IATA codes
|
59
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Compania Panamena Copa,COPA Airlines,,match name for ICAO/IATA codes
|
60
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Concesionaria Vuela Compania De Aviacion Volaris,Volaris,,match name for ICAO/IATA codes
|
28
61
|
6/22/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Continental Air Lines,Continental Airlines,,typo
|
62
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Corsair International,Corsairfly,,match name for ICAO/IATA codes
|
29
63
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,China Cargo Airline,China Cargo Airlines,,match name for ICAO/IATA codes
|
64
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Eva Airways,Eva Air,,match name for ICAO/IATA codes
|
30
65
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Federal Express,FedEx,,match name for ICAO/IATA codes
|
31
|
-
|
66
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Finnair Oy,Finnair,,match name for ICAO/IATA codes
|
67
|
+
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,/Grand Canyon Airlines.+Scenic Airlines/i,Scenic Airways|Grand Canyon Airlines,,
|
68
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Great Lakes Airlines,Great Lakes Aviation,,match name for ICAO/IATA codes
|
32
69
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Great Wall Airlines Company,Great Wall Airlines,,
|
33
|
-
|
70
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Gulfstream Int,Gulfstream International Airlines,,match name for ICAO/IATA codes
|
71
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Hainan Airlines Company,Hainan Airlines,,match name for ICAO/IATA codes
|
72
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Iberia Air Lines Of Spain,Iberia,,match name for ICAO/IATA codes
|
73
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Insel Air International B V,Insel Air,,match name for ICAO/IATA codes
|
74
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Japan Air Lines,Japan Airlines International,,match name for ICAO/IATA codes
|
75
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Jazz Aviation LP,Jazz Air,,match name for ICAO/IATA codes
|
76
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Korean Air Lines,Korean Air,,match name for ICAO/IATA codes
|
77
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Lan-Chile Airlines,LAN Airlines,,match name for ICAO/IATA codes
|
78
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Lan Peru Airlines,Lan Peru,,match name for ICAO/IATA codes
|
79
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Lufthansa German Airlines,Lufthansa,,match name for ICAO/IATA codes
|
80
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Malaysian Airline System,Malaysia Airlines,,match name for ICAO/IATA codes
|
81
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Meridiana,Meridiana Fly,,match name for ICAO/IATA codes
|
82
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,National Aviation Company of India,Air India,,match name for ICAO/IATA codes
|
34
83
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Nippon Cargo Airlines,NCA|Nippon Cargo Airlines,,
|
84
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Olympic Airways,Olympic Air,,match name for ICAO/IATA codes
|
85
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Pakistan International Airlines,PIA,,match name for ICAO/IATA codes
|
86
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Pan American World Airways Dominicana,PAWA Dominicana,,match name for ICAO/IATA codes
|
87
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Peninsula Airways,Penair,,match name for ICAO/IATA codes
|
35
88
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Polar Air Cargo Airways,Polar Air Cargo,,
|
89
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Polskie Linie Lotnicze,LOT Polish Airlines,,match name for ICAO/IATA codes
|
90
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Qantas Airways,QANTAS,,match name for ICAO/IATA codes
|
91
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Qatar Airways QCSC,Qatar Airways,,match name for ICAO/IATA codes
|
92
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Santa Barbara Airlines,SBA Airlines,,match name for ICAO/IATA codes
|
93
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Sata Internacional,SATA International,,match name for ICAO/IATA codes
|
94
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Scandinavian Airlines Sys,SAS,,match name for ICAO/IATA codes
|
36
95
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Sociedad Aeronautica De Med,SAM|Sociedad Aeronautica De Medellin,,
|
96
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Spirit Air Lines,Spirit Airlines,,match name for ICAO/IATA codes
|
97
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Swiss International Airlines,Swiss,,match name for ICAO/IATA codes
|
98
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Tap-Portuguese Airlines,TAP Portugal,,match name for ICAO/IATA codes
|
99
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Transportes Aereos De Cabo,TACV Cabo Verde Airlines,,match name for ICAO/IATA codes
|
100
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Transportes Aeros Meridiona,TAM Linhas Aereas,,match name for ICAO/IATA codes
|
101
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,TUI Airlines Belgium NV d/b/a Jetairfly,Jetairfly,,match name for ICAO/IATA codes
|
102
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,TUI Airlines Nederland BV,Arkefly,,match name for ICAO/IATA codes
|
103
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Turk Hava Yollari AO,Turkish Airlines,,match name for ICAO/IATA codes
|
37
104
|
6/22/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,United Air Lines,United Airlines,,typo
|
105
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,USA 3000 Airlines,USA 3000,,match name for ICAO/IATA codes
|
38
106
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Varig Logistica S/A,VarigLog,,
|
107
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Virgin Blue International Airlines t/a V Australia,Virgin Australia,,match name for ICAO/IATA codes
|
108
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Warbelow,Warbelows Air,,match name for ICAO/IATA codes
|
39
109
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,Yangtze River Express Airlines Company,Yangtze River Express,,
|
40
110
|
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,replace,/ d\/b\/a /i,|,,
|
41
|
-
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,reject,/\(1\)/,,not expressjet,
|
42
|
-
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Description,reject,/\(2\)/,,,
|
43
|
-
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Code,reject,0YQ,,,duplicate name; not the code we have flights for
|
44
|
-
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Code,reject,FDM,,,duplicate name; not the code we have flights for
|
45
|
-
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Code,reject,ISL,,,duplicate name; not the code we have flights for
|
46
|
-
5/15/12,Ian Hough,ian@brighterplanet.com,editorial,Code,reject,IS,,,duplicate name; not the code we have flights for
|
@@ -271,6 +271,8 @@ date,name,email,type,section,action,x,y,condition,notes
|
|
271
271
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,longitude,replace,/.+/,-112.457,iata is dvt,wrong lng
|
272
272
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,latitude,replace,/.+/,28.398,iata is dws,wrong lat/lng
|
273
273
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,longitude,replace,/.+/,-81.57,iata is dws,wrong lat/lng
|
274
|
+
9/11/12,Ian Hough,ian@brighterplanet.com,technical,name,replace,/^Dayong$/,Zhangjiajie,iata is dyg,fix name
|
275
|
+
9/11/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Dayong$/,Zhangjiajie,iata is dyg,fix city
|
274
276
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/.+/,Basel,iata is eap,bsl/eap/mlh is one airport with three codes
|
275
277
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,country_name,replace,/.+/,Switzerland,iata is eap,bsl/eap/mlh is one airport with three codes
|
276
278
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,name,replace,/.+/,EuroAirport Basel-Mulhouse-Freiburg,iata is eap,bsl/eap/mlh is one airport with three codes
|
@@ -286,6 +288,7 @@ date,name,email,type,section,action,x,y,condition,notes
|
|
286
288
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Elat$/i,Eilat,iata is eth,fix city
|
287
289
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Harstad/Narvik$/i,Evenes,iata is eve,fix city
|
288
290
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,name,replace,/^Evenes$/i,Harstad/Narvik,iata is eve,fix name
|
291
|
+
9/11/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Lubumashi$/i,Lubumbashi,iata is fbm,fix city
|
289
292
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,latitude,replace,/.+/,61.392,iata is fde,wrong lat/lng
|
290
293
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,longitude,replace,/.+/,5.763,iata is fde,wrong lat/lng
|
291
294
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Fez$/i,Fes,iata is fez,fix city
|
@@ -299,6 +302,7 @@ date,name,email,type,section,action,x,y,condition,notes
|
|
299
302
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,name,replace,/^Tolagnaro$/i,Taolagnaro,iata is ftu,fix name
|
300
303
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Governor's Harbor$/i,Governors Harbour,iata is ghb,fix city
|
301
304
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,,La Gomera,iata is gmz,fix city
|
305
|
+
9/11/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Gaberone$/i,Gaborone,iata is gbe,fix city
|
302
306
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Gerona$/i,Girona,iata is gro,fix city
|
303
307
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,latitude,replace,/.+/,52.475,iata is gww,wrong lat/lng
|
304
308
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,longitude,replace,/.+/,13.139,iata is gww,wrong lat/lng
|
@@ -314,6 +318,8 @@ date,name,email,type,section,action,x,y,condition,notes
|
|
314
318
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Wheeler Afb\.$/i,Wahiawa,iata is hhi,fix city
|
315
319
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Hassi-messaoud$/i,Hassi Messaoud,iata is hme,fix city
|
316
320
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Bahias Dehuatulco$/i,Huatulco,iata is hux,fix city
|
321
|
+
9/11/12,Ian Hough,ian@brighterplanet.com,technical,name,replace,/^Hyakuri$/i,Ibaraki,iata is ibr,fix city
|
322
|
+
9/11/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Ibaraki$/i,Omitama,iata is ibr,fix city
|
317
323
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Isfahan$/i,Esfahan,iata is ifn,fix city
|
318
324
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,latitude,replace,/.+/,35.416111,iata is ika,wrong lat/lng
|
319
325
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,longitude,replace,/.+/,51.152222,iata is ika,wrong lat/lng
|
@@ -340,6 +346,7 @@ date,name,email,type,section,action,x,y,condition,notes
|
|
340
346
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Paraguana$/i,Punto Fijo,iata is lsp,fix city
|
341
347
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,latitude,replace,/.+/,-0.906833,iata is ltx,wrong lat/lng
|
342
348
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,longitude,replace,/.+/,-78.615756,iata is ltx,wrong lat/lng
|
349
|
+
9/11/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Luxi$/i,Dehong,iata is lum,fix city
|
343
350
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Luxemburg$/i,Luxembourg,iata is lux,fix city
|
344
351
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,city,replace,/^Madras$/i,Chennai,iata is maa,fix city
|
345
352
|
3/29/12,Ian Hough,ian@brighterplanet.com,technical,latitude,replace,/.+/,36.234,iata is mhd,wrong lat/lng
|
@@ -2,6 +2,7 @@ date,name,email,type,section,action,x,y,condition,notes
|
|
2
2
|
6/7/11,Ian Hough,ian@brighterplanet.com,meta,Intended use,,http://www.transtats.bts.gov/DL_SelectFields.asp?Table_ID=293
|
3
3
|
6/7/11,Ian Hough,ian@brighterplanet.com,technical,UNIQUE_CARRIER,replace,/^$/i,0OQ,in may 2009,unique carrier code for OpenSkies is missing in May 2009
|
4
4
|
6/7/11,Ian Hough,ian@brighterplanet.com,technical,UNIQUE_CARRIER,replace,/^$/i,0OQ,in july 2009,unique carrier code for OpenSkies is missing in July 2009
|
5
|
+
9/12/12,Ian Hough,ian@brighterplanet.com,technical,UNIQUE_CARRIER,replace,/^4C$/,L7,,now LAN Colombia
|
5
6
|
8/6/12,Ian Hough,ian@brighterplanet.com,technical,ORIGIN_COUNTRY,replace,/^an$/i,CW,origin iata CUR,deal with netherlands antilles
|
6
7
|
8/6/12,Ian Hough,ian@brighterplanet.com,technical,ORIGIN_COUNTRY,replace,/^an$/i,NL,origin iata BON,deal with netherlands antilles
|
7
8
|
8/6/12,Ian Hough,ian@brighterplanet.com,technical,ORIGIN_COUNTRY,replace,/^an$/i,SX,origin iata SXM,deal with netherlands antilles
|
data/lib/earth/air/aircraft.rb
CHANGED
@@ -41,7 +41,7 @@ Aircraft.class_eval do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
import "aircraft not included in the FAA database",
|
44
|
-
:url =>
|
44
|
+
:url => "file:///#{Earth::DATA_DIR}/air/aircraft.csv" do
|
45
45
|
key 'icao_code'
|
46
46
|
store 'manufacturer_name'
|
47
47
|
store 'model_name'
|
data/lib/earth/air/airline.rb
CHANGED
@@ -24,5 +24,5 @@ EOS
|
|
24
24
|
:primary_key => :bts_code,
|
25
25
|
:foreign_key => :airline_bts_code
|
26
26
|
|
27
|
-
warn_unless_size
|
27
|
+
warn_unless_size 1519 # this is overridden in data1, which imports extra airlines from proprietary data
|
28
28
|
end
|
@@ -1,8 +1,12 @@
|
|
1
1
|
Airline.class_eval do
|
2
2
|
# for errata
|
3
3
|
class Airline::Guru
|
4
|
-
def
|
5
|
-
|
4
|
+
def method_missing(method_id, *args, &block)
|
5
|
+
if method_id.to_s =~ /\A(bts)_([^\?]+)/
|
6
|
+
args.first['Code'].downcase == $2 # row['Code'] == 'EV'
|
7
|
+
else
|
8
|
+
super
|
9
|
+
end
|
6
10
|
end
|
7
11
|
end
|
8
12
|
|
@@ -14,13 +18,5 @@ Airline.class_eval do
|
|
14
18
|
store 'secondary_name', :synthesize => proc { |row| row['Description'].split("|")[1] }
|
15
19
|
store 'bts_code', :field_name => 'Code'
|
16
20
|
end
|
17
|
-
|
18
|
-
import "a Brighter Planet-curated list of airlines and codes not included in our proprietary sources",
|
19
|
-
:url => "#{Earth::DATA_DIR}/air/airlines.csv" do
|
20
|
-
key 'name'
|
21
|
-
store 'secondary_name', :nullify => true
|
22
|
-
store 'iata_code', :nullify => true
|
23
|
-
store 'icao_code', :nullify => true
|
24
|
-
end
|
25
21
|
end
|
26
22
|
end
|
data/lib/earth/air/airport.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'earth/model'
|
2
2
|
require 'earth/loader'
|
3
|
-
Earth::Loader.load_plugins
|
4
3
|
|
5
4
|
require 'earth/locality/country'
|
6
5
|
require 'earth/air/flight_segment'
|
7
6
|
|
7
|
+
require 'geocoder'
|
8
|
+
|
8
9
|
class Airport < ActiveRecord::Base
|
9
10
|
extend Earth::Model
|
11
|
+
extend Geocoder::Model::ActiveRecord
|
10
12
|
|
11
13
|
TABLE_STRUCTURE = <<-EOS
|
12
14
|
|
@@ -34,10 +36,8 @@ EOS
|
|
34
36
|
has_many :arriving_flight_segments, # FIXME TODO consider replacing with a method that also matches ICAO segments by city
|
35
37
|
:class_name => 'FlightSegment',
|
36
38
|
:foreign_key => :destination_airport_iata_code
|
39
|
+
|
40
|
+
reverse_geocoded_by :latitude, :longitude
|
37
41
|
|
38
|
-
|
39
|
-
:lat_column_name => :latitude,
|
40
|
-
:lng_column_name => :longitude
|
41
|
-
|
42
|
-
warn_unless_size 5324
|
42
|
+
warn_unless_size 5325
|
43
43
|
end
|
@@ -24,7 +24,7 @@ EOS
|
|
24
24
|
|
25
25
|
# Used by Automobile and AutomobileTrip
|
26
26
|
def self.find_by_type_name_and_closest_year(type_name, year)
|
27
|
-
candidates = where(:type_name => type_name)
|
27
|
+
return if (candidates = where(:type_name => type_name)).none?
|
28
28
|
if year > (max_year = candidates.maximum(:activity_year))
|
29
29
|
candidates.where(:activity_year => max_year).first
|
30
30
|
else
|
@@ -2,7 +2,7 @@ AutomobileActivityYearTypeFuel.class_eval do
|
|
2
2
|
data_miner do
|
3
3
|
['Passenger cars', 'Light-duty trucks'].each do |type|
|
4
4
|
import "annual vehicle miles travelled by gasoline #{type.downcase} from the 2011 EPA GHG Inventory",
|
5
|
-
:url => 'http://www.epa.gov/climatechange/
|
5
|
+
:url => 'http://www.epa.gov/climatechange/Downloads/ghgemissions/2011-Annex-Tables.zip',
|
6
6
|
:filename => 'Annex Tables/Table A-89.csv',
|
7
7
|
:skip => 1,
|
8
8
|
:headers => ['Year', 'Passenger cars', 'Light-duty trucks', 'ignore', 'ignore'],
|
@@ -15,7 +15,7 @@ AutomobileActivityYearTypeFuel.class_eval do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
import "annual vehicle miles travelled by diesel #{type.downcase} from the 2011 EPA GHG Inventory",
|
18
|
-
:url => 'http://www.epa.gov/climatechange/
|
18
|
+
:url => 'http://www.epa.gov/climatechange/Downloads/ghgemissions/2011-Annex-Tables.zip',
|
19
19
|
:filename => 'Annex Tables/Table A-90.csv',
|
20
20
|
:skip => 1,
|
21
21
|
:headers => ['Year', 'Passenger cars', 'Light-duty trucks', 'ignore', 'ignore'],
|
@@ -28,7 +28,7 @@ AutomobileActivityYearTypeFuel.class_eval do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
import "annual vehicle miles travelled by alternative fuel #{type.downcase} from the 2011 EPA GHG Inventory",
|
31
|
-
:url => 'http://www.epa.gov/climatechange/
|
31
|
+
:url => 'http://www.epa.gov/climatechange/Downloads/ghgemissions/2011-Annex-Tables.zip',
|
32
32
|
:filename => 'Annex Tables/Table A-91.csv',
|
33
33
|
:skip => 1,
|
34
34
|
:headers => ['Year', 'Passenger cars', 'Light-duty trucks', 'ignore', 'ignore'],
|
@@ -51,7 +51,7 @@ EOS
|
|
51
51
|
# because it will be a bunch of work to include all the columns and the names will be really long and obtuse
|
52
52
|
# -Ian 10/18/2011
|
53
53
|
|
54
|
-
warn_unless_size
|
54
|
+
warn_unless_size 28427
|
55
55
|
warn_unless_size 1152, :conditions => { :year => 1985 }
|
56
56
|
warn_unless_size 1183, :conditions => { :year => 1986 }
|
57
57
|
warn_unless_size 1206, :conditions => { :year => 1987 }
|
@@ -79,7 +79,7 @@ EOS
|
|
79
79
|
warn_unless_size 1092, :conditions => { :year => 2009 }
|
80
80
|
warn_unless_size 1107, :conditions => { :year => 2010 }
|
81
81
|
warn_unless_size 1097, :conditions => { :year => 2011 }
|
82
|
-
warn_unless_size
|
82
|
+
warn_unless_size 1123, :conditions => { :year => 2012 }
|
83
83
|
warn_if_nulls_except(
|
84
84
|
:alt_fuel_code,
|
85
85
|
:cylinders
|
@@ -110,7 +110,7 @@ AutomobileMakeModelYearVariant.class_eval do
|
|
110
110
|
2009 => { :url => 'http://www.fueleconomy.gov/FEG/epadata/09data.zip', :filename => '2009_FE_guide for DOE_ALL-rel dates-no-sales-8-28-08download.csv' },
|
111
111
|
2010 => { :url => 'http://www.fueleconomy.gov/FEG/epadata/10data.zip', :filename => '2010FEGuide for DOE-all rel dates-no-sales-02-22-2011public.xlsx' },
|
112
112
|
2011 => { :url => 'http://www.fueleconomy.gov/FEG/epadata/11data.zip', :filename => '2011FEGuide-for DOE rel-dates before 1-23-2011-no-sales-01-10-2011_All_public.xlsx' },
|
113
|
-
2012 => { :url => 'http://www.fueleconomy.gov/feg/epadata/12data.zip', :filename => '2012 FEGuide for DOE-
|
113
|
+
2012 => { :url => 'http://www.fueleconomy.gov/feg/epadata/12data.zip', :filename => '2012 FEGuide for DOE-rev99-rel dates before 3-13-2012-no-sales_public.xlsx' }
|
114
114
|
})
|
115
115
|
|
116
116
|
fuel_economy_guides.each do |year, options|
|
@@ -28,7 +28,7 @@ EOS
|
|
28
28
|
|
29
29
|
# Used by Automobile and AutomobileTrip
|
30
30
|
def self.find_by_type_name_and_fuel_family_and_closest_year(type_name, fuel_family, year)
|
31
|
-
candidates = where(:type_name => type_name, :fuel_family => fuel_family)
|
31
|
+
return if (candidates = where(:type_name => type_name, :fuel_family => fuel_family)).none?
|
32
32
|
if year > (max_year = candidates.maximum(:year))
|
33
33
|
candidates.where(:year => max_year).first
|
34
34
|
else
|
@@ -7,7 +7,7 @@ AutomobileTypeFuelYear.class_eval do
|
|
7
7
|
code = "LD" + fuel_code + type_code
|
8
8
|
|
9
9
|
import "age distribution of #{fuel} #{type.downcase} from the 2011 EPA GHG Inventory",
|
10
|
-
:url => 'http://www.epa.gov/climatechange/
|
10
|
+
:url => 'http://www.epa.gov/climatechange/Downloads/ghgemissions/2011-Annex-Tables.zip',
|
11
11
|
:filename => 'Annex Tables/Table A-93.csv',
|
12
12
|
:skip => 1,
|
13
13
|
:headers => %w{ age LDGV LDGT HDGV LDDV LDDT HDDT MC },
|
@@ -20,7 +20,7 @@ AutomobileTypeFuelYear.class_eval do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
import "average distance per vehicle for gasoline passenger cars from the 2011 EPA GHG Inventory",
|
23
|
-
:url => 'http://www.epa.gov/climatechange/
|
23
|
+
:url => 'http://www.epa.gov/climatechange/Downloads/ghgemissions/2011-Annex-Tables.zip',
|
24
24
|
:filename => 'Annex Tables/Table A-94.csv',
|
25
25
|
:skip => 1,
|
26
26
|
:headers => %w{ age LDGV LDGT HDGV LDDV LDDT HDDT MC },
|
@@ -30,7 +30,7 @@ EOS
|
|
30
30
|
|
31
31
|
# Used by AutomobileTypeFuelYear
|
32
32
|
def self.find_all_by_type_name_and_fuel_family_and_closest_year(type_name, fuel_family, year)
|
33
|
-
candidates = where(:type_name => type_name, :fuel_family => fuel_family)
|
33
|
+
return if (candidates = where(:type_name => type_name, :fuel_family => fuel_family)).none?
|
34
34
|
if year > (max_year = candidates.maximum(:year))
|
35
35
|
candidates.where :year => max_year
|
36
36
|
else
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Earth
|
2
|
+
module InsolationScopes
|
3
|
+
def self.included(target)
|
4
|
+
target.scope :at_lat_lon, lambda { |lat, lon|
|
5
|
+
target.where('nw_lat > ? AND nw_lon > ? AND se_lat < ? AND se_lon < ?', lat, lon, lat, lon)
|
6
|
+
}
|
7
|
+
target.scope :at_zip, lambda { |zip| target.at_lat_lon(zip.latitude, zip.longitude) }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/earth/loader.rb
CHANGED
@@ -36,12 +36,5 @@ module Earth
|
|
36
36
|
end if options[:load_data_miner] || options[:mine_original_sources]
|
37
37
|
nil
|
38
38
|
end
|
39
|
-
|
40
|
-
def Loader.load_plugins
|
41
|
-
Dir[File.expand_path('../../../vendor/**/init.rb', __FILE__)].each do |pluginit|
|
42
|
-
$LOAD_PATH.unshift ::File.join(::File.dirname(pluginit), 'lib')
|
43
|
-
Kernel.load pluginit
|
44
|
-
end
|
45
|
-
end
|
46
39
|
end
|
47
40
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'earth/model'
|
2
|
-
|
2
|
+
|
3
3
|
require 'earth/locality/state'
|
4
4
|
require 'earth/locality/zip_code'
|
5
5
|
|
@@ -17,13 +17,13 @@ CREATE TABLE climate_divisions
|
|
17
17
|
cooling_degree_days_units CHARACTER VARYING(255),
|
18
18
|
state_postal_abbreviation CHARACTER VARYING(255)
|
19
19
|
);
|
20
|
-
|
21
20
|
EOS
|
22
21
|
|
23
22
|
self.primary_key = "name"
|
24
23
|
|
24
|
+
has_many :months, :foreign_key => 'climate_division_name', :class_name => 'ClimateDivisionMonth'
|
25
25
|
has_many :zip_codes, :foreign_key => 'climate_division_name'
|
26
|
-
belongs_to :state,
|
26
|
+
belongs_to :state, :foreign_key => 'state_postal_abbreviation'
|
27
27
|
|
28
28
|
RADIUS = 750
|
29
29
|
|