Skip to content

Instantly share code, notes, and snippets.

@seamusabshere
Forked from holman/gemspec-usage.md
Created March 2, 2012 19:36
Show Gist options
  • Save seamusabshere/1960760 to your computer and use it in GitHub Desktop.
Save seamusabshere/1960760 to your computer and use it in GitHub Desktop.
brighter planet api gem (aka "carbon") - flattened
Gemfile.lock
.DS_Store
.rvmrc
.yardoc/
doc/
*.gem
--no-private
--readme README.markdown
---
http_interactions:
- request:
method: post
uri: http://impact.brighterplanet.com/automobiles.json
body:
encoding: US-ASCII
string: make=Nissan&model=Altima&year=2006&automobile_fuel%5Bcode%5D=R&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:05:39 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"4520.8 kg","object":{"value":4520.789934497878,"units":"kilograms"},"methodology":"from
co2 emission, ch4 emission, n2o emission, and hfc emission"},"co2_emission":{"description":"4308.585980497603","object":4308.585980497603,"methodology":"from
fuel use and automobile fuel"},"co2_biogenic_emission":{"description":"0.0","object":0.0,"methodology":"from
fuel use and automobile fuel"},"ch4_emission":{"description":"4.537572120026403","object":4.537572120026403,"methodology":"from
fuel use and automobile fuel"},"n2o_emission":{"description":"15.37211589011779","object":15.37211589011779,"methodology":"from
fuel use and automobile fuel"},"hfc_emission":{"description":"192.29426599013075","object":192.29426599013075,"methodology":"from
fuel use and automobile fuel"},"energy":{"description":"63708.4 MJ","object":{"value":63708.41114166553,"units":"megajoules"},"methodology":"from
fuel use and automobile fuel"},"fuel_use":{"description":"1,839.8372129905256
l","object":{"value":1839.8372129905256,"units":"litres"},"methodology":"from
fuel efficiency and distance"},"distance":{"description":"17845.6","object":17845.6,"methodology":"from
annual distance"},"annual_distance":{"description":"17,845.6 km","object":{"value":17845.6,"units":"kilometres"},"methodology":"from
automobile fuel"},"speed":{"description":"50.94382232429702 km/h","object":{"value":50.94382232429702,"units":"kilometres_per_hour"},"methodology":"from
urbanity and safe country"},"fuel_efficiency":{"description":"9.699553783344362
km/l","object":{"value":9.699553783344362,"units":"kilometres_per_litre"},"methodology":"from
make model year and urbanity"},"hybridity_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"urbanity":{"description":"0.43","object":0.43,"methodology":"from
safe country"},"safe_country":{"description":null,"object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":8.226530750610781,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":null,"cooling_degree_days_units":null,"electricity_emission_factor":0.626089,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.096,"flight_route_inefficiency_factor":1.100000023841858,"heating_degree_days":null,"heating_degree_days_units":null,"iso_3166_alpha_3_code":null,"iso_3166_code":null,"iso_3166_numeric_code":null,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"fallback","rail_passengers":null,"rail_speed":32.49720001220703,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.06364482122342524,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.008762920291076415,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":37.11446191042177,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.10806735200626398,"rail_trip_electricity_intensity_units":"kilowatt_hour_per_passenger_kilometre"}},"methodology":"default"},"active_subtimeframe":{"description":"2012-01-01/2013-01-01","object":"2012-01-01/2013-01-01","methodology":"from
acquisition and retirement"},"acquisition":{"description":"2006-01-01","object":"2006-01-01","methodology":"from
year"},"retirement":{"description":"2013-01-01","object":"2013-01-01","methodology":"default"},"make_model_year":{"description":"Nissan
ALTIMA 2006","object":{"automobile_make_model_year":{"fuel_code":"R","fuel_efficiency_city":8.15793,"fuel_efficiency_city_units":"kilometres_per_litre","fuel_efficiency_highway":11.3122,"fuel_efficiency_highway_units":"kilometres_per_litre","hybridity":false,"make_name":"Nissan","model_name":"ALTIMA","name":"Nissan
ALTIMA 2006","year":2006}},"methodology":"from make, model, and year"},"make_year":{"description":"Nissan
2006","object":{"automobile_make_year":{"fuel_efficiency":11.2297,"fuel_efficiency_units":"kilometres_per_litre","make_name":"Nissan","name":"Nissan
2006","volume":1076456,"year":2006}},"methodology":"from make and year"},"make_model":{"description":"Nissan
ALTIMA","object":{"automobile_make_model":{"fuel_efficiency_city":8.47904,"fuel_efficiency_city_units":"kilometres_per_litre","fuel_efficiency_highway":11.65,"fuel_efficiency_highway_units":"kilometres_per_litre","make_name":"Nissan","model_name":"ALTIMA","name":"Nissan
ALTIMA"}},"methodology":"from make and model"}},"emitter":"Automobile","equivalents":{"cars_off_the_road_for_a_year":0.8227837680786138,"cars_off_the_road_for_a_month":9.86436363707437,"cars_off_the_road_for_a_week":42.744068830677435,"cars_off_the_road_for_a_day":300.0267447928861,"cars_to_priuses_for_a_year":1.6455675361572275,"cars_to_priuses_for_a_month":19.72872727414874,"cars_to_priuses_for_a_week":85.48813766135487,"cars_to_priuses_for_a_day":600.0534895857722,"one_way_domestic_flight":14.692567287118102,"round_trip_domestic_flight":7.346283643559051,"one_way_cross_country_flight":5.1627421051965765,"round_trip_cross_country_flight":2.5813710525982883,"vegan_meals_instead_of_non_vegan_ones":3637.820890021294,"days_of_veganism":1212.6069633404313,"weeks_of_veganism":173.22762871008968,"months_of_veganism":40.42038280434552,"years_of_veganism":3.32278060185594,"barrels_of_petroleum":10.515357387642064,"canisters_of_bbq_propane":188.36775420072308,"railroad_cars_full_of_coal":0.022603949672489392,"homes_energy_in_a_year":0.4385166236462941,"homes_energy_in_a_month":5.2395955340830405,"homes_energy_in_a_week":22.698886261113845,"homes_energy_in_a_day":159.3442828212467,"homes_electricity_in_a_year":0.664556120371188,"homes_electricity_in_a_month":7.9520694947817665,"homes_electricity_in_a_week":34.45746088074283,"homes_electricity_in_a_day":241.85774070570196,"homes_with_lowered_thermostat_2_degrees_for_a_winter":23.72962636617936,"homes_with_raised_thermostat_3_degrees_for_a_summer":10.669064245414992,"replaced_refrigerators":4.552435464039363,"loads_of_cold_laundry":2073.062473943216,"lightbulbs_for_a_year":8.345378219083083,"lightbulbs_for_a_month":101.55954587849482,"lightbulbs_for_a_week":435.25261331358666,"lightbulbs_for_a_day":3046.7818555649105,"lightbulbs_for_an_evening":18280.695654179395,"lightbulbs_to_CFLs_for_a_day":51860.13323463397,"lightbulbs_to_CFLs_for_a_week":7408.589170436301,"lightbulbs_to_CFLs_for_a_month":1728.6732175231018,"lightbulbs_to_CFLs_for_a_year":142.0839068513338,"days_with_lightbulbs_to_CFLs":1152.448811682068,"weeks_with_lightbulbs_to_CFLs":164.6336070446092,"months_with_lightbulbs_to_CFLs":38.41315207342846,"years_with_lightbulbs_to_CFLs":3.155511374279519,"recycled_kgs_of_trash":3117.785382276134,"recycled_bags_of_trash":1727.5520616193464},"methodology":"http://impact.brighterplanet.com/automobiles?automobile_fuel%5Bcode%5D=R&make=Nissan&model=Altima&timeframe=2012-01-01%2F2013-01-01&year=2006","scope":"The
automobile emission estimate is the total anthropogenic emissions from fuel
and air conditioning used by the automobile during the timeframe. It includes
CO2 emissions from combustion of non-biogenic fuel, CH4 and N2O emissions
from combustion of all fuel, and fugitive HFC emissions from air conditioning.","timeframe":"2012-01-01/2013-01-01","characteristics":{"make":{"description":"Nissan","object":{"automobile_make":{"fuel_efficiency":11.9656,"fuel_efficiency_units":"kilometres_per_litre","name":"Nissan"}}},"model":{"description":"ALTIMA","object":{"automobile_model":{"name":"ALTIMA"}}},"year":{"description":2006,"object":{"automobile_year":{"year":2006}}},"automobile_fuel":{"description":"regular
gasoline","object":{"automobile_fuel":{"annual_distance":17845.6,"annual_distance_units":"kilometres","base_fuel_name":"Motor
Gasoline","blend_fuel_name":null,"blend_portion":null,"ch4_emission_factor":0.00246629,"ch4_emission_factor_units":"kilograms_co2e_per_litre","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.34183,"co2_emission_factor_units":"kilograms_per_litre","code":"R","distance_key":"gasoline","ef_key":"gasoline","emission_factor":2.45717,"emission_factor_units":"kilograms_co2e_per_litre","energy_content":34.6272,"energy_content_units":"megajoules_per_litre","hfc_emission_factor":0.104517,"hfc_emission_factor_units":"kilograms_co2e_per_litre","n2o_emission_factor":0.00835515,"n2o_emission_factor_units":"kilograms_co2e_per_litre","name":"regular
gasoline"}}}},"errors":["API key \"carbon_test\" could not be verified. Please
register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:05:39 GMT
recorded_with: VCR 2.2.0
---
http_interactions:
- request:
method: post
uri: http://impact.brighterplanet.com/monkeys.json
body:
encoding: US-ASCII
string: bananas=3&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 404
message: Not Found
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 404 Not Found
etag:
- b0dcd496ec3896280a7c636e2d5b9870
body:
encoding: US-ASCII
string: ! '{name: "HTTPError", message: "404 Not found"}
'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/monkeys.json
body:
encoding: US-ASCII
string: bananas=2&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 404
message: Not Found
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 404 Not Found
etag:
- b0dcd496ec3896280a7c636e2d5b9870
body:
encoding: US-ASCII
string: ! '{name: "HTTPError", message: "404 Not found"}
'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/monkeys.json
body:
encoding: US-ASCII
string: bananas=1&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 404
message: Not Found
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 404 Not Found
etag:
- b0dcd496ec3896280a7c636e2d5b9870
body:
encoding: US-ASCII
string: ! '{name: "HTTPError", message: "404 Not found"}
'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/rail_trips.json
body:
encoding: US-ASCII
string: rail_traction=electric&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"2.4 kg","object":{"value":2.362143293092419,"units":"kilograms"},"methodology":"from
distance, co2 emission factor, date, and timeframe"},"co2_emission_factor":{"description":"0.06364482122342524","object":0.06364482122342524,"methodology":"default"},"diesel_consumption":{"description":"0.32523107136721763","object":0.32523107136721763,"methodology":"from
distance and diesel intensity"},"electricity_consumption":{"description":"4.010861619796626","object":4.010861619796626,"methodology":"from
distance and electricity intensity"},"diesel_intensity":{"description":"0.008762920291076415","object":0.008762920291076415,"methodology":"default"},"electricity_intensity":{"description":"0.10806735200626398","object":0.10806735200626398,"methodology":"default"},"distance":{"description":"37.11446191042177
km","object":{"value":37.11446191042177,"units":"kilometres"},"methodology":"default"},"speed":{"description":"32.49720001220703","object":32.49720001220703,"methodology":"default"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"RailTrip","equivalents":{"cars_off_the_road_for_a_year":0.0004299100793428203,"cars_off_the_road_for_a_month":0.005154196665527658,"cars_off_the_road_for_a_week":0.02233406483618882,"cars_off_the_road_for_a_day":0.15676600178937145,"cars_to_priuses_for_a_year":0.0008598201586856405,"cars_to_priuses_for_a_month":0.010308393331055316,"cars_to_priuses_for_a_week":0.04466812967237764,"cars_to_priuses_for_a_day":0.3135320035787429,"one_way_domestic_flight":0.007676965702550361,"round_trip_domestic_flight":0.0038384828512751804,"one_way_cross_country_flight":0.0026975676407115425,"round_trip_cross_country_flight":0.0013487838203557713,"vegan_meals_instead_of_non_vegan_ones":1.9007860000886594,"days_of_veganism":0.6335953333628864,"weeks_of_veganism":0.0905126067047153,"months_of_veganism":0.021119923183539314,"years_of_veganism":0.0017361753204229277,"barrels_of_petroleum":0.005494345299732966,"canisters_of_bbq_propane":0.09842342459328182,"railroad_cars_full_of_coal":1.1810716465462095e-05,"homes_energy_in_a_year":0.00022912789942996462,"homes_energy_in_a_month":0.0027377240766941137,"homes_energy_in_a_week":0.011860321474617037,"homes_energy_in_a_day":0.08325846465162849,"homes_electricity_in_a_year":0.00034723506408458556,"homes_electricity_in_a_month":0.004155010052549564,"homes_electricity_in_a_week":0.01800425617995042,"homes_electricity_in_a_day":0.1263723040371513,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.012398890145442107,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.0055746581716981086,"replaced_refrigerators":0.002378678296144066,"loads_of_cold_laundry":1.0831891527670459,"lightbulbs_for_a_year":0.004360516519048605,"lightbulbs_for_a_month":0.053065549079321185,"lightbulbs_for_a_week":0.2274224319723519,"lightbulbs_for_a_day":1.5919641102363427,"lightbulbs_for_an_evening":9.551787023561348,"lightbulbs_to_CFLs_for_a_day":27.09727009527065,"lightbulbs_to_CFLs_for_a_week":3.8710379101405805,"lightbulbs_to_CFLs_for_a_month":0.9032434388425583,"lightbulbs_to_CFLs_for_a_year":0.07423980155860163,"days_with_lightbulbs_to_CFLs":0.6021622925617056,"weeks_with_lightbulbs_to_CFLs":0.08602217230454662,"months_with_lightbulbs_to_CFLs":0.02007113156140628,"years_with_lightbulbs_to_CFLs":0.0016487760185785085,"recycled_kgs_of_trash":1.6290639327976522,"recycled_bags_of_trash":0.9026576273058715},"methodology":"http://impact.brighterplanet.com/rail_trips?rail_traction=electric&timeframe=2012-01-01%2F2013-01-01","scope":"The
rail trip emission estimate is the anthropogenic emissions per passenger from
rail fuel combustion. It includes includes CO2 emissions from direct fuel
combustion and indirect fuel combustion to generate purchased electricity.","timeframe":"2012-01-01/2013-01-01","characteristics":{"rail_traction":{"description":"electric","object":{"rail_traction":{"name":"electric"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/automobiles.json
body:
encoding: US-ASCII
string: make=Nissan&model=Altima&year=2006&automobile_fuel%5Bcode%5D=R&timeframe=2010-01-01%2F2011-01-01&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"4520.8 kg","object":{"value":4520.789934497878,"units":"kilograms"},"methodology":"from
co2 emission, ch4 emission, n2o emission, and hfc emission"},"co2_emission":{"description":"4308.585980497603","object":4308.585980497603,"methodology":"from
fuel use and automobile fuel"},"co2_biogenic_emission":{"description":"0.0","object":0.0,"methodology":"from
fuel use and automobile fuel"},"ch4_emission":{"description":"4.537572120026403","object":4.537572120026403,"methodology":"from
fuel use and automobile fuel"},"n2o_emission":{"description":"15.37211589011779","object":15.37211589011779,"methodology":"from
fuel use and automobile fuel"},"hfc_emission":{"description":"192.29426599013075","object":192.29426599013075,"methodology":"from
fuel use and automobile fuel"},"energy":{"description":"63708.4 MJ","object":{"value":63708.41114166553,"units":"megajoules"},"methodology":"from
fuel use and automobile fuel"},"fuel_use":{"description":"1,839.8372129905256
l","object":{"value":1839.8372129905256,"units":"litres"},"methodology":"from
fuel efficiency and distance"},"distance":{"description":"17845.6","object":17845.6,"methodology":"from
annual distance"},"annual_distance":{"description":"17,845.6 km","object":{"value":17845.6,"units":"kilometres"},"methodology":"from
automobile fuel"},"speed":{"description":"50.94382232429702 km/h","object":{"value":50.94382232429702,"units":"kilometres_per_hour"},"methodology":"from
urbanity and safe country"},"fuel_efficiency":{"description":"9.699553783344362
km/l","object":{"value":9.699553783344362,"units":"kilometres_per_litre"},"methodology":"from
make model year and urbanity"},"hybridity_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"urbanity":{"description":"0.43","object":0.43,"methodology":"from
safe country"},"safe_country":{"description":null,"object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":8.226530750610781,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":null,"cooling_degree_days_units":null,"electricity_emission_factor":0.626089,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.096,"flight_route_inefficiency_factor":1.100000023841858,"heating_degree_days":null,"heating_degree_days_units":null,"iso_3166_alpha_3_code":null,"iso_3166_code":null,"iso_3166_numeric_code":null,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"fallback","rail_passengers":null,"rail_speed":32.49720001220703,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.06364482122342524,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.008762920291076415,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":37.11446191042177,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.10806735200626398,"rail_trip_electricity_intensity_units":"kilowatt_hour_per_passenger_kilometre"}},"methodology":"default"},"active_subtimeframe":{"description":"2010-01-01/2011-01-01","object":"2010-01-01/2011-01-01","methodology":"from
acquisition and retirement"},"acquisition":{"description":"2006-01-01","object":"2006-01-01","methodology":"from
year"},"retirement":{"description":"2011-01-01","object":"2011-01-01","methodology":"default"},"make_model_year":{"description":"Nissan
ALTIMA 2006","object":{"automobile_make_model_year":{"fuel_code":"R","fuel_efficiency_city":8.15793,"fuel_efficiency_city_units":"kilometres_per_litre","fuel_efficiency_highway":11.3122,"fuel_efficiency_highway_units":"kilometres_per_litre","hybridity":false,"make_name":"Nissan","model_name":"ALTIMA","name":"Nissan
ALTIMA 2006","year":2006}},"methodology":"from make, model, and year"},"make_year":{"description":"Nissan
2006","object":{"automobile_make_year":{"fuel_efficiency":11.2297,"fuel_efficiency_units":"kilometres_per_litre","make_name":"Nissan","name":"Nissan
2006","volume":1076456,"year":2006}},"methodology":"from make and year"},"make_model":{"description":"Nissan
ALTIMA","object":{"automobile_make_model":{"fuel_efficiency_city":8.47904,"fuel_efficiency_city_units":"kilometres_per_litre","fuel_efficiency_highway":11.65,"fuel_efficiency_highway_units":"kilometres_per_litre","make_name":"Nissan","model_name":"ALTIMA","name":"Nissan
ALTIMA"}},"methodology":"from make and model"}},"emitter":"Automobile","equivalents":{"cars_off_the_road_for_a_year":0.8227837680786138,"cars_off_the_road_for_a_month":9.86436363707437,"cars_off_the_road_for_a_week":42.744068830677435,"cars_off_the_road_for_a_day":300.0267447928861,"cars_to_priuses_for_a_year":1.6455675361572275,"cars_to_priuses_for_a_month":19.72872727414874,"cars_to_priuses_for_a_week":85.48813766135487,"cars_to_priuses_for_a_day":600.0534895857722,"one_way_domestic_flight":14.692567287118102,"round_trip_domestic_flight":7.346283643559051,"one_way_cross_country_flight":5.1627421051965765,"round_trip_cross_country_flight":2.5813710525982883,"vegan_meals_instead_of_non_vegan_ones":3637.820890021294,"days_of_veganism":1212.6069633404313,"weeks_of_veganism":173.22762871008968,"months_of_veganism":40.42038280434552,"years_of_veganism":3.32278060185594,"barrels_of_petroleum":10.515357387642064,"canisters_of_bbq_propane":188.36775420072308,"railroad_cars_full_of_coal":0.022603949672489392,"homes_energy_in_a_year":0.4385166236462941,"homes_energy_in_a_month":5.2395955340830405,"homes_energy_in_a_week":22.698886261113845,"homes_energy_in_a_day":159.3442828212467,"homes_electricity_in_a_year":0.664556120371188,"homes_electricity_in_a_month":7.9520694947817665,"homes_electricity_in_a_week":34.45746088074283,"homes_electricity_in_a_day":241.85774070570196,"homes_with_lowered_thermostat_2_degrees_for_a_winter":23.72962636617936,"homes_with_raised_thermostat_3_degrees_for_a_summer":10.669064245414992,"replaced_refrigerators":4.552435464039363,"loads_of_cold_laundry":2073.062473943216,"lightbulbs_for_a_year":8.345378219083083,"lightbulbs_for_a_month":101.55954587849482,"lightbulbs_for_a_week":435.25261331358666,"lightbulbs_for_a_day":3046.7818555649105,"lightbulbs_for_an_evening":18280.695654179395,"lightbulbs_to_CFLs_for_a_day":51860.13323463397,"lightbulbs_to_CFLs_for_a_week":7408.589170436301,"lightbulbs_to_CFLs_for_a_month":1728.6732175231018,"lightbulbs_to_CFLs_for_a_year":142.0839068513338,"days_with_lightbulbs_to_CFLs":1152.448811682068,"weeks_with_lightbulbs_to_CFLs":164.6336070446092,"months_with_lightbulbs_to_CFLs":38.41315207342846,"years_with_lightbulbs_to_CFLs":3.155511374279519,"recycled_kgs_of_trash":3117.785382276134,"recycled_bags_of_trash":1727.5520616193464},"methodology":"http://impact.brighterplanet.com/automobiles?automobile_fuel%5Bcode%5D=R&make=Nissan&model=Altima&timeframe=2010-01-01%2F2011-01-01&year=2006","scope":"The
automobile emission estimate is the total anthropogenic emissions from fuel
and air conditioning used by the automobile during the timeframe. It includes
CO2 emissions from combustion of non-biogenic fuel, CH4 and N2O emissions
from combustion of all fuel, and fugitive HFC emissions from air conditioning.","timeframe":"2010-01-01/2011-01-01","characteristics":{"make":{"description":"Nissan","object":{"automobile_make":{"fuel_efficiency":11.9656,"fuel_efficiency_units":"kilometres_per_litre","name":"Nissan"}}},"model":{"description":"ALTIMA","object":{"automobile_model":{"name":"ALTIMA"}}},"year":{"description":2006,"object":{"automobile_year":{"year":2006}}},"automobile_fuel":{"description":"regular
gasoline","object":{"automobile_fuel":{"annual_distance":17845.6,"annual_distance_units":"kilometres","base_fuel_name":"Motor
Gasoline","blend_fuel_name":null,"blend_portion":null,"ch4_emission_factor":0.00246629,"ch4_emission_factor_units":"kilograms_co2e_per_litre","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.34183,"co2_emission_factor_units":"kilograms_per_litre","code":"R","distance_key":"gasoline","ef_key":"gasoline","emission_factor":2.45717,"emission_factor_units":"kilograms_co2e_per_litre","energy_content":34.6272,"energy_content_units":"megajoules_per_litre","hfc_emission_factor":0.104517,"hfc_emission_factor_units":"kilograms_co2e_per_litre","n2o_emission_factor":0.00835515,"n2o_emission_factor_units":"kilograms_co2e_per_litre","name":"regular
gasoline"}}}},"errors":["API key \"carbon_test\" could not be verified. Please
register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
recorded_with: VCR 2.2.0
---
http_interactions:
- request:
method: post
uri: http://impact.brighterplanet.com/rail_trips.json
body:
encoding: US-ASCII
string: distance=25&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"1.6 kg","object":{"value":1.591120530585631,"units":"kilograms"},"methodology":"from
distance, co2 emission factor, date, and timeframe"},"co2_emission_factor":{"description":"0.06364482122342524","object":0.06364482122342524,"methodology":"default"},"diesel_consumption":{"description":"0.21907300727691037","object":0.21907300727691037,"methodology":"from
distance and diesel intensity"},"electricity_consumption":{"description":"2.7016838001565997","object":2.7016838001565997,"methodology":"from
distance and electricity intensity"},"diesel_intensity":{"description":"0.008762920291076415","object":0.008762920291076415,"methodology":"default"},"electricity_intensity":{"description":"0.10806735200626398","object":0.10806735200626398,"methodology":"default"},"speed":{"description":"32.49720001220703","object":32.49720001220703,"methodology":"default"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"RailTrip","equivalents":{"cars_off_the_road_for_a_year":0.00028958393656658486,"cars_off_the_road_for_a_month":0.003471824997737847,"cars_off_the_road_for_a_week":0.015044044616687142,"cars_off_the_road_for_a_day":0.10559630513284599,"cars_to_priuses_for_a_year":0.0005791678731331697,"cars_to_priuses_for_a_month":0.006943649995475694,"cars_to_priuses_for_a_week":0.030088089233374284,"cars_to_priuses_for_a_day":0.21119261026569197,"one_way_domestic_flight":0.005171141724403301,"round_trip_domestic_flight":0.0025855708622016505,"one_way_cross_country_flight":0.0018170596459287907,"round_trip_cross_country_flight":0.0009085298229643953,"vegan_meals_instead_of_non_vegan_ones":1.2803540063953598,"days_of_veganism":0.4267846687984532,"weeks_of_veganism":0.06096855649098021,"months_of_veganism":0.014226208663966126,"years_of_veganism":0.0011694735899804387,"barrels_of_petroleum":0.003700946354142178,"canisters_of_bbq_propane":0.0662972191479115,"railroad_cars_full_of_coal":7.955602652928155e-06,"homes_energy_in_a_year":0.00015433869146680622,"homes_energy_in_a_month":0.0018441086949487465,"homes_energy_in_a_week":0.007989016184070455,"homes_energy_in_a_day":0.05608222534155174,"homes_electricity_in_a_year":0.00023389471799608775,"homes_electricity_in_a_month":0.002798781013300125,"homes_electricity_in_a_week":0.01212752068412368,"homes_electricity_in_a_day":0.08512335726580067,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.008351791665043977,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.0037550444521820894,"replaced_refrigerators":0.0016022583742997306,"loads_of_cold_laundry":0.7296274127464082,"lightbulbs_for_a_year":0.002937208499461075,"lightbulbs_for_a_month":0.0357445227196062,"lightbulbs_for_a_week":0.15318990244372338,"lightbulbs_for_a_day":1.0723340904676555,"lightbulbs_for_an_evening":6.434006133926463,"lightbulbs_to_CFLs_for_a_day":18.25250097972033,"lightbulbs_to_CFLs_for_a_week":2.6074996853541816,"lightbulbs_to_CFLs_for_a_month":0.6084174418469254,"lightbulbs_to_CFLs_for_a_year":0.0500073271557758,"days_with_lightbulbs_to_CFLs":0.40561162789795024,"weeks_with_lightbulbs_to_CFLs":0.05794383636233692,"months_with_lightbulbs_to_CFLs":0.013519751148386105,"years_with_lightbulbs_to_CFLs":0.0011106021303487707,"recycled_kgs_of_trash":1.0973242295210335,"recycled_bags_of_trash":0.6080228439553401},"methodology":"http://impact.brighterplanet.com/rail_trips?distance=25&timeframe=2012-01-01%2F2013-01-01","scope":"The
rail trip emission estimate is the anthropogenic emissions per passenger from
rail fuel combustion. It includes includes CO2 emissions from direct fuel
combustion and indirect fuel combustion to generate purchased electricity.","timeframe":"2012-01-01/2013-01-01","characteristics":{"distance":{"description":"25.0
km","object":{"value":25.0,"units":"kilometres"}}},"errors":["API key \"carbon_test\"
could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/rail_trips.json
body:
encoding: US-ASCII
string: distance=25&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"1.6 kg","object":{"value":1.591120530585631,"units":"kilograms"},"methodology":"from
distance, co2 emission factor, date, and timeframe"},"co2_emission_factor":{"description":"0.06364482122342524","object":0.06364482122342524,"methodology":"default"},"diesel_consumption":{"description":"0.21907300727691037","object":0.21907300727691037,"methodology":"from
distance and diesel intensity"},"electricity_consumption":{"description":"2.7016838001565997","object":2.7016838001565997,"methodology":"from
distance and electricity intensity"},"diesel_intensity":{"description":"0.008762920291076415","object":0.008762920291076415,"methodology":"default"},"electricity_intensity":{"description":"0.10806735200626398","object":0.10806735200626398,"methodology":"default"},"speed":{"description":"32.49720001220703","object":32.49720001220703,"methodology":"default"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"RailTrip","equivalents":{"cars_off_the_road_for_a_year":0.00028958393656658486,"cars_off_the_road_for_a_month":0.003471824997737847,"cars_off_the_road_for_a_week":0.015044044616687142,"cars_off_the_road_for_a_day":0.10559630513284599,"cars_to_priuses_for_a_year":0.0005791678731331697,"cars_to_priuses_for_a_month":0.006943649995475694,"cars_to_priuses_for_a_week":0.030088089233374284,"cars_to_priuses_for_a_day":0.21119261026569197,"one_way_domestic_flight":0.005171141724403301,"round_trip_domestic_flight":0.0025855708622016505,"one_way_cross_country_flight":0.0018170596459287907,"round_trip_cross_country_flight":0.0009085298229643953,"vegan_meals_instead_of_non_vegan_ones":1.2803540063953598,"days_of_veganism":0.4267846687984532,"weeks_of_veganism":0.06096855649098021,"months_of_veganism":0.014226208663966126,"years_of_veganism":0.0011694735899804387,"barrels_of_petroleum":0.003700946354142178,"canisters_of_bbq_propane":0.0662972191479115,"railroad_cars_full_of_coal":7.955602652928155e-06,"homes_energy_in_a_year":0.00015433869146680622,"homes_energy_in_a_month":0.0018441086949487465,"homes_energy_in_a_week":0.007989016184070455,"homes_energy_in_a_day":0.05608222534155174,"homes_electricity_in_a_year":0.00023389471799608775,"homes_electricity_in_a_month":0.002798781013300125,"homes_electricity_in_a_week":0.01212752068412368,"homes_electricity_in_a_day":0.08512335726580067,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.008351791665043977,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.0037550444521820894,"replaced_refrigerators":0.0016022583742997306,"loads_of_cold_laundry":0.7296274127464082,"lightbulbs_for_a_year":0.002937208499461075,"lightbulbs_for_a_month":0.0357445227196062,"lightbulbs_for_a_week":0.15318990244372338,"lightbulbs_for_a_day":1.0723340904676555,"lightbulbs_for_an_evening":6.434006133926463,"lightbulbs_to_CFLs_for_a_day":18.25250097972033,"lightbulbs_to_CFLs_for_a_week":2.6074996853541816,"lightbulbs_to_CFLs_for_a_month":0.6084174418469254,"lightbulbs_to_CFLs_for_a_year":0.0500073271557758,"days_with_lightbulbs_to_CFLs":0.40561162789795024,"weeks_with_lightbulbs_to_CFLs":0.05794383636233692,"months_with_lightbulbs_to_CFLs":0.013519751148386105,"years_with_lightbulbs_to_CFLs":0.0011106021303487707,"recycled_kgs_of_trash":1.0973242295210335,"recycled_bags_of_trash":0.6080228439553401},"methodology":"http://impact.brighterplanet.com/rail_trips?distance=25&timeframe=2012-01-01%2F2013-01-01","scope":"The
rail trip emission estimate is the anthropogenic emissions per passenger from
rail fuel combustion. It includes includes CO2 emissions from direct fuel
combustion and indirect fuel combustion to generate purchased electricity.","timeframe":"2012-01-01/2013-01-01","characteristics":{"distance":{"description":"25.0
km","object":{"value":25.0,"units":"kilometres"}}},"errors":["API key \"carbon_test\"
could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/rail_trips.json
body:
encoding: US-ASCII
string: rail_class=commuter&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"2.4 kg","object":{"value":2.362143293092419,"units":"kilograms"},"methodology":"from
distance, co2 emission factor, date, and timeframe"},"co2_emission_factor":{"description":"0.06364482122342524","object":0.06364482122342524,"methodology":"default"},"diesel_consumption":{"description":"0.32523107136721763","object":0.32523107136721763,"methodology":"from
distance and diesel intensity"},"electricity_consumption":{"description":"4.010861619796626","object":4.010861619796626,"methodology":"from
distance and electricity intensity"},"diesel_intensity":{"description":"0.008762920291076415","object":0.008762920291076415,"methodology":"default"},"electricity_intensity":{"description":"0.10806735200626398","object":0.10806735200626398,"methodology":"default"},"distance":{"description":"37.11446191042177
km","object":{"value":37.11446191042177,"units":"kilometres"},"methodology":"default"},"speed":{"description":"32.49720001220703","object":32.49720001220703,"methodology":"default"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"RailTrip","equivalents":{"cars_off_the_road_for_a_year":0.0004299100793428203,"cars_off_the_road_for_a_month":0.005154196665527658,"cars_off_the_road_for_a_week":0.02233406483618882,"cars_off_the_road_for_a_day":0.15676600178937145,"cars_to_priuses_for_a_year":0.0008598201586856405,"cars_to_priuses_for_a_month":0.010308393331055316,"cars_to_priuses_for_a_week":0.04466812967237764,"cars_to_priuses_for_a_day":0.3135320035787429,"one_way_domestic_flight":0.007676965702550361,"round_trip_domestic_flight":0.0038384828512751804,"one_way_cross_country_flight":0.0026975676407115425,"round_trip_cross_country_flight":0.0013487838203557713,"vegan_meals_instead_of_non_vegan_ones":1.9007860000886594,"days_of_veganism":0.6335953333628864,"weeks_of_veganism":0.0905126067047153,"months_of_veganism":0.021119923183539314,"years_of_veganism":0.0017361753204229277,"barrels_of_petroleum":0.005494345299732966,"canisters_of_bbq_propane":0.09842342459328182,"railroad_cars_full_of_coal":1.1810716465462095e-05,"homes_energy_in_a_year":0.00022912789942996462,"homes_energy_in_a_month":0.0027377240766941137,"homes_energy_in_a_week":0.011860321474617037,"homes_energy_in_a_day":0.08325846465162849,"homes_electricity_in_a_year":0.00034723506408458556,"homes_electricity_in_a_month":0.004155010052549564,"homes_electricity_in_a_week":0.01800425617995042,"homes_electricity_in_a_day":0.1263723040371513,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.012398890145442107,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.0055746581716981086,"replaced_refrigerators":0.002378678296144066,"loads_of_cold_laundry":1.0831891527670459,"lightbulbs_for_a_year":0.004360516519048605,"lightbulbs_for_a_month":0.053065549079321185,"lightbulbs_for_a_week":0.2274224319723519,"lightbulbs_for_a_day":1.5919641102363427,"lightbulbs_for_an_evening":9.551787023561348,"lightbulbs_to_CFLs_for_a_day":27.09727009527065,"lightbulbs_to_CFLs_for_a_week":3.8710379101405805,"lightbulbs_to_CFLs_for_a_month":0.9032434388425583,"lightbulbs_to_CFLs_for_a_year":0.07423980155860163,"days_with_lightbulbs_to_CFLs":0.6021622925617056,"weeks_with_lightbulbs_to_CFLs":0.08602217230454662,"months_with_lightbulbs_to_CFLs":0.02007113156140628,"years_with_lightbulbs_to_CFLs":0.0016487760185785085,"recycled_kgs_of_trash":1.6290639327976522,"recycled_bags_of_trash":0.9026576273058715},"methodology":"http://impact.brighterplanet.com/rail_trips?rail_class=commuter&timeframe=2012-01-01%2F2013-01-01","scope":"The
rail trip emission estimate is the anthropogenic emissions per passenger from
rail fuel combustion. It includes includes CO2 emissions from direct fuel
combustion and indirect fuel combustion to generate purchased electricity.","timeframe":"2012-01-01/2013-01-01","characteristics":{"rail_class":{"description":"commuter","object":{"rail_class":{"name":"commuter"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: origin_airport=IAH&destination_airport=DEN&segments_per_trip=1&trips=1&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"242.5 kg","object":{"value":242.52347122248426,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"1771.2
MJ","object":{"value":1771.178169585269,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"47.072375987935935","object":47.072375987935935,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"5891.4023971685265","object":5891.4023971685265,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"802.3565814689595","object":802.3565814689595,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"802.3565814689595","object":802.3565814689595,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"749.8659639896817","object":749.8659639896817,"methodology":"from
airports"},"route_inefficiency_factor":{"description":"1.07","object":1.07,"methodology":"from
country"},"dogleg_factor":{"description":"1.0","object":1.0,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"Fuel use equation","object":{"m3":6.230164366685055e-08,"m2":-4.0923005200593856e-05,"m1":5.808528552865584,"b":1225.0553711164655},"methodology":"from
cohort"},"fuel":{"description":"Jet Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"152","object":152,"methodology":"from
seats and load factor"},"seats":{"description":"174.52327350140772","object":174.52327350140772,"methodology":"from
cohort"},"load_factor":{"description":"0.8695368648330599","object":0.8695368648330599,"methodology":"from
cohort"},"freight_share":{"description":"0.009468621447370996","object":0.009468621447370996,"methodology":"from
cohort"},"country":{"description":"US","object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":9.2669,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":882.0,"cooling_degree_days_units":"degrees_celsius","electricity_emission_factor":0.589455,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.0615633,"flight_route_inefficiency_factor":1.07,"heating_degree_days":2159.0,"heating_degree_days_units":"degrees_celsius","iso_3166_alpha_3_code":"USA","iso_3166_code":"US","iso_3166_numeric_code":840,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"United
States","rail_passengers":4467000000.0,"rail_speed":32.4972,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.0957617,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.0194247,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":12.9952,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.140512,"rail_trip_electricity_intensity_units":"kilowatt_hours_per_passenger_kilometre"}},"methodology":"from
origin airport and destination airport"},"cohort":{"description":"BrighterPlanet::Flight::ImpactModel::FlightSegmentCohort","object":{"members":108,"sql":"SELECT
* FROM `flight_segments` WHERE (`flight_segments`.`source` = ''BTS T100''
AND `flight_segments`.`year` IN (2011, 2012) AND `flight_segments`.`passengers`
> 0) AND `flight_segments`.`origin_airport_iata_code` = ''IAH'' AND `flight_segments`.`destination_airport_iata_code`
= ''DEN''"},"methodology":"from segments per trip and input"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.04413927176249214,"cars_off_the_road_for_a_month":0.5291862142074606,"cars_off_the_road_for_a_week":2.293059420408589,"cars_off_the_road_for_a_day":16.09531269115139,"cars_to_priuses_for_a_year":0.08827854352498428,"cars_to_priuses_for_a_month":1.0583724284149212,"cars_to_priuses_for_a_week":4.586118840817178,"cars_to_priuses_for_a_day":32.19062538230278,"one_way_domestic_flight":0.7882012814730738,"round_trip_domestic_flight":0.3941006407365369,"one_way_cross_country_flight":0.276961804136077,"round_trip_cross_country_flight":0.1384809020680385,"vegan_meals_instead_of_non_vegan_ones":195.1554844876072,"days_of_veganism":65.05182816253573,"weeks_of_veganism":9.293014370303151,"months_of_veganism":2.1684023562002315,"years_of_veganism":0.17825475134852592,"barrels_of_petroleum":0.5641095940634984,"canisters_of_bbq_propane":10.105225475427252,"railroad_cars_full_of_coal":0.0012126173561124215,"homes_energy_in_a_year":0.023524776708580972,"homes_energy_in_a_month":0.2810847031468593,"homes_energy_in_a_week":1.2177103490080936,"homes_energy_in_a_day":8.548224790178903,"homes_electricity_in_a_year":0.03565095026970518,"homes_electricity_in_a_month":0.4265987858803498,"homes_electricity_in_a_week":1.848513897657775,"homes_electricity_in_a_day":12.974763186931686,"homes_with_lowered_thermostat_2_degrees_for_a_winter":1.27300570044682,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.5723553920850629,"replaced_refrigerators":0.24422113552104166,"loads_of_cold_laundry":111.21204801072483,"lightbulbs_for_a_year":0.44769832787670594,"lightbulbs_for_a_month":5.448289781013108,"lightbulbs_for_a_week":23.34967476235834,"lightbulbs_for_a_day":163.44845090692206,"lightbulbs_for_an_evening":980.6909479650034,"lightbulbs_to_CFLs_for_a_day":2782.1021795654187,"lightbulbs_to_CFLs_for_a_week":397.4430992169252,"lightbulbs_to_CFLs_for_a_month":92.7368524964672,"lightbulbs_to_CFLs_for_a_year":7.622270177051457,"days_with_lightbulbs_to_CFLs":61.82456833097813,"weeks_with_lightbulbs_to_CFLs":8.831977251509208,"months_with_lightbulbs_to_CFLs":2.060721934977449,"years_with_lightbulbs_to_CFLs":0.16928138291329403,"recycled_kgs_of_trash":167.25752454594237,"recycled_bags_of_trash":92.67670667560402},"methodology":"http://impact.brighterplanet.com/flights?destination_airport=DEN&origin_airport=IAH&segments_per_trip=1&timeframe=2012-01-01%2F2013-01-01&trips=1","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2012-01-01/2013-01-01","characteristics":{"segments_per_trip":{"description":"1","object":1},"trips":{"description":"1","object":1},"origin_airport":{"description":"IAH","object":{"airport":{"city":"Houston","country_iso_3166_code":"US","country_name":"United
States","iata_code":"IAH","latitude":29.9844,"longitude":-95.3414,"name":"George
Bush Intcntl Houston"}}},"destination_airport":{"description":"DEN","object":{"airport":{"city":"Denver","country_iso_3166_code":"US","country_name":"United
States","iata_code":"DEN","latitude":39.8617,"longitude":-104.673,"name":"Denver
International"}}}},"errors":["API key \"carbon_test\" could not be verified.
Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/rail_trips.json
body:
encoding: US-ASCII
string: rail_class=commuter&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"2.4 kg","object":{"value":2.362143293092419,"units":"kilograms"},"methodology":"from
distance, co2 emission factor, date, and timeframe"},"co2_emission_factor":{"description":"0.06364482122342524","object":0.06364482122342524,"methodology":"default"},"diesel_consumption":{"description":"0.32523107136721763","object":0.32523107136721763,"methodology":"from
distance and diesel intensity"},"electricity_consumption":{"description":"4.010861619796626","object":4.010861619796626,"methodology":"from
distance and electricity intensity"},"diesel_intensity":{"description":"0.008762920291076415","object":0.008762920291076415,"methodology":"default"},"electricity_intensity":{"description":"0.10806735200626398","object":0.10806735200626398,"methodology":"default"},"distance":{"description":"37.11446191042177
km","object":{"value":37.11446191042177,"units":"kilometres"},"methodology":"default"},"speed":{"description":"32.49720001220703","object":32.49720001220703,"methodology":"default"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"RailTrip","equivalents":{"cars_off_the_road_for_a_year":0.0004299100793428203,"cars_off_the_road_for_a_month":0.005154196665527658,"cars_off_the_road_for_a_week":0.02233406483618882,"cars_off_the_road_for_a_day":0.15676600178937145,"cars_to_priuses_for_a_year":0.0008598201586856405,"cars_to_priuses_for_a_month":0.010308393331055316,"cars_to_priuses_for_a_week":0.04466812967237764,"cars_to_priuses_for_a_day":0.3135320035787429,"one_way_domestic_flight":0.007676965702550361,"round_trip_domestic_flight":0.0038384828512751804,"one_way_cross_country_flight":0.0026975676407115425,"round_trip_cross_country_flight":0.0013487838203557713,"vegan_meals_instead_of_non_vegan_ones":1.9007860000886594,"days_of_veganism":0.6335953333628864,"weeks_of_veganism":0.0905126067047153,"months_of_veganism":0.021119923183539314,"years_of_veganism":0.0017361753204229277,"barrels_of_petroleum":0.005494345299732966,"canisters_of_bbq_propane":0.09842342459328182,"railroad_cars_full_of_coal":1.1810716465462095e-05,"homes_energy_in_a_year":0.00022912789942996462,"homes_energy_in_a_month":0.0027377240766941137,"homes_energy_in_a_week":0.011860321474617037,"homes_energy_in_a_day":0.08325846465162849,"homes_electricity_in_a_year":0.00034723506408458556,"homes_electricity_in_a_month":0.004155010052549564,"homes_electricity_in_a_week":0.01800425617995042,"homes_electricity_in_a_day":0.1263723040371513,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.012398890145442107,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.0055746581716981086,"replaced_refrigerators":0.002378678296144066,"loads_of_cold_laundry":1.0831891527670459,"lightbulbs_for_a_year":0.004360516519048605,"lightbulbs_for_a_month":0.053065549079321185,"lightbulbs_for_a_week":0.2274224319723519,"lightbulbs_for_a_day":1.5919641102363427,"lightbulbs_for_an_evening":9.551787023561348,"lightbulbs_to_CFLs_for_a_day":27.09727009527065,"lightbulbs_to_CFLs_for_a_week":3.8710379101405805,"lightbulbs_to_CFLs_for_a_month":0.9032434388425583,"lightbulbs_to_CFLs_for_a_year":0.07423980155860163,"days_with_lightbulbs_to_CFLs":0.6021622925617056,"weeks_with_lightbulbs_to_CFLs":0.08602217230454662,"months_with_lightbulbs_to_CFLs":0.02007113156140628,"years_with_lightbulbs_to_CFLs":0.0016487760185785085,"recycled_kgs_of_trash":1.6290639327976522,"recycled_bags_of_trash":0.9026576273058715},"methodology":"http://impact.brighterplanet.com/rail_trips?rail_class=commuter&timeframe=2012-01-01%2F2013-01-01","scope":"The
rail trip emission estimate is the anthropogenic emissions per passenger from
rail fuel combustion. It includes includes CO2 emissions from direct fuel
combustion and indirect fuel combustion to generate purchased electricity.","timeframe":"2012-01-01/2013-01-01","characteristics":{"rail_class":{"description":"commuter","object":{"rail_class":{"name":"commuter"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/rail_trips.json
body:
encoding: US-ASCII
string: rail_traction=electric&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"2.4 kg","object":{"value":2.362143293092419,"units":"kilograms"},"methodology":"from
distance, co2 emission factor, date, and timeframe"},"co2_emission_factor":{"description":"0.06364482122342524","object":0.06364482122342524,"methodology":"default"},"diesel_consumption":{"description":"0.32523107136721763","object":0.32523107136721763,"methodology":"from
distance and diesel intensity"},"electricity_consumption":{"description":"4.010861619796626","object":4.010861619796626,"methodology":"from
distance and electricity intensity"},"diesel_intensity":{"description":"0.008762920291076415","object":0.008762920291076415,"methodology":"default"},"electricity_intensity":{"description":"0.10806735200626398","object":0.10806735200626398,"methodology":"default"},"distance":{"description":"37.11446191042177
km","object":{"value":37.11446191042177,"units":"kilometres"},"methodology":"default"},"speed":{"description":"32.49720001220703","object":32.49720001220703,"methodology":"default"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"RailTrip","equivalents":{"cars_off_the_road_for_a_year":0.0004299100793428203,"cars_off_the_road_for_a_month":0.005154196665527658,"cars_off_the_road_for_a_week":0.02233406483618882,"cars_off_the_road_for_a_day":0.15676600178937145,"cars_to_priuses_for_a_year":0.0008598201586856405,"cars_to_priuses_for_a_month":0.010308393331055316,"cars_to_priuses_for_a_week":0.04466812967237764,"cars_to_priuses_for_a_day":0.3135320035787429,"one_way_domestic_flight":0.007676965702550361,"round_trip_domestic_flight":0.0038384828512751804,"one_way_cross_country_flight":0.0026975676407115425,"round_trip_cross_country_flight":0.0013487838203557713,"vegan_meals_instead_of_non_vegan_ones":1.9007860000886594,"days_of_veganism":0.6335953333628864,"weeks_of_veganism":0.0905126067047153,"months_of_veganism":0.021119923183539314,"years_of_veganism":0.0017361753204229277,"barrels_of_petroleum":0.005494345299732966,"canisters_of_bbq_propane":0.09842342459328182,"railroad_cars_full_of_coal":1.1810716465462095e-05,"homes_energy_in_a_year":0.00022912789942996462,"homes_energy_in_a_month":0.0027377240766941137,"homes_energy_in_a_week":0.011860321474617037,"homes_energy_in_a_day":0.08325846465162849,"homes_electricity_in_a_year":0.00034723506408458556,"homes_electricity_in_a_month":0.004155010052549564,"homes_electricity_in_a_week":0.01800425617995042,"homes_electricity_in_a_day":0.1263723040371513,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.012398890145442107,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.0055746581716981086,"replaced_refrigerators":0.002378678296144066,"loads_of_cold_laundry":1.0831891527670459,"lightbulbs_for_a_year":0.004360516519048605,"lightbulbs_for_a_month":0.053065549079321185,"lightbulbs_for_a_week":0.2274224319723519,"lightbulbs_for_a_day":1.5919641102363427,"lightbulbs_for_an_evening":9.551787023561348,"lightbulbs_to_CFLs_for_a_day":27.09727009527065,"lightbulbs_to_CFLs_for_a_week":3.8710379101405805,"lightbulbs_to_CFLs_for_a_month":0.9032434388425583,"lightbulbs_to_CFLs_for_a_year":0.07423980155860163,"days_with_lightbulbs_to_CFLs":0.6021622925617056,"weeks_with_lightbulbs_to_CFLs":0.08602217230454662,"months_with_lightbulbs_to_CFLs":0.02007113156140628,"years_with_lightbulbs_to_CFLs":0.0016487760185785085,"recycled_kgs_of_trash":1.6290639327976522,"recycled_bags_of_trash":0.9026576273058715},"methodology":"http://impact.brighterplanet.com/rail_trips?rail_traction=electric&timeframe=2012-01-01%2F2013-01-01","scope":"The
rail trip emission estimate is the anthropogenic emissions per passenger from
rail fuel combustion. It includes includes CO2 emissions from direct fuel
combustion and indirect fuel combustion to generate purchased electricity.","timeframe":"2012-01-01/2013-01-01","characteristics":{"rail_traction":{"description":"electric","object":{"rail_traction":{"name":"electric"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:18 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/residences.json
body:
encoding: US-ASCII
string: bathrooms=4&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"3838.4 kg","object":{"value":3838.3653959969083,"units":"kilograms"},"methodology":"from
fuel and electricity use and occupation and residents"},"fuel_oil_consumed":{"description":"199.0748055102","object":199.0748055102,"methodology":"from
research"},"natural_gas_consumed":{"description":"42683876171.345726","object":42683876171.345726,"methodology":"from
research"},"propane_consumed":{"description":"183.25178426979997","object":183.25178426979997,"methodology":"from
research"},"biomass_consumed":{"description":"3798201078.0000005","object":3798201078.0000005,"methodology":"from
research"},"kerosene_consumed":{"description":"4.0503906046","object":4.0503906046,"methodology":"from
research"},"coal_consumed":{"description":"2.871239704507795","object":2.871239704507795,"methodology":"from
research"},"dirty_electricity_generated":{"description":"11458.237337445968","object":11458.237337445968,"methodology":"from
electricity generated and green electricity"},"green_electricity":{"description":"0.0","object":0.0,"methodology":"default"},"electricity_generated":{"description":"11458.237337445968","object":11458.237337445968,"methodology":"from
electricity used and loss rate"},"electricity_used":{"description":"10752.83","object":10752.83,"methodology":"from
research"},"missing_annual_energy":{"description":"0","object":0,"methodology":"from
fuel reports"},"electricity_loss_rate":{"description":"0.06156333794384499","object":0.06156333794384499,"methodology":"default"},"electricity_emission_factor":{"description":"0.5894551291830981","object":0.5894551291830981,"methodology":"default"},"occupation":{"description":"0.937","object":0.937,"methodology":"default"},"residents":{"description":"2.57","object":2.57,"methodology":"default"},"air_conditioner_use":{"description":null,"object":{"air_conditioner_use":{"fugitive_emission":0.4994479354338,"fugitive_emission_units":"kilograms_per_square_metre","name":null}},"methodology":"default"},"predicted_fuel_shares":{"description":"{:fuel_oil=>0.4167932348735287,
:natural_gas=>0.1613371886801841, :propane=>0.2526592181590731, :kerosene=>0.008254483207514767,
:biomass=>0.014356500368116514, :coal=>0.0002819952840317706, :electricity=>0.14631737942755108}","object":{"fuel_oil":0.4167932348735287,"natural_gas":0.1613371886801841,"propane":0.2526592181590731,"kerosene":0.008254483207514767,"biomass":0.014356500368116514,"coal":0.0002819952840317706,"electricity":0.14631737942755108},"methodology":"from
research"},"predicted_annual_energy_consumption":{"description":"264563158193.84476","object":264563158193.84476,"methodology":"from
research"},"predicted_annual_fuel_oil_consumption":{"description":"199.0748055102","object":199.0748055102,"methodology":"default"},"predicted_annual_natural_gas_consumption":{"description":"42683876171.345726","object":42683876171.345726,"methodology":"default"},"predicted_annual_propane_consumption":{"description":"183.2517842698","object":183.2517842698,"methodology":"default"},"predicted_annual_kerosene_consumption":{"description":"4.0503906046","object":4.0503906046,"methodology":"default"},"predicted_annual_biomass_consumption":{"description":"3798201078.0","object":3798201078.0,"methodology":"default"},"predicted_annual_coal_consumption":{"description":"2.871239704507795","object":2.871239704507795,"methodology":"default"},"predicted_annual_electricity_use":{"description":"10752.83","object":10752.83,"methodology":"default"},"active_subtimeframe":{"description":"2012-01-01/2013-01-01","object":"2012-01-01/2013-01-01","methodology":"from
acquisition and retirement"},"acquisition":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
retirement"},"retirement":{"description":"2013-01-01","object":"2013-01-01","methodology":"from
acquisition"},"floorspace_estimate":{"description":"214.47688717440002","object":214.47688717440002,"methodology":"default"}},"emitter":"Residence","equivalents":{"cars_off_the_road_for_a_year":0.6985825020714374,"cars_off_the_road_for_a_month":8.375313294065254,"cars_off_the_road_for_a_week":36.291744819150765,"cars_off_the_road_for_a_day":254.7369578707308,"cars_to_priuses_for_a_year":1.3971650041428747,"cars_to_priuses_for_a_month":16.75062658813051,"cars_to_priuses_for_a_week":72.58348963830153,"cars_to_priuses_for_a_day":509.4739157414616,"one_way_domestic_flight":12.47468753698995,"round_trip_domestic_flight":6.237343768494975,"one_way_cross_country_flight":4.383413282228469,"round_trip_cross_country_flight":2.1917066411142345,"vegan_meals_instead_of_non_vegan_ones":3088.6827354085644,"days_of_veganism":1029.5609118028547,"weeks_of_veganism":147.07848524380952,"months_of_veganism":34.31882500560835,"years_of_veganism":2.8211985660577277,"barrels_of_petroleum":8.928037911088808,"canisters_of_bbq_propane":159.9331709550032,"railroad_cars_full_of_coal":0.019191826979984544,"homes_energy_in_a_year":0.3723214434117001,"homes_energy_in_a_month":4.448665493960417,"homes_energy_in_a_week":19.272432653300477,"homes_energy_in_a_day":135.29086511270302,"homes_electricity_in_a_year":0.5642397132115455,"homes_electricity_in_a_month":6.751684731558561,"homes_electricity_in_a_week":29.256021048288435,"homes_electricity_in_a_day":205.34871032043858,"homes_with_lowered_thermostat_2_degrees_for_a_winter":20.147579963587773,"homes_with_raised_thermostat_3_degrees_for_a_summer":9.058542334552705,"replaced_refrigerators":3.865233953768887,"loads_of_cold_laundry":1760.1285127191343,"lightbulbs_for_a_year":7.0856225210102926,"lightbulbs_for_a_month":86.22887862107054,"lightbulbs_for_a_week":369.55014359579036,"lightbulbs_for_a_day":2586.8625202667204,"lightbulbs_for_an_evening":15521.178959965717,"lightbulbs_to_CFLs_for_a_day":44031.71651940903,"lightbulbs_to_CFLs_for_a_week":6290.244120382606,"lightbulbs_to_CFLs_for_a_month":1467.7256752174858,"lightbulbs_to_CFLs_for_a_year":120.63598603078682,"days_with_lightbulbs_to_CFLs":978.4837834783237,"weeks_with_lightbulbs_to_CFLs":139.7817526260194,"months_with_lightbulbs_to_CFLs":32.61459076978573,"years_with_lightbulbs_to_CFLs":2.6791790464058423,"recycled_kgs_of_trash":2647.147887176248,"recycled_bags_of_trash":1466.7737605992786},"methodology":"http://impact.brighterplanet.com/residences?bathrooms=4&timeframe=2012-01-01%2F2013-01-01","scope":null,"timeframe":"2012-01-01/2013-01-01","characteristics":{"bathrooms":{"description":"4.0","object":4.0}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: origin_airport=MSN&destination_airport=ORD&segments_per_trip=1&trips=1&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"114.6 kg","object":{"value":114.57907360899101,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"836.8
MJ","object":{"value":836.784797960347,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"22.239122696392375","object":22.239122696392375,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"798.0839580419192","object":798.0839580419192,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"100.8961154095222","object":100.8961154095222,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"100.8961154095222","object":100.8961154095222,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"94.29543496217028","object":94.29543496217028,"methodology":"from
airports"},"route_inefficiency_factor":{"description":"1.07","object":1.07,"methodology":"from
country"},"dogleg_factor":{"description":"1.0","object":1.0,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"Fuel use equation","object":{"m3":4.046124738717439e-08,"m2":-4.096578631680186e-05,"m1":2.7511987541689704,"b":520.8741650385462},"methodology":"from
cohort"},"fuel":{"description":"Jet Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"44","object":44,"methodology":"from
seats and load factor"},"seats":{"description":"51.614277332823946","object":51.614277332823946,"methodology":"from
cohort"},"load_factor":{"description":"0.8511664076308222","object":0.8511664076308222,"methodology":"from
cohort"},"freight_share":{"description":"2.3873554715207264e-06","object":2.3873554715207264e-06,"methodology":"from
cohort"},"country":{"description":"US","object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":9.2669,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":882.0,"cooling_degree_days_units":"degrees_celsius","electricity_emission_factor":0.589455,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.0615633,"flight_route_inefficiency_factor":1.07,"heating_degree_days":2159.0,"heating_degree_days_units":"degrees_celsius","iso_3166_alpha_3_code":"USA","iso_3166_code":"US","iso_3166_numeric_code":840,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"United
States","rail_passengers":4467000000.0,"rail_speed":32.4972,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.0957617,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.0194247,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":12.9952,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.140512,"rail_trip_electricity_intensity_units":"kilowatt_hours_per_passenger_kilometre"}},"methodology":"from
origin airport and destination airport"},"cohort":{"description":"BrighterPlanet::Flight::ImpactModel::FlightSegmentCohort","object":{"members":91,"sql":"SELECT
* FROM `flight_segments` WHERE (`flight_segments`.`source` = ''BTS T100''
AND `flight_segments`.`year` IN (2011, 2012) AND `flight_segments`.`passengers`
> 0) AND `flight_segments`.`origin_airport_iata_code` = ''MSN'' AND `flight_segments`.`destination_airport_iata_code`
= ''ORD''"},"methodology":"from segments per trip and input"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.020853391396836365,"cars_off_the_road_for_a_month":0.2500115386148184,"cars_off_the_road_for_a_week":1.08334514097301,"cars_off_the_road_for_a_day":7.604154799134297,"cars_to_priuses_for_a_year":0.04170678279367273,"cars_to_priuses_for_a_month":0.5000230772296368,"cars_to_priuses_for_a_week":2.16669028194602,"cars_to_priuses_for_a_day":15.208309598268594,"one_way_domestic_flight":0.3723819892292208,"round_trip_domestic_flight":0.1861909946146104,"one_way_cross_country_flight":0.13084930206146772,"round_trip_cross_country_flight":0.06542465103073386,"vegan_meals_instead_of_non_vegan_ones":92.20029100519815,"days_of_veganism":30.73343033506605,"weeks_of_veganism":4.390440942549318,"months_of_veganism":1.0244514971379886,"years_of_veganism":0.08421561910260839,"barrels_of_petroleum":0.2665109252145131,"canisters_of_bbq_propane":4.774166260065829,"railroad_cars_full_of_coal":0.0005728953680449551,"homes_energy_in_a_year":0.011114170140072127,"homes_energy_in_a_month":0.13279714631282058,"homes_energy_in_a_week":0.5753015285907439,"homes_energy_in_a_day":4.0385686074961065,"homes_electricity_in_a_year":0.016843123820521676,"homes_electricity_in_a_month":0.20154459047821519,"homes_electricity_in_a_week":0.8733216990477295,"homes_electricity_in_a_day":6.12986585900741,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.6014255573735938,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.2704066137172188,"replaced_refrigerators":0.11538112712425395,"loads_of_cold_laundry":52.541609152286135,"lightbulbs_for_a_year":0.2115129698821974,"lightbulbs_for_a_month":2.5740188886259827,"lightbulbs_for_a_week":11.031444048926437,"lightbulbs_for_a_day":77.22045207970588,"lightbulbs_for_an_evening":463.32282705730887,"lightbulbs_to_CFLs_for_a_day":1314.3910930077736,"lightbulbs_to_CFLs_for_a_week":187.7701234070895,"lightbulbs_to_CFLs_for_a_month":43.81308990382681,"lightbulbs_to_CFLs_for_a_year":3.601105704456978,"days_with_lightbulbs_to_CFLs":29.208726602551206,"weeks_with_lightbulbs_to_CFLs":4.172626123618626,"months_with_lightbulbs_to_CFLs":0.9735783884555965,"years_with_lightbulbs_to_CFLs":0.07997619337907573,"recycled_kgs_of_trash":79.02003100980869,"recycled_bags_of_trash":43.78467429357178},"methodology":"http://impact.brighterplanet.com/flights?destination_airport=ORD&origin_airport=MSN&segments_per_trip=1&timeframe=2012-01-01%2F2013-01-01&trips=1","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2012-01-01/2013-01-01","characteristics":{"segments_per_trip":{"description":"1","object":1},"trips":{"description":"1","object":1},"origin_airport":{"description":"MSN","object":{"airport":{"city":"Madison","country_iso_3166_code":"US","country_name":"United
States","iata_code":"MSN","latitude":43.1399,"longitude":-89.3375,"name":"Dane
County Regional Truax Field"}}},"destination_airport":{"description":"ORD","object":{"airport":{"city":"Chicago","country_iso_3166_code":"US","country_name":"United
States","iata_code":"ORD","latitude":41.9786,"longitude":-87.9048,"name":"Chicago
Ohare International"}}}},"errors":["API key \"carbon_test\" could not be verified.
Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/residences.json
body:
encoding: US-ASCII
string: urbanity=City&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:18 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"3838.4 kg","object":{"value":3838.3653959969083,"units":"kilograms"},"methodology":"from
fuel and electricity use and occupation and residents"},"fuel_oil_consumed":{"description":"199.0748055102","object":199.0748055102,"methodology":"from
research"},"natural_gas_consumed":{"description":"42683876171.345726","object":42683876171.345726,"methodology":"from
research"},"propane_consumed":{"description":"183.25178426979997","object":183.25178426979997,"methodology":"from
research"},"biomass_consumed":{"description":"3798201078.0000005","object":3798201078.0000005,"methodology":"from
research"},"kerosene_consumed":{"description":"4.0503906046","object":4.0503906046,"methodology":"from
research"},"coal_consumed":{"description":"2.871239704507795","object":2.871239704507795,"methodology":"from
research"},"dirty_electricity_generated":{"description":"11458.237337445968","object":11458.237337445968,"methodology":"from
electricity generated and green electricity"},"green_electricity":{"description":"0.0","object":0.0,"methodology":"default"},"electricity_generated":{"description":"11458.237337445968","object":11458.237337445968,"methodology":"from
electricity used and loss rate"},"electricity_used":{"description":"10752.83","object":10752.83,"methodology":"from
research"},"missing_annual_energy":{"description":"0","object":0,"methodology":"from
fuel reports"},"electricity_loss_rate":{"description":"0.06156333794384499","object":0.06156333794384499,"methodology":"default"},"electricity_emission_factor":{"description":"0.5894551291830981","object":0.5894551291830981,"methodology":"default"},"occupation":{"description":"0.937","object":0.937,"methodology":"default"},"residents":{"description":"2.57","object":2.57,"methodology":"default"},"air_conditioner_use":{"description":null,"object":{"air_conditioner_use":{"fugitive_emission":0.4994479354338,"fugitive_emission_units":"kilograms_per_square_metre","name":null}},"methodology":"default"},"predicted_fuel_shares":{"description":"{:fuel_oil=>0.4167932348735287,
:natural_gas=>0.1613371886801841, :propane=>0.2526592181590731, :kerosene=>0.008254483207514767,
:biomass=>0.014356500368116514, :coal=>0.0002819952840317706, :electricity=>0.14631737942755108}","object":{"fuel_oil":0.4167932348735287,"natural_gas":0.1613371886801841,"propane":0.2526592181590731,"kerosene":0.008254483207514767,"biomass":0.014356500368116514,"coal":0.0002819952840317706,"electricity":0.14631737942755108},"methodology":"from
research"},"predicted_annual_energy_consumption":{"description":"264563158193.84476","object":264563158193.84476,"methodology":"from
research"},"predicted_annual_fuel_oil_consumption":{"description":"199.0748055102","object":199.0748055102,"methodology":"default"},"predicted_annual_natural_gas_consumption":{"description":"42683876171.345726","object":42683876171.345726,"methodology":"default"},"predicted_annual_propane_consumption":{"description":"183.2517842698","object":183.2517842698,"methodology":"default"},"predicted_annual_kerosene_consumption":{"description":"4.0503906046","object":4.0503906046,"methodology":"default"},"predicted_annual_biomass_consumption":{"description":"3798201078.0","object":3798201078.0,"methodology":"default"},"predicted_annual_coal_consumption":{"description":"2.871239704507795","object":2.871239704507795,"methodology":"default"},"predicted_annual_electricity_use":{"description":"10752.83","object":10752.83,"methodology":"default"},"active_subtimeframe":{"description":"2012-01-01/2013-01-01","object":"2012-01-01/2013-01-01","methodology":"from
acquisition and retirement"},"acquisition":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
retirement"},"retirement":{"description":"2013-01-01","object":"2013-01-01","methodology":"from
acquisition"},"floorspace_estimate":{"description":"214.47688717440002","object":214.47688717440002,"methodology":"default"}},"emitter":"Residence","equivalents":{"cars_off_the_road_for_a_year":0.6985825020714374,"cars_off_the_road_for_a_month":8.375313294065254,"cars_off_the_road_for_a_week":36.291744819150765,"cars_off_the_road_for_a_day":254.7369578707308,"cars_to_priuses_for_a_year":1.3971650041428747,"cars_to_priuses_for_a_month":16.75062658813051,"cars_to_priuses_for_a_week":72.58348963830153,"cars_to_priuses_for_a_day":509.4739157414616,"one_way_domestic_flight":12.47468753698995,"round_trip_domestic_flight":6.237343768494975,"one_way_cross_country_flight":4.383413282228469,"round_trip_cross_country_flight":2.1917066411142345,"vegan_meals_instead_of_non_vegan_ones":3088.6827354085644,"days_of_veganism":1029.5609118028547,"weeks_of_veganism":147.07848524380952,"months_of_veganism":34.31882500560835,"years_of_veganism":2.8211985660577277,"barrels_of_petroleum":8.928037911088808,"canisters_of_bbq_propane":159.9331709550032,"railroad_cars_full_of_coal":0.019191826979984544,"homes_energy_in_a_year":0.3723214434117001,"homes_energy_in_a_month":4.448665493960417,"homes_energy_in_a_week":19.272432653300477,"homes_energy_in_a_day":135.29086511270302,"homes_electricity_in_a_year":0.5642397132115455,"homes_electricity_in_a_month":6.751684731558561,"homes_electricity_in_a_week":29.256021048288435,"homes_electricity_in_a_day":205.34871032043858,"homes_with_lowered_thermostat_2_degrees_for_a_winter":20.147579963587773,"homes_with_raised_thermostat_3_degrees_for_a_summer":9.058542334552705,"replaced_refrigerators":3.865233953768887,"loads_of_cold_laundry":1760.1285127191343,"lightbulbs_for_a_year":7.0856225210102926,"lightbulbs_for_a_month":86.22887862107054,"lightbulbs_for_a_week":369.55014359579036,"lightbulbs_for_a_day":2586.8625202667204,"lightbulbs_for_an_evening":15521.178959965717,"lightbulbs_to_CFLs_for_a_day":44031.71651940903,"lightbulbs_to_CFLs_for_a_week":6290.244120382606,"lightbulbs_to_CFLs_for_a_month":1467.7256752174858,"lightbulbs_to_CFLs_for_a_year":120.63598603078682,"days_with_lightbulbs_to_CFLs":978.4837834783237,"weeks_with_lightbulbs_to_CFLs":139.7817526260194,"months_with_lightbulbs_to_CFLs":32.61459076978573,"years_with_lightbulbs_to_CFLs":2.6791790464058423,"recycled_kgs_of_trash":2647.147887176248,"recycled_bags_of_trash":1466.7737605992786},"methodology":"http://impact.brighterplanet.com/residences?timeframe=2012-01-01%2F2013-01-01&urbanity=City","scope":null,"timeframe":"2012-01-01/2013-01-01","characteristics":{"urbanity":{"description":"City","object":{"urbanity":{"name":"City"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: origin_airport=LAX&destination_airport=SFO&segments_per_trip=1&trips=1&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"158.9 kg","object":{"value":158.88245012544277,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"1160.3
MJ","object":{"value":1160.3377016414531,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"30.838146891474757","object":30.838146891474757,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"2809.4943974548605","object":2809.4943974548605,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"314.11399481652126","object":314.11399481652126,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"314.11399481652126","object":314.11399481652126,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"293.56448113693574","object":293.56448113693574,"methodology":"from
airports"},"route_inefficiency_factor":{"description":"1.07","object":1.07,"methodology":"from
country"},"dogleg_factor":{"description":"1.0","object":1.0,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"Fuel use equation","object":{"m3":1.0348093300372378e-07,"m2":-0.00023017671642226525,"m1":5.385202868809918,"b":1137.430624447256},"methodology":"from
cohort"},"fuel":{"description":"Jet Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"110","object":110,"methodology":"from
seats and load factor"},"seats":{"description":"141.62026378724536","object":141.62026378724536,"methodology":"from
cohort"},"load_factor":{"description":"0.7786548902022515","object":0.7786548902022515,"methodology":"from
cohort"},"freight_share":{"description":"0.01524089564944548","object":0.01524089564944548,"methodology":"from
cohort"},"country":{"description":"US","object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":9.2669,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":882.0,"cooling_degree_days_units":"degrees_celsius","electricity_emission_factor":0.589455,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.0615633,"flight_route_inefficiency_factor":1.07,"heating_degree_days":2159.0,"heating_degree_days_units":"degrees_celsius","iso_3166_alpha_3_code":"USA","iso_3166_code":"US","iso_3166_numeric_code":840,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"United
States","rail_passengers":4467000000.0,"rail_speed":32.4972,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.0957617,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.0194247,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":12.9952,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.140512,"rail_trip_electricity_intensity_units":"kilowatt_hours_per_passenger_kilometre"}},"methodology":"from
origin airport and destination airport"},"cohort":{"description":"BrighterPlanet::Flight::ImpactModel::FlightSegmentCohort","object":{"members":157,"sql":"SELECT
* FROM `flight_segments` WHERE (`flight_segments`.`source` = ''BTS T100''
AND `flight_segments`.`year` IN (2011, 2012) AND `flight_segments`.`passengers`
> 0) AND `flight_segments`.`origin_airport_iata_code` = ''LAX'' AND `flight_segments`.`destination_airport_iata_code`
= ''SFO''"},"methodology":"from segments per trip and input"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.028916605922830584,"cars_off_the_road_for_a_month":0.3466815061737161,"cars_off_the_road_for_a_week":1.5022335659360615,"cars_off_the_road_for_a_day":10.544392685025134,"cars_to_priuses_for_a_year":0.05783321184566117,"cars_to_priuses_for_a_month":0.6933630123474323,"cars_to_priuses_for_a_week":3.004467131872123,"cars_to_priuses_for_a_day":21.088785370050267,"one_way_domestic_flight":0.5163679629076889,"round_trip_domestic_flight":0.25818398145384447,"one_way_cross_country_flight":0.18144375804325566,"round_trip_cross_country_flight":0.09072187902162783,"vegan_meals_instead_of_non_vegan_ones":127.85064214409218,"days_of_veganism":42.61688071469739,"weeks_of_veganism":6.088057723906716,"months_of_veganism":1.4205679865715837,"years_of_veganism":0.11677860084220043,"barrels_of_petroleum":0.36956057899177985,"canisters_of_bbq_propane":6.620155049376825,"railroad_cars_full_of_coal":0.000794412250627214,"homes_energy_in_a_year":0.01541159766216795,"homes_energy_in_a_month":0.18414475969538818,"homes_energy_in_a_week":0.7977487820798482,"homes_energy_in_a_day":5.600129719571481,"homes_electricity_in_a_year":0.023355720168440088,"homes_electricity_in_a_month":0.27947422977065384,"homes_electricity_in_a_week":1.2110020348561248,"homes_electricity_in_a_day":8.500052199261063,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.8339739807084492,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.37496258229604496,"replaced_refrigerators":0.15999462727632088,"loads_of_cold_laundry":72.85745409442329,"lightbulbs_for_a_year":0.29329700293156735,"lightbulbs_for_a_month":3.5692942420680716,"lightbulbs_for_a_week":15.29688453317738,"lightbulbs_for_a_day":107.07866837959203,"lightbulbs_for_an_evening":642.4721691600023,"lightbulbs_to_CFLs_for_a_day":1822.6162134352137,"lightbulbs_to_CFLs_for_a_week":260.37369938147333,"lightbulbs_to_CFLs_for_a_month":60.75394792631718,"lightbulbs_to_CFLs_for_a_year":4.993516524992541,"days_with_lightbulbs_to_CFLs":40.50263195087812,"weeks_with_lightbulbs_to_CFLs":5.786022186218249,"months_with_lightbulbs_to_CFLs":1.350024178715887,"years_with_lightbulbs_to_CFLs":0.11089995018755906,"recycled_kgs_of_trash":109.57407614126224,"recycled_bags_of_trash":60.71454507868607},"methodology":"http://impact.brighterplanet.com/flights?destination_airport=SFO&origin_airport=LAX&segments_per_trip=1&timeframe=2012-01-01%2F2013-01-01&trips=1","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2012-01-01/2013-01-01","characteristics":{"segments_per_trip":{"description":"1","object":1},"trips":{"description":"1","object":1},"origin_airport":{"description":"LAX","object":{"airport":{"city":"Los
Angeles","country_iso_3166_code":"US","country_name":"United States","iata_code":"LAX","latitude":33.9425,"longitude":-118.408,"name":"Los
Angeles International"}}},"destination_airport":{"description":"SFO","object":{"airport":{"city":"San
Francisco","country_iso_3166_code":"US","country_name":"United States","iata_code":"SFO","latitude":37.619,"longitude":-122.375,"name":"San
Francisco International"}}}},"errors":["API key \"carbon_test\" could not
be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/residences.json
body:
encoding: US-ASCII
string: zip_code=53703&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"5347.6 kg","object":{"value":5347.558533487308,"units":"kilograms"},"methodology":"from
fuel and electricity use and occupation and residents"},"fuel_oil_consumed":{"description":"5.107308940163401","object":5.107308940163401,"methodology":"from
research"},"natural_gas_consumed":{"description":"76177899552.30473","object":76177899552.30473,"methodology":"from
research"},"propane_consumed":{"description":"22.944562877620424","object":22.944562877620424,"methodology":"from
research"},"biomass_consumed":{"description":"5473676905.856849","object":5473676905.856849,"methodology":"from
research"},"kerosene_consumed":{"description":"0.1386025292336304","object":0.1386025292336304,"methodology":"from
research"},"coal_consumed":{"description":"2.871239704507795","object":2.871239704507795,"methodology":"from
research"},"dirty_electricity_generated":{"description":"12283.618712298754","object":12283.618712298754,"methodology":"from
electricity generated and green electricity"},"green_electricity":{"description":"0.0","object":0.0,"methodology":"default"},"electricity_generated":{"description":"12283.618712298754","object":12283.618712298754,"methodology":"from
electricity used and loss rate"},"electricity_used":{"description":"11488.771541025197","object":11488.771541025197,"methodology":"from
research"},"missing_annual_energy":{"description":"0","object":0,"methodology":"from
fuel reports"},"electricity_loss_rate":{"description":"0.0647079","object":0.0647079,"methodology":"from
egrid region"},"electricity_emission_factor":{"description":"0.771877","object":0.771877,"methodology":"from
egrid subregion"},"egrid_region":{"description":"E","object":{"egrid_region":{"country_name":"US","loss_factor":0.0647079,"name":"E"}},"methodology":"from
egrid subregion"},"egrid_subregion":{"description":"MROE","object":{"egrid_subregion":{"abbreviation":"MROE","egrid_region_name":"E","electricity_ch4_emission_factor":0.000326475,"electricity_ch4_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_co2_biogenic_emission_factor":0.0,"electricity_co2_biogenic_emission_factor_units":"kilograms_per_kilowatt_hour","electricity_co2_emission_factor":0.767624,"electricity_co2_emission_factor_units":"kilograms_per_kilowatt_hour","electricity_emission_factor":0.771877,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_n2o_emission_factor":0.00392646,"electricity_n2o_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","name":"MRO
East","nerc_abbreviation":"MRO","net_generation":29585900.0,"net_generation_units":"megawatt_hours"}},"methodology":"from_zip_code"},"occupation":{"description":"0.937","object":0.937,"methodology":"default"},"residents":{"description":"2.529825598664091","object":2.529825598664091,"methodology":"from
cohort"},"air_conditioner_use":{"description":null,"object":{"air_conditioner_use":{"fugitive_emission":0.4994479354338,"fugitive_emission_units":"kilograms_per_square_metre","name":null}},"methodology":"default"},"predicted_fuel_shares":{"description":"{:fuel_oil=>0.021055205795588075,
:natural_gas=>0.5669733267067846, :propane=>0.062291634223303124, :kerosene=>0.0005561950728947863,
:biomass=>0.0407392278189674, :coal=>0.0005552708129138704, :electricity=>0.3078291395695482}","object":{"fuel_oil":0.021055205795588075,"natural_gas":0.5669733267067846,"propane":0.062291634223303124,"kerosene":0.0005561950728947863,"biomass":0.0407392278189674,"coal":0.0005552708129138704,"electricity":0.3078291395695482},"methodology":"from
research"},"predicted_annual_energy_consumption":{"description":"134358877153.49408","object":134358877153.49408,"methodology":"from
research"},"predicted_annual_fuel_oil_consumption":{"description":"5.107308940163401","object":5.107308940163401,"methodology":"from
cohort"},"predicted_annual_natural_gas_consumption":{"description":"76177899552.30473","object":76177899552.30473,"methodology":"from
cohort"},"predicted_annual_propane_consumption":{"description":"22.944562877620424","object":22.944562877620424,"methodology":"from
cohort"},"predicted_annual_kerosene_consumption":{"description":"0.1386025292336304","object":0.1386025292336304,"methodology":"from
cohort"},"predicted_annual_biomass_consumption":{"description":"5473676905.856849","object":5473676905.856849,"methodology":"from
cohort"},"predicted_annual_coal_consumption":{"description":"2.871239704507795","object":2.871239704507795,"methodology":"default"},"predicted_annual_electricity_use":{"description":"11488.771541025197","object":11488.771541025197,"methodology":"from
cohort"},"active_subtimeframe":{"description":"2012-01-01/2013-01-01","object":"2012-01-01/2013-01-01","methodology":"from
acquisition and retirement"},"acquisition":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
retirement"},"retirement":{"description":"2013-01-01","object":"2013-01-01","methodology":"from
acquisition"},"floorspace_estimate":{"description":"251.33578577294895","object":251.33578577294895,"methodology":"from
cohort"},"cohort":{"description":"Cohort analysis","object":{"count":560,"sql":"SELECT
FROM `recs_responses` WHERE `recs_responses`.`cooling_degree_days` BETWEEN
-268.889 AND 1231.1109999999999 AND `recs_responses`.`census_region_number`
= 2"},"methodology":"from residential energy consumption survey"},"census_region":{"description":2,"object":{"census_region":{"name":"Midwest
Region","number":2}},"methodology":"from census division"},"census_division":{"description":3,"object":{"census_division":{"census_region_name":"Midwest
Region","census_region_number":2,"meeting_building_district_heat_intensity":0.0,"meeting_building_district_heat_intensity_units":"megajoules_per_square_metre_hour","meeting_building_electricity_intensity":0.0811925,"meeting_building_electricity_intensity_units":"kilowatt_hours_per_square_metre_hour","meeting_building_fuel_oil_intensity":0.00114088,"meeting_building_fuel_oil_intensity_units":"litres_per_square_metre_hour","meeting_building_natural_gas_intensity":0.0486167,"meeting_building_natural_gas_intensity_units":"cubic_metres_per_square_metre_hour","name":"East
North Central Division","number":3}},"methodology":"from state"},"state":{"description":"WI","object":{"state":{"census_division_number":3,"electricity_emission_factor":0.746256,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.0647079,"fips_code":55,"name":"Wisconsin","petroleum_administration_for_defense_district_code":"2","population":5687012,"postal_abbreviation":"WI"}},"methodology":"from
climate division"},"heating_degree_days":{"description":"2925.0..4425.0","object":[2925.0,4425.0],"methodology":"from
climate division"},"cooling_degree_days":{"description":"-268.889..1231.1109999999999","object":[-268.889,1231.1109999999999],"methodology":"from
climate division"},"climate_division":{"description":"WI8","object":{"climate_division":{"cooling_degree_days":481.111,"cooling_degree_days_units":"degrees_celsius","heating_degree_days":3675.0,"heating_degree_days_units":"degrees_celsius","name":"WI8","state_postal_abbreviation":"WI"}},"methodology":"from
zip code"}},"emitter":"Residence","equivalents":{"cars_off_the_road_for_a_year":0.97325565309469,"cars_off_the_road_for_a_month":11.668372720069305,"cars_off_the_road_for_a_week":50.56116593412249,"cars_off_the_road_for_a_day":354.8960696334186,"cars_to_priuses_for_a_year":1.94651130618938,"cars_to_priuses_for_a_month":23.33674544013861,"cars_to_priuses_for_a_week":101.12233186824498,"cars_to_priuses_for_a_day":709.7921392668372,"one_way_domestic_flight":17.37956523383375,"round_trip_domestic_flight":8.689782616916874,"one_way_cross_country_flight":6.1069118452425055,"round_trip_cross_country_flight":3.0534559226212528,"vegan_meals_instead_of_non_vegan_ones":4303.110833636301,"days_of_veganism":1434.370277878767,"weeks_of_veganism":204.90774788616665,"months_of_veganism":47.812520847910015,"years_of_veganism":3.930455522113171,"barrels_of_petroleum":12.438421148891477,"canisters_of_bbq_propane":222.81672141481567,"railroad_cars_full_of_coal":0.02673779266743654,"homes_energy_in_a_year":0.5187131777482689,"homes_energy_in_a_month":6.19782034031179,"homes_energy_in_a_week":26.850091396639773,"homes_energy_in_a_day":188.48539562982714,"homes_electricity_in_a_year":0.7860911044226342,"homes_electricity_in_a_month":9.406355460404173,"homes_electricity_in_a_week":40.75909114224026,"homes_electricity_in_a_day":286.08903398303744,"homes_with_lowered_thermostat_2_degrees_for_a_winter":28.06933474227488,"homes_with_raised_thermostat_3_degrees_for_a_summer":12.620238139030047,"replaced_refrigerators":5.384991443221719,"loads_of_cold_laundry":2452.187136233007,"lightbulbs_for_a_year":9.87159305281757,"lightbulbs_for_a_month":120.13290245479236,"lightbulbs_for_a_week":514.852240487091,"lightbulbs_for_a_day":3603.9817260852374,"lightbulbs_for_an_evening":21623.895704069957,"lightbulbs_to_CFLs_for_a_day":61344.389375494844,"lightbulbs_to_CFLs_for_a_week":8763.482668625396,"lightbulbs_to_CFLs_for_a_month":2044.815474710477,"lightbulbs_to_CFLs_for_a_year":168.06841714897257,"days_with_lightbulbs_to_CFLs":1363.2103164736513,"weeks_with_lightbulbs_to_CFLs":194.74203911400727,"months_with_lightbulbs_to_CFLs":45.43820485904165,"years_with_lightbulbs_to_CFLs":3.732595856374141,"recycled_kgs_of_trash":3687.9704804121893,"recycled_bags_of_trash":2043.4892801941724},"methodology":"http://impact.brighterplanet.com/residences?timeframe=2012-01-01%2F2013-01-01&zip_code=53703","scope":null,"timeframe":"2012-01-01/2013-01-01","characteristics":{"zip_code":{"description":"53703","object":{"zip_code":{"climate_division_name":"WI8","description":"Madison","egrid_subregion_abbreviation":"MROE","latitude":"43.078646","longitude":"-89.37727","name":"53703","population":27958,"state_postal_abbreviation":"WI"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/automobile_trips.json
body:
encoding: US-ASCII
string: make=Nissan&model=Altima&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"4.0 kg","object":{"value":4.013703182098099,"units":"kilograms"},"methodology":"from
co2 emission, ch4 emission, n2o emission, and hfc emission"},"co2_emission":{"description":"3.825618174704137","object":3.825618174704137,"methodology":"from
fuel use and automobile fuel"},"co2_biogenic_emission":{"description":"0.0","object":0.0,"methodology":"from
fuel use and automobile fuel"},"ch4_emission":{"description":"0.003940422073319416","object":0.003940422073319416,"methodology":"from
fuel use and automobile fuel"},"n2o_emission":{"description":"0.013398860212759267","object":0.013398860212759267,"methodology":"from
fuel use and automobile fuel"},"hfc_emission":{"description":"0.17074572510788322","object":0.17074572510788322,"methodology":"from
fuel use and automobile fuel"},"energy":{"description":"56.5 MJ","object":{"value":56.5122465095761,"units":"megajoules"},"methodology":"from
fuel use and automobile fuel"},"automobile_fuel":{"description":"fallback","object":{"automobile_fuel":{"annual_distance":17923.116724381467,"annual_distance_units":"kilometres","base_fuel_name":null,"blend_fuel_name":null,"blend_portion":null,"ch4_emission_factor":0.002420994361601003,"ch4_emission_factor_units":"kilograms_co2e_per_litre","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.3504588742684827,"co2_emission_factor_units":"kilograms_per_litre","code":null,"distance_key":null,"ef_key":null,"emission_factor":null,"emission_factor_units":null,"energy_content":34.72111048394262,"energy_content_units":null,"hfc_emission_factor":0.1049061318970414,"hfc_emission_factor_units":"kilograms_co2e_per_litre","n2o_emission_factor":0.008232256449534075,"n2o_emission_factor_units":"kilograms_co2e_per_litre","name":"fallback"}},"methodology":"default"},"fuel_use":{"description":"1.6276048122283178
l","object":{"value":1.6276048122283178,"units":"litres"},"methodology":"from
fuel efficiency, distance, date, and timeframe"},"distance":{"description":"16.3348
km","object":{"value":16.3348,"units":"kilometres"},"methodology":"from safe
country"},"speed":{"description":"50.94382232429702 km/h","object":{"value":50.94382232429702,"units":"kilometres_per_hour"},"methodology":"from
urbanity and safe country"},"fuel_efficiency":{"description":"10.036097139351897
km/l","object":{"value":10.036097139351897,"units":"kilometres_per_litre"},"methodology":"from
make model and urbanity"},"hybridity_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"urbanity":{"description":"0.43","object":0.43,"methodology":"from
safe country"},"safe_country":{"description":null,"object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":8.226530750610781,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":null,"cooling_degree_days_units":null,"electricity_emission_factor":0.626089,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.096,"flight_route_inefficiency_factor":1.100000023841858,"heating_degree_days":null,"heating_degree_days_units":null,"iso_3166_alpha_3_code":null,"iso_3166_code":null,"iso_3166_numeric_code":null,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"fallback","rail_passengers":null,"rail_speed":32.49720001220703,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.06364482122342524,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.008762920291076415,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":37.11446191042177,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.10806735200626398,"rail_trip_electricity_intensity_units":"kilowatt_hour_per_passenger_kilometre"}},"methodology":"default"},"make_model":{"description":"Nissan
ALTIMA","object":{"automobile_make_model":{"fuel_efficiency_city":8.47904,"fuel_efficiency_city_units":"kilometres_per_litre","fuel_efficiency_highway":11.65,"fuel_efficiency_highway_units":"kilometres_per_litre","make_name":"Nissan","model_name":"ALTIMA","name":"Nissan
ALTIMA"}},"methodology":"from make and model"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"AutomobileTrip","equivalents":{"cars_off_the_road_for_a_year":0.000730493979141854,"cars_off_the_road_for_a_month":0.008757900343338051,"cars_off_the_road_for_a_week":0.037949563586737525,"cars_off_the_road_for_a_day":0.2663734253831224,"cars_to_priuses_for_a_year":0.001460987958283708,"cars_to_priuses_for_a_month":0.017515800686676103,"cars_to_priuses_for_a_week":0.07589912717347505,"cars_to_priuses_for_a_day":0.5327468507662448,"one_way_domestic_flight":0.013044535341818821,"round_trip_domestic_flight":0.0065222676709094105,"one_way_cross_country_flight":0.0045836490339560285,"round_trip_cross_country_flight":0.0022918245169780142,"vegan_meals_instead_of_non_vegan_ones":3.229774772492973,"days_of_veganism":1.0765915908309909,"weeks_of_veganism":0.15379707853163493,"months_of_veganism":0.0358865201511391,"years_of_veganism":0.0029500718388421024,"barrels_of_petroleum":0.009335873601560178,"canisters_of_bbq_propane":0.1672389704884815,"railroad_cars_full_of_coal":2.0068515910490494e-05,"homes_energy_in_a_year":0.0003893292086635156,"homes_energy_in_a_month":0.004651881988051697,"homes_energy_in_a_week":0.020152803677314556,"homes_energy_in_a_day":0.14147099605941169,"homes_electricity_in_a_year":0.0005900143677684205,"homes_electricity_in_a_month":0.007060103897310556,"homes_electricity_in_a_week":0.03059244565395171,"homes_electricity_in_a_day":0.21472910653906618,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.02106792800283292,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.009472339509751513,"replaced_refrigerators":0.004041799104372786,"loads_of_cold_laundry":1.8405317585892684,"lightbulbs_for_a_year":0.00740929607415309,"lightbulbs_for_a_month":0.09016784198583379,"lightbulbs_for_a_week":0.3864313149660408,"lightbulbs_for_a_day":2.7050312458718317,"lightbulbs_for_an_evening":16.23019148893417,"lightbulbs_to_CFLs_for_a_day":46.04309972456197,"lightbulbs_to_CFLs_for_a_week":6.577584528165087,"lightbulbs_to_CFLs_for_a_month":1.5347718638802172,"lightbulbs_to_CFLs_for_a_year":0.12614667731016113,"days_with_lightbulbs_to_CFLs":1.0231812425868114,"weeks_with_lightbulbs_to_CFLs":0.14616702878246646,"months_with_lightbulbs_to_CFLs":0.03410443593828754,"years_with_lightbulbs_to_CFLs":0.0028015648211044734,"recycled_kgs_of_trash":2.7680704680498645,"recycled_bags_of_trash":1.533776465491057},"methodology":"http://impact.brighterplanet.com/automobile_trips?make=Nissan&model=Altima&timeframe=2012-01-01%2F2013-01-01","scope":"The
automobile trip emission estimate is the total anthropogenic emissions from
fuel and air conditioning used by the automobile during the trip. It includes
CO2 emissions from combustion of non-biogenic fuel, CH4 and N2O emissions
from combustion of all fuel, and fugitive HFC emissions from air conditioning.","timeframe":"2012-01-01/2013-01-01","characteristics":{"make":{"description":"Nissan","object":{"automobile_make":{"fuel_efficiency":11.9656,"fuel_efficiency_units":"kilometres_per_litre","name":"Nissan"}}},"model":{"description":"ALTIMA","object":{"automobile_model":{"name":"ALTIMA"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/automobile_trips.json
body:
encoding: US-ASCII
string: make=Ford&model=Taurus&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"4.6 kg","object":{"value":4.563713093427252,"units":"kilograms"},"methodology":"from
co2 emission, ch4 emission, n2o emission, and hfc emission"},"co2_emission":{"description":"4.349854227442925","object":4.349854227442925,"methodology":"from
fuel use and automobile fuel"},"co2_biogenic_emission":{"description":"0.0","object":0.0,"methodology":"from
fuel use and automobile fuel"},"ch4_emission":{"description":"0.004480390052220374","object":0.004480390052220374,"methodology":"from
fuel use and automobile fuel"},"n2o_emission":{"description":"0.015234946635492488","object":0.015234946635492488,"methodology":"from
fuel use and automobile fuel"},"hfc_emission":{"description":"0.19414352929661446","object":0.19414352929661446,"methodology":"from
fuel use and automobile fuel"},"energy":{"description":"64.3 MJ","object":{"value":64.25629091982954,"units":"megajoules"},"methodology":"from
fuel use and automobile fuel"},"automobile_fuel":{"description":"fallback","object":{"automobile_fuel":{"annual_distance":17923.116724381467,"annual_distance_units":"kilometres","base_fuel_name":null,"blend_fuel_name":null,"blend_portion":null,"ch4_emission_factor":0.002420994361601003,"ch4_emission_factor_units":"kilograms_co2e_per_litre","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.3504588742684827,"co2_emission_factor_units":"kilograms_per_litre","code":null,"distance_key":null,"ef_key":null,"emission_factor":null,"emission_factor_units":null,"energy_content":34.72111048394262,"energy_content_units":null,"hfc_emission_factor":0.1049061318970414,"hfc_emission_factor_units":"kilograms_co2e_per_litre","n2o_emission_factor":0.008232256449534075,"n2o_emission_factor_units":"kilograms_co2e_per_litre","name":"fallback"}},"methodology":"default"},"fuel_use":{"description":"1.850640432412033
l","object":{"value":1.850640432412033,"units":"litres"},"methodology":"from
fuel efficiency, distance, date, and timeframe"},"distance":{"description":"16.3348
km","object":{"value":16.3348,"units":"kilometres"},"methodology":"from safe
country"},"speed":{"description":"50.94382232429702 km/h","object":{"value":50.94382232429702,"units":"kilometres_per_hour"},"methodology":"from
urbanity and safe country"},"fuel_efficiency":{"description":"8.826566043793841
km/l","object":{"value":8.826566043793841,"units":"kilometres_per_litre"},"methodology":"from
make model and urbanity"},"hybridity_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"urbanity":{"description":"0.43","object":0.43,"methodology":"from
safe country"},"safe_country":{"description":null,"object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":8.226530750610781,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":null,"cooling_degree_days_units":null,"electricity_emission_factor":0.626089,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.096,"flight_route_inefficiency_factor":1.100000023841858,"heating_degree_days":null,"heating_degree_days_units":null,"iso_3166_alpha_3_code":null,"iso_3166_code":null,"iso_3166_numeric_code":null,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"fallback","rail_passengers":null,"rail_speed":32.49720001220703,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.06364482122342524,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.008762920291076415,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":37.11446191042177,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.10806735200626398,"rail_trip_electricity_intensity_units":"kilowatt_hour_per_passenger_kilometre"}},"methodology":"default"},"make_model":{"description":"Ford
TAURUS","object":{"automobile_make_model":{"fuel_efficiency_city":7.20551,"fuel_efficiency_city_units":"kilometres_per_litre","fuel_efficiency_highway":10.6308,"fuel_efficiency_highway_units":"kilometres_per_litre","make_name":"Ford","model_name":"TAURUS","name":"Ford
TAURUS"}},"methodology":"from make and model"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"AutomobileTrip","equivalents":{"cars_off_the_road_for_a_year":0.0008305957830037599,"cars_off_the_road_for_a_month":0.009958021969858262,"cars_off_the_road_for_a_week":0.04314990729835466,"cars_off_the_road_for_a_day":0.30287538315839296,"cars_to_priuses_for_a_year":0.0016611915660075197,"cars_to_priuses_for_a_month":0.019916043939716525,"cars_to_priuses_for_a_week":0.08629981459670932,"cars_to_priuses_for_a_day":0.6057507663167859,"one_way_domestic_flight":0.014832067553638566,"round_trip_domestic_flight":0.007416033776819283,"one_way_cross_country_flight":0.005211760352693921,"round_trip_cross_country_flight":0.0026058801763469606,"vegan_meals_instead_of_non_vegan_ones":3.672360598010695,"days_of_veganism":1.2241201993368982,"weeks_of_veganism":0.17487235831394543,"months_of_veganism":0.04080415876833306,"years_of_veganism":0.00335432912366903,"barrels_of_petroleum":0.010615196655311788,"canisters_of_bbq_propane":0.1901562334638333,"railroad_cars_full_of_coal":2.281856546713626e-05,"homes_energy_in_a_year":0.0004426801700624434,"homes_energy_in_a_month":0.005289343475282185,"homes_energy_in_a_week":0.022914403442098233,"homes_energy_in_a_day":0.16085719540403035,"homes_electricity_in_a_year":0.000670865824733806,"homes_electricity_in_a_month":0.008027571331338535,"homes_electricity_in_a_week":0.034784621198102515,"homes_electricity_in_a_day":0.2441540867852645,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.023954930027399644,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.010770362900488314,"replaced_refrigerators":0.004595659085081243,"loads_of_cold_laundry":2.0927454035481876,"lightbulbs_for_a_year":0.008424614370466706,"lightbulbs_for_a_month":0.1025238146438432,"lightbulbs_for_a_week":0.43938516920898896,"lightbulbs_for_a_day":3.075709875602203,"lightbulbs_for_an_evening":18.454263817326307,"lightbulbs_to_CFLs_for_a_day":52.35252522213647,"lightbulbs_to_CFLs_for_a_week":7.478930870672898,"lightbulbs_to_CFLs_for_a_month":1.7450863038039925,"lightbulbs_to_CFLs_for_a_year":0.14343293881332508,"days_with_lightbulbs_to_CFLs":1.1633908692026618,"weeks_with_lightbulbs_to_CFLs":0.1661967397233402,"months_with_lightbulbs_to_CFLs":0.03877787015485135,"years_with_lightbulbs_to_CFLs":0.003185471739212222,"recycled_kgs_of_trash":3.1473875534475715,"recycled_bags_of_trash":1.7439545029568229},"methodology":"http://impact.brighterplanet.com/automobile_trips?make=Ford&model=Taurus&timeframe=2012-01-01%2F2013-01-01","scope":"The
automobile trip emission estimate is the total anthropogenic emissions from
fuel and air conditioning used by the automobile during the trip. It includes
CO2 emissions from combustion of non-biogenic fuel, CH4 and N2O emissions
from combustion of all fuel, and fugitive HFC emissions from air conditioning.","timeframe":"2012-01-01/2013-01-01","characteristics":{"make":{"description":"Ford","object":{"automobile_make":{"fuel_efficiency":10.2999,"fuel_efficiency_units":"kilometres_per_litre","name":"Ford"}}},"model":{"description":"TAURUS","object":{"automobile_model":{"name":"TAURUS"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/residences.json
body:
encoding: US-ASCII
string: bathrooms=4&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"3838.4 kg","object":{"value":3838.3653959969083,"units":"kilograms"},"methodology":"from
fuel and electricity use and occupation and residents"},"fuel_oil_consumed":{"description":"199.0748055102","object":199.0748055102,"methodology":"from
research"},"natural_gas_consumed":{"description":"42683876171.345726","object":42683876171.345726,"methodology":"from
research"},"propane_consumed":{"description":"183.25178426979997","object":183.25178426979997,"methodology":"from
research"},"biomass_consumed":{"description":"3798201078.0000005","object":3798201078.0000005,"methodology":"from
research"},"kerosene_consumed":{"description":"4.0503906046","object":4.0503906046,"methodology":"from
research"},"coal_consumed":{"description":"2.871239704507795","object":2.871239704507795,"methodology":"from
research"},"dirty_electricity_generated":{"description":"11458.237337445968","object":11458.237337445968,"methodology":"from
electricity generated and green electricity"},"green_electricity":{"description":"0.0","object":0.0,"methodology":"default"},"electricity_generated":{"description":"11458.237337445968","object":11458.237337445968,"methodology":"from
electricity used and loss rate"},"electricity_used":{"description":"10752.83","object":10752.83,"methodology":"from
research"},"missing_annual_energy":{"description":"0","object":0,"methodology":"from
fuel reports"},"electricity_loss_rate":{"description":"0.06156333794384499","object":0.06156333794384499,"methodology":"default"},"electricity_emission_factor":{"description":"0.5894551291830981","object":0.5894551291830981,"methodology":"default"},"occupation":{"description":"0.937","object":0.937,"methodology":"default"},"residents":{"description":"2.57","object":2.57,"methodology":"default"},"air_conditioner_use":{"description":null,"object":{"air_conditioner_use":{"fugitive_emission":0.4994479354338,"fugitive_emission_units":"kilograms_per_square_metre","name":null}},"methodology":"default"},"predicted_fuel_shares":{"description":"{:fuel_oil=>0.4167932348735287,
:natural_gas=>0.1613371886801841, :propane=>0.2526592181590731, :kerosene=>0.008254483207514767,
:biomass=>0.014356500368116514, :coal=>0.0002819952840317706, :electricity=>0.14631737942755108}","object":{"fuel_oil":0.4167932348735287,"natural_gas":0.1613371886801841,"propane":0.2526592181590731,"kerosene":0.008254483207514767,"biomass":0.014356500368116514,"coal":0.0002819952840317706,"electricity":0.14631737942755108},"methodology":"from
research"},"predicted_annual_energy_consumption":{"description":"264563158193.84476","object":264563158193.84476,"methodology":"from
research"},"predicted_annual_fuel_oil_consumption":{"description":"199.0748055102","object":199.0748055102,"methodology":"default"},"predicted_annual_natural_gas_consumption":{"description":"42683876171.345726","object":42683876171.345726,"methodology":"default"},"predicted_annual_propane_consumption":{"description":"183.2517842698","object":183.2517842698,"methodology":"default"},"predicted_annual_kerosene_consumption":{"description":"4.0503906046","object":4.0503906046,"methodology":"default"},"predicted_annual_biomass_consumption":{"description":"3798201078.0","object":3798201078.0,"methodology":"default"},"predicted_annual_coal_consumption":{"description":"2.871239704507795","object":2.871239704507795,"methodology":"default"},"predicted_annual_electricity_use":{"description":"10752.83","object":10752.83,"methodology":"default"},"active_subtimeframe":{"description":"2012-01-01/2013-01-01","object":"2012-01-01/2013-01-01","methodology":"from
acquisition and retirement"},"acquisition":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
retirement"},"retirement":{"description":"2013-01-01","object":"2013-01-01","methodology":"from
acquisition"},"floorspace_estimate":{"description":"214.47688717440002","object":214.47688717440002,"methodology":"default"}},"emitter":"Residence","equivalents":{"cars_off_the_road_for_a_year":0.6985825020714374,"cars_off_the_road_for_a_month":8.375313294065254,"cars_off_the_road_for_a_week":36.291744819150765,"cars_off_the_road_for_a_day":254.7369578707308,"cars_to_priuses_for_a_year":1.3971650041428747,"cars_to_priuses_for_a_month":16.75062658813051,"cars_to_priuses_for_a_week":72.58348963830153,"cars_to_priuses_for_a_day":509.4739157414616,"one_way_domestic_flight":12.47468753698995,"round_trip_domestic_flight":6.237343768494975,"one_way_cross_country_flight":4.383413282228469,"round_trip_cross_country_flight":2.1917066411142345,"vegan_meals_instead_of_non_vegan_ones":3088.6827354085644,"days_of_veganism":1029.5609118028547,"weeks_of_veganism":147.07848524380952,"months_of_veganism":34.31882500560835,"years_of_veganism":2.8211985660577277,"barrels_of_petroleum":8.928037911088808,"canisters_of_bbq_propane":159.9331709550032,"railroad_cars_full_of_coal":0.019191826979984544,"homes_energy_in_a_year":0.3723214434117001,"homes_energy_in_a_month":4.448665493960417,"homes_energy_in_a_week":19.272432653300477,"homes_energy_in_a_day":135.29086511270302,"homes_electricity_in_a_year":0.5642397132115455,"homes_electricity_in_a_month":6.751684731558561,"homes_electricity_in_a_week":29.256021048288435,"homes_electricity_in_a_day":205.34871032043858,"homes_with_lowered_thermostat_2_degrees_for_a_winter":20.147579963587773,"homes_with_raised_thermostat_3_degrees_for_a_summer":9.058542334552705,"replaced_refrigerators":3.865233953768887,"loads_of_cold_laundry":1760.1285127191343,"lightbulbs_for_a_year":7.0856225210102926,"lightbulbs_for_a_month":86.22887862107054,"lightbulbs_for_a_week":369.55014359579036,"lightbulbs_for_a_day":2586.8625202667204,"lightbulbs_for_an_evening":15521.178959965717,"lightbulbs_to_CFLs_for_a_day":44031.71651940903,"lightbulbs_to_CFLs_for_a_week":6290.244120382606,"lightbulbs_to_CFLs_for_a_month":1467.7256752174858,"lightbulbs_to_CFLs_for_a_year":120.63598603078682,"days_with_lightbulbs_to_CFLs":978.4837834783237,"weeks_with_lightbulbs_to_CFLs":139.7817526260194,"months_with_lightbulbs_to_CFLs":32.61459076978573,"years_with_lightbulbs_to_CFLs":2.6791790464058423,"recycled_kgs_of_trash":2647.147887176248,"recycled_bags_of_trash":1466.7737605992786},"methodology":"http://impact.brighterplanet.com/residences?bathrooms=4&timeframe=2012-01-01%2F2013-01-01","scope":null,"timeframe":"2012-01-01/2013-01-01","characteristics":{"bathrooms":{"description":"4.0","object":4.0}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: origin_airport=IAH&destination_airport=DEN&segments_per_trip=1&trips=1&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"242.5 kg","object":{"value":242.52347122248426,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"1771.2
MJ","object":{"value":1771.178169585269,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"47.072375987935935","object":47.072375987935935,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"5891.4023971685265","object":5891.4023971685265,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"802.3565814689595","object":802.3565814689595,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"802.3565814689595","object":802.3565814689595,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"749.8659639896817","object":749.8659639896817,"methodology":"from
airports"},"route_inefficiency_factor":{"description":"1.07","object":1.07,"methodology":"from
country"},"dogleg_factor":{"description":"1.0","object":1.0,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"Fuel use equation","object":{"m3":6.230164366685055e-08,"m2":-4.0923005200593856e-05,"m1":5.808528552865584,"b":1225.0553711164655},"methodology":"from
cohort"},"fuel":{"description":"Jet Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"152","object":152,"methodology":"from
seats and load factor"},"seats":{"description":"174.52327350140772","object":174.52327350140772,"methodology":"from
cohort"},"load_factor":{"description":"0.8695368648330599","object":0.8695368648330599,"methodology":"from
cohort"},"freight_share":{"description":"0.009468621447370996","object":0.009468621447370996,"methodology":"from
cohort"},"country":{"description":"US","object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":9.2669,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":882.0,"cooling_degree_days_units":"degrees_celsius","electricity_emission_factor":0.589455,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.0615633,"flight_route_inefficiency_factor":1.07,"heating_degree_days":2159.0,"heating_degree_days_units":"degrees_celsius","iso_3166_alpha_3_code":"USA","iso_3166_code":"US","iso_3166_numeric_code":840,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"United
States","rail_passengers":4467000000.0,"rail_speed":32.4972,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.0957617,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.0194247,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":12.9952,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.140512,"rail_trip_electricity_intensity_units":"kilowatt_hours_per_passenger_kilometre"}},"methodology":"from
origin airport and destination airport"},"cohort":{"description":"BrighterPlanet::Flight::ImpactModel::FlightSegmentCohort","object":{"members":108,"sql":"SELECT
* FROM `flight_segments` WHERE (`flight_segments`.`source` = ''BTS T100''
AND `flight_segments`.`year` IN (2011, 2012) AND `flight_segments`.`passengers`
> 0) AND `flight_segments`.`origin_airport_iata_code` = ''IAH'' AND `flight_segments`.`destination_airport_iata_code`
= ''DEN''"},"methodology":"from segments per trip and input"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.04413927176249214,"cars_off_the_road_for_a_month":0.5291862142074606,"cars_off_the_road_for_a_week":2.293059420408589,"cars_off_the_road_for_a_day":16.09531269115139,"cars_to_priuses_for_a_year":0.08827854352498428,"cars_to_priuses_for_a_month":1.0583724284149212,"cars_to_priuses_for_a_week":4.586118840817178,"cars_to_priuses_for_a_day":32.19062538230278,"one_way_domestic_flight":0.7882012814730738,"round_trip_domestic_flight":0.3941006407365369,"one_way_cross_country_flight":0.276961804136077,"round_trip_cross_country_flight":0.1384809020680385,"vegan_meals_instead_of_non_vegan_ones":195.1554844876072,"days_of_veganism":65.05182816253573,"weeks_of_veganism":9.293014370303151,"months_of_veganism":2.1684023562002315,"years_of_veganism":0.17825475134852592,"barrels_of_petroleum":0.5641095940634984,"canisters_of_bbq_propane":10.105225475427252,"railroad_cars_full_of_coal":0.0012126173561124215,"homes_energy_in_a_year":0.023524776708580972,"homes_energy_in_a_month":0.2810847031468593,"homes_energy_in_a_week":1.2177103490080936,"homes_energy_in_a_day":8.548224790178903,"homes_electricity_in_a_year":0.03565095026970518,"homes_electricity_in_a_month":0.4265987858803498,"homes_electricity_in_a_week":1.848513897657775,"homes_electricity_in_a_day":12.974763186931686,"homes_with_lowered_thermostat_2_degrees_for_a_winter":1.27300570044682,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.5723553920850629,"replaced_refrigerators":0.24422113552104166,"loads_of_cold_laundry":111.21204801072483,"lightbulbs_for_a_year":0.44769832787670594,"lightbulbs_for_a_month":5.448289781013108,"lightbulbs_for_a_week":23.34967476235834,"lightbulbs_for_a_day":163.44845090692206,"lightbulbs_for_an_evening":980.6909479650034,"lightbulbs_to_CFLs_for_a_day":2782.1021795654187,"lightbulbs_to_CFLs_for_a_week":397.4430992169252,"lightbulbs_to_CFLs_for_a_month":92.7368524964672,"lightbulbs_to_CFLs_for_a_year":7.622270177051457,"days_with_lightbulbs_to_CFLs":61.82456833097813,"weeks_with_lightbulbs_to_CFLs":8.831977251509208,"months_with_lightbulbs_to_CFLs":2.060721934977449,"years_with_lightbulbs_to_CFLs":0.16928138291329403,"recycled_kgs_of_trash":167.25752454594237,"recycled_bags_of_trash":92.67670667560402},"methodology":"http://impact.brighterplanet.com/flights?destination_airport=DEN&origin_airport=IAH&segments_per_trip=1&timeframe=2012-01-01%2F2013-01-01&trips=1","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2012-01-01/2013-01-01","characteristics":{"segments_per_trip":{"description":"1","object":1},"trips":{"description":"1","object":1},"origin_airport":{"description":"IAH","object":{"airport":{"city":"Houston","country_iso_3166_code":"US","country_name":"United
States","iata_code":"IAH","latitude":29.9844,"longitude":-95.3414,"name":"George
Bush Intcntl Houston"}}},"destination_airport":{"description":"DEN","object":{"airport":{"city":"Denver","country_iso_3166_code":"US","country_name":"United
States","iata_code":"DEN","latitude":39.8617,"longitude":-104.673,"name":"Denver
International"}}}},"errors":["API key \"carbon_test\" could not be verified.
Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: origin_airport=LAX&destination_airport=SFO&segments_per_trip=1&trips=1&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"158.9 kg","object":{"value":158.88245012544277,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"1160.3
MJ","object":{"value":1160.3377016414531,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"30.838146891474757","object":30.838146891474757,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"2809.4943974548605","object":2809.4943974548605,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"314.11399481652126","object":314.11399481652126,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"314.11399481652126","object":314.11399481652126,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"293.56448113693574","object":293.56448113693574,"methodology":"from
airports"},"route_inefficiency_factor":{"description":"1.07","object":1.07,"methodology":"from
country"},"dogleg_factor":{"description":"1.0","object":1.0,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"Fuel use equation","object":{"m3":1.0348093300372378e-07,"m2":-0.00023017671642226525,"m1":5.385202868809918,"b":1137.430624447256},"methodology":"from
cohort"},"fuel":{"description":"Jet Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"110","object":110,"methodology":"from
seats and load factor"},"seats":{"description":"141.62026378724536","object":141.62026378724536,"methodology":"from
cohort"},"load_factor":{"description":"0.7786548902022515","object":0.7786548902022515,"methodology":"from
cohort"},"freight_share":{"description":"0.01524089564944548","object":0.01524089564944548,"methodology":"from
cohort"},"country":{"description":"US","object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":9.2669,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":882.0,"cooling_degree_days_units":"degrees_celsius","electricity_emission_factor":0.589455,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.0615633,"flight_route_inefficiency_factor":1.07,"heating_degree_days":2159.0,"heating_degree_days_units":"degrees_celsius","iso_3166_alpha_3_code":"USA","iso_3166_code":"US","iso_3166_numeric_code":840,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"United
States","rail_passengers":4467000000.0,"rail_speed":32.4972,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.0957617,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.0194247,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":12.9952,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.140512,"rail_trip_electricity_intensity_units":"kilowatt_hours_per_passenger_kilometre"}},"methodology":"from
origin airport and destination airport"},"cohort":{"description":"BrighterPlanet::Flight::ImpactModel::FlightSegmentCohort","object":{"members":157,"sql":"SELECT
* FROM `flight_segments` WHERE (`flight_segments`.`source` = ''BTS T100''
AND `flight_segments`.`year` IN (2011, 2012) AND `flight_segments`.`passengers`
> 0) AND `flight_segments`.`origin_airport_iata_code` = ''LAX'' AND `flight_segments`.`destination_airport_iata_code`
= ''SFO''"},"methodology":"from segments per trip and input"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.028916605922830584,"cars_off_the_road_for_a_month":0.3466815061737161,"cars_off_the_road_for_a_week":1.5022335659360615,"cars_off_the_road_for_a_day":10.544392685025134,"cars_to_priuses_for_a_year":0.05783321184566117,"cars_to_priuses_for_a_month":0.6933630123474323,"cars_to_priuses_for_a_week":3.004467131872123,"cars_to_priuses_for_a_day":21.088785370050267,"one_way_domestic_flight":0.5163679629076889,"round_trip_domestic_flight":0.25818398145384447,"one_way_cross_country_flight":0.18144375804325566,"round_trip_cross_country_flight":0.09072187902162783,"vegan_meals_instead_of_non_vegan_ones":127.85064214409218,"days_of_veganism":42.61688071469739,"weeks_of_veganism":6.088057723906716,"months_of_veganism":1.4205679865715837,"years_of_veganism":0.11677860084220043,"barrels_of_petroleum":0.36956057899177985,"canisters_of_bbq_propane":6.620155049376825,"railroad_cars_full_of_coal":0.000794412250627214,"homes_energy_in_a_year":0.01541159766216795,"homes_energy_in_a_month":0.18414475969538818,"homes_energy_in_a_week":0.7977487820798482,"homes_energy_in_a_day":5.600129719571481,"homes_electricity_in_a_year":0.023355720168440088,"homes_electricity_in_a_month":0.27947422977065384,"homes_electricity_in_a_week":1.2110020348561248,"homes_electricity_in_a_day":8.500052199261063,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.8339739807084492,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.37496258229604496,"replaced_refrigerators":0.15999462727632088,"loads_of_cold_laundry":72.85745409442329,"lightbulbs_for_a_year":0.29329700293156735,"lightbulbs_for_a_month":3.5692942420680716,"lightbulbs_for_a_week":15.29688453317738,"lightbulbs_for_a_day":107.07866837959203,"lightbulbs_for_an_evening":642.4721691600023,"lightbulbs_to_CFLs_for_a_day":1822.6162134352137,"lightbulbs_to_CFLs_for_a_week":260.37369938147333,"lightbulbs_to_CFLs_for_a_month":60.75394792631718,"lightbulbs_to_CFLs_for_a_year":4.993516524992541,"days_with_lightbulbs_to_CFLs":40.50263195087812,"weeks_with_lightbulbs_to_CFLs":5.786022186218249,"months_with_lightbulbs_to_CFLs":1.350024178715887,"years_with_lightbulbs_to_CFLs":0.11089995018755906,"recycled_kgs_of_trash":109.57407614126224,"recycled_bags_of_trash":60.71454507868607},"methodology":"http://impact.brighterplanet.com/flights?destination_airport=SFO&origin_airport=LAX&segments_per_trip=1&timeframe=2012-01-01%2F2013-01-01&trips=1","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2012-01-01/2013-01-01","characteristics":{"segments_per_trip":{"description":"1","object":1},"trips":{"description":"1","object":1},"origin_airport":{"description":"LAX","object":{"airport":{"city":"Los
Angeles","country_iso_3166_code":"US","country_name":"United States","iata_code":"LAX","latitude":33.9425,"longitude":-118.408,"name":"Los
Angeles International"}}},"destination_airport":{"description":"SFO","object":{"airport":{"city":"San
Francisco","country_iso_3166_code":"US","country_name":"United States","iata_code":"SFO","latitude":37.619,"longitude":-122.375,"name":"San
Francisco International"}}}},"errors":["API key \"carbon_test\" could not
be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/automobile_trips.json
body:
encoding: US-ASCII
string: make=Ford&model=Taurus&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"4.6 kg","object":{"value":4.563713093427252,"units":"kilograms"},"methodology":"from
co2 emission, ch4 emission, n2o emission, and hfc emission"},"co2_emission":{"description":"4.349854227442925","object":4.349854227442925,"methodology":"from
fuel use and automobile fuel"},"co2_biogenic_emission":{"description":"0.0","object":0.0,"methodology":"from
fuel use and automobile fuel"},"ch4_emission":{"description":"0.004480390052220374","object":0.004480390052220374,"methodology":"from
fuel use and automobile fuel"},"n2o_emission":{"description":"0.015234946635492488","object":0.015234946635492488,"methodology":"from
fuel use and automobile fuel"},"hfc_emission":{"description":"0.19414352929661446","object":0.19414352929661446,"methodology":"from
fuel use and automobile fuel"},"energy":{"description":"64.3 MJ","object":{"value":64.25629091982954,"units":"megajoules"},"methodology":"from
fuel use and automobile fuel"},"automobile_fuel":{"description":"fallback","object":{"automobile_fuel":{"annual_distance":17923.116724381467,"annual_distance_units":"kilometres","base_fuel_name":null,"blend_fuel_name":null,"blend_portion":null,"ch4_emission_factor":0.002420994361601003,"ch4_emission_factor_units":"kilograms_co2e_per_litre","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.3504588742684827,"co2_emission_factor_units":"kilograms_per_litre","code":null,"distance_key":null,"ef_key":null,"emission_factor":null,"emission_factor_units":null,"energy_content":34.72111048394262,"energy_content_units":null,"hfc_emission_factor":0.1049061318970414,"hfc_emission_factor_units":"kilograms_co2e_per_litre","n2o_emission_factor":0.008232256449534075,"n2o_emission_factor_units":"kilograms_co2e_per_litre","name":"fallback"}},"methodology":"default"},"fuel_use":{"description":"1.850640432412033
l","object":{"value":1.850640432412033,"units":"litres"},"methodology":"from
fuel efficiency, distance, date, and timeframe"},"distance":{"description":"16.3348
km","object":{"value":16.3348,"units":"kilometres"},"methodology":"from safe
country"},"speed":{"description":"50.94382232429702 km/h","object":{"value":50.94382232429702,"units":"kilometres_per_hour"},"methodology":"from
urbanity and safe country"},"fuel_efficiency":{"description":"8.826566043793841
km/l","object":{"value":8.826566043793841,"units":"kilometres_per_litre"},"methodology":"from
make model and urbanity"},"hybridity_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"urbanity":{"description":"0.43","object":0.43,"methodology":"from
safe country"},"safe_country":{"description":null,"object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":8.226530750610781,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":null,"cooling_degree_days_units":null,"electricity_emission_factor":0.626089,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.096,"flight_route_inefficiency_factor":1.100000023841858,"heating_degree_days":null,"heating_degree_days_units":null,"iso_3166_alpha_3_code":null,"iso_3166_code":null,"iso_3166_numeric_code":null,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"fallback","rail_passengers":null,"rail_speed":32.49720001220703,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.06364482122342524,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.008762920291076415,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":37.11446191042177,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.10806735200626398,"rail_trip_electricity_intensity_units":"kilowatt_hour_per_passenger_kilometre"}},"methodology":"default"},"make_model":{"description":"Ford
TAURUS","object":{"automobile_make_model":{"fuel_efficiency_city":7.20551,"fuel_efficiency_city_units":"kilometres_per_litre","fuel_efficiency_highway":10.6308,"fuel_efficiency_highway_units":"kilometres_per_litre","make_name":"Ford","model_name":"TAURUS","name":"Ford
TAURUS"}},"methodology":"from make and model"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"AutomobileTrip","equivalents":{"cars_off_the_road_for_a_year":0.0008305957830037599,"cars_off_the_road_for_a_month":0.009958021969858262,"cars_off_the_road_for_a_week":0.04314990729835466,"cars_off_the_road_for_a_day":0.30287538315839296,"cars_to_priuses_for_a_year":0.0016611915660075197,"cars_to_priuses_for_a_month":0.019916043939716525,"cars_to_priuses_for_a_week":0.08629981459670932,"cars_to_priuses_for_a_day":0.6057507663167859,"one_way_domestic_flight":0.014832067553638566,"round_trip_domestic_flight":0.007416033776819283,"one_way_cross_country_flight":0.005211760352693921,"round_trip_cross_country_flight":0.0026058801763469606,"vegan_meals_instead_of_non_vegan_ones":3.672360598010695,"days_of_veganism":1.2241201993368982,"weeks_of_veganism":0.17487235831394543,"months_of_veganism":0.04080415876833306,"years_of_veganism":0.00335432912366903,"barrels_of_petroleum":0.010615196655311788,"canisters_of_bbq_propane":0.1901562334638333,"railroad_cars_full_of_coal":2.281856546713626e-05,"homes_energy_in_a_year":0.0004426801700624434,"homes_energy_in_a_month":0.005289343475282185,"homes_energy_in_a_week":0.022914403442098233,"homes_energy_in_a_day":0.16085719540403035,"homes_electricity_in_a_year":0.000670865824733806,"homes_electricity_in_a_month":0.008027571331338535,"homes_electricity_in_a_week":0.034784621198102515,"homes_electricity_in_a_day":0.2441540867852645,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.023954930027399644,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.010770362900488314,"replaced_refrigerators":0.004595659085081243,"loads_of_cold_laundry":2.0927454035481876,"lightbulbs_for_a_year":0.008424614370466706,"lightbulbs_for_a_month":0.1025238146438432,"lightbulbs_for_a_week":0.43938516920898896,"lightbulbs_for_a_day":3.075709875602203,"lightbulbs_for_an_evening":18.454263817326307,"lightbulbs_to_CFLs_for_a_day":52.35252522213647,"lightbulbs_to_CFLs_for_a_week":7.478930870672898,"lightbulbs_to_CFLs_for_a_month":1.7450863038039925,"lightbulbs_to_CFLs_for_a_year":0.14343293881332508,"days_with_lightbulbs_to_CFLs":1.1633908692026618,"weeks_with_lightbulbs_to_CFLs":0.1661967397233402,"months_with_lightbulbs_to_CFLs":0.03877787015485135,"years_with_lightbulbs_to_CFLs":0.003185471739212222,"recycled_kgs_of_trash":3.1473875534475715,"recycled_bags_of_trash":1.7439545029568229},"methodology":"http://impact.brighterplanet.com/automobile_trips?make=Ford&model=Taurus&timeframe=2012-01-01%2F2013-01-01","scope":"The
automobile trip emission estimate is the total anthropogenic emissions from
fuel and air conditioning used by the automobile during the trip. It includes
CO2 emissions from combustion of non-biogenic fuel, CH4 and N2O emissions
from combustion of all fuel, and fugitive HFC emissions from air conditioning.","timeframe":"2012-01-01/2013-01-01","characteristics":{"make":{"description":"Ford","object":{"automobile_make":{"fuel_efficiency":10.2999,"fuel_efficiency_units":"kilometres_per_litre","name":"Ford"}}},"model":{"description":"TAURUS","object":{"automobile_model":{"name":"TAURUS"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/automobile_trips.json
body:
encoding: US-ASCII
string: make=Nissan&model=Altima&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"4.0 kg","object":{"value":4.013703182098099,"units":"kilograms"},"methodology":"from
co2 emission, ch4 emission, n2o emission, and hfc emission"},"co2_emission":{"description":"3.825618174704137","object":3.825618174704137,"methodology":"from
fuel use and automobile fuel"},"co2_biogenic_emission":{"description":"0.0","object":0.0,"methodology":"from
fuel use and automobile fuel"},"ch4_emission":{"description":"0.003940422073319416","object":0.003940422073319416,"methodology":"from
fuel use and automobile fuel"},"n2o_emission":{"description":"0.013398860212759267","object":0.013398860212759267,"methodology":"from
fuel use and automobile fuel"},"hfc_emission":{"description":"0.17074572510788322","object":0.17074572510788322,"methodology":"from
fuel use and automobile fuel"},"energy":{"description":"56.5 MJ","object":{"value":56.5122465095761,"units":"megajoules"},"methodology":"from
fuel use and automobile fuel"},"automobile_fuel":{"description":"fallback","object":{"automobile_fuel":{"annual_distance":17923.116724381467,"annual_distance_units":"kilometres","base_fuel_name":null,"blend_fuel_name":null,"blend_portion":null,"ch4_emission_factor":0.002420994361601003,"ch4_emission_factor_units":"kilograms_co2e_per_litre","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.3504588742684827,"co2_emission_factor_units":"kilograms_per_litre","code":null,"distance_key":null,"ef_key":null,"emission_factor":null,"emission_factor_units":null,"energy_content":34.72111048394262,"energy_content_units":null,"hfc_emission_factor":0.1049061318970414,"hfc_emission_factor_units":"kilograms_co2e_per_litre","n2o_emission_factor":0.008232256449534075,"n2o_emission_factor_units":"kilograms_co2e_per_litre","name":"fallback"}},"methodology":"default"},"fuel_use":{"description":"1.6276048122283178
l","object":{"value":1.6276048122283178,"units":"litres"},"methodology":"from
fuel efficiency, distance, date, and timeframe"},"distance":{"description":"16.3348
km","object":{"value":16.3348,"units":"kilometres"},"methodology":"from safe
country"},"speed":{"description":"50.94382232429702 km/h","object":{"value":50.94382232429702,"units":"kilometres_per_hour"},"methodology":"from
urbanity and safe country"},"fuel_efficiency":{"description":"10.036097139351897
km/l","object":{"value":10.036097139351897,"units":"kilometres_per_litre"},"methodology":"from
make model and urbanity"},"hybridity_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"urbanity":{"description":"0.43","object":0.43,"methodology":"from
safe country"},"safe_country":{"description":null,"object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":8.226530750610781,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":null,"cooling_degree_days_units":null,"electricity_emission_factor":0.626089,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.096,"flight_route_inefficiency_factor":1.100000023841858,"heating_degree_days":null,"heating_degree_days_units":null,"iso_3166_alpha_3_code":null,"iso_3166_code":null,"iso_3166_numeric_code":null,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"fallback","rail_passengers":null,"rail_speed":32.49720001220703,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.06364482122342524,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.008762920291076415,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":37.11446191042177,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.10806735200626398,"rail_trip_electricity_intensity_units":"kilowatt_hour_per_passenger_kilometre"}},"methodology":"default"},"make_model":{"description":"Nissan
ALTIMA","object":{"automobile_make_model":{"fuel_efficiency_city":8.47904,"fuel_efficiency_city_units":"kilometres_per_litre","fuel_efficiency_highway":11.65,"fuel_efficiency_highway_units":"kilometres_per_litre","make_name":"Nissan","model_name":"ALTIMA","name":"Nissan
ALTIMA"}},"methodology":"from make and model"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"AutomobileTrip","equivalents":{"cars_off_the_road_for_a_year":0.000730493979141854,"cars_off_the_road_for_a_month":0.008757900343338051,"cars_off_the_road_for_a_week":0.037949563586737525,"cars_off_the_road_for_a_day":0.2663734253831224,"cars_to_priuses_for_a_year":0.001460987958283708,"cars_to_priuses_for_a_month":0.017515800686676103,"cars_to_priuses_for_a_week":0.07589912717347505,"cars_to_priuses_for_a_day":0.5327468507662448,"one_way_domestic_flight":0.013044535341818821,"round_trip_domestic_flight":0.0065222676709094105,"one_way_cross_country_flight":0.0045836490339560285,"round_trip_cross_country_flight":0.0022918245169780142,"vegan_meals_instead_of_non_vegan_ones":3.229774772492973,"days_of_veganism":1.0765915908309909,"weeks_of_veganism":0.15379707853163493,"months_of_veganism":0.0358865201511391,"years_of_veganism":0.0029500718388421024,"barrels_of_petroleum":0.009335873601560178,"canisters_of_bbq_propane":0.1672389704884815,"railroad_cars_full_of_coal":2.0068515910490494e-05,"homes_energy_in_a_year":0.0003893292086635156,"homes_energy_in_a_month":0.004651881988051697,"homes_energy_in_a_week":0.020152803677314556,"homes_energy_in_a_day":0.14147099605941169,"homes_electricity_in_a_year":0.0005900143677684205,"homes_electricity_in_a_month":0.007060103897310556,"homes_electricity_in_a_week":0.03059244565395171,"homes_electricity_in_a_day":0.21472910653906618,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.02106792800283292,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.009472339509751513,"replaced_refrigerators":0.004041799104372786,"loads_of_cold_laundry":1.8405317585892684,"lightbulbs_for_a_year":0.00740929607415309,"lightbulbs_for_a_month":0.09016784198583379,"lightbulbs_for_a_week":0.3864313149660408,"lightbulbs_for_a_day":2.7050312458718317,"lightbulbs_for_an_evening":16.23019148893417,"lightbulbs_to_CFLs_for_a_day":46.04309972456197,"lightbulbs_to_CFLs_for_a_week":6.577584528165087,"lightbulbs_to_CFLs_for_a_month":1.5347718638802172,"lightbulbs_to_CFLs_for_a_year":0.12614667731016113,"days_with_lightbulbs_to_CFLs":1.0231812425868114,"weeks_with_lightbulbs_to_CFLs":0.14616702878246646,"months_with_lightbulbs_to_CFLs":0.03410443593828754,"years_with_lightbulbs_to_CFLs":0.0028015648211044734,"recycled_kgs_of_trash":2.7680704680498645,"recycled_bags_of_trash":1.533776465491057},"methodology":"http://impact.brighterplanet.com/automobile_trips?make=Nissan&model=Altima&timeframe=2012-01-01%2F2013-01-01","scope":"The
automobile trip emission estimate is the total anthropogenic emissions from
fuel and air conditioning used by the automobile during the trip. It includes
CO2 emissions from combustion of non-biogenic fuel, CH4 and N2O emissions
from combustion of all fuel, and fugitive HFC emissions from air conditioning.","timeframe":"2012-01-01/2013-01-01","characteristics":{"make":{"description":"Nissan","object":{"automobile_make":{"fuel_efficiency":11.9656,"fuel_efficiency_units":"kilometres_per_litre","name":"Nissan"}}},"model":{"description":"ALTIMA","object":{"automobile_model":{"name":"ALTIMA"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/residences.json
body:
encoding: US-ASCII
string: urbanity=City&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"3838.4 kg","object":{"value":3838.3653959969083,"units":"kilograms"},"methodology":"from
fuel and electricity use and occupation and residents"},"fuel_oil_consumed":{"description":"199.0748055102","object":199.0748055102,"methodology":"from
research"},"natural_gas_consumed":{"description":"42683876171.345726","object":42683876171.345726,"methodology":"from
research"},"propane_consumed":{"description":"183.25178426979997","object":183.25178426979997,"methodology":"from
research"},"biomass_consumed":{"description":"3798201078.0000005","object":3798201078.0000005,"methodology":"from
research"},"kerosene_consumed":{"description":"4.0503906046","object":4.0503906046,"methodology":"from
research"},"coal_consumed":{"description":"2.871239704507795","object":2.871239704507795,"methodology":"from
research"},"dirty_electricity_generated":{"description":"11458.237337445968","object":11458.237337445968,"methodology":"from
electricity generated and green electricity"},"green_electricity":{"description":"0.0","object":0.0,"methodology":"default"},"electricity_generated":{"description":"11458.237337445968","object":11458.237337445968,"methodology":"from
electricity used and loss rate"},"electricity_used":{"description":"10752.83","object":10752.83,"methodology":"from
research"},"missing_annual_energy":{"description":"0","object":0,"methodology":"from
fuel reports"},"electricity_loss_rate":{"description":"0.06156333794384499","object":0.06156333794384499,"methodology":"default"},"electricity_emission_factor":{"description":"0.5894551291830981","object":0.5894551291830981,"methodology":"default"},"occupation":{"description":"0.937","object":0.937,"methodology":"default"},"residents":{"description":"2.57","object":2.57,"methodology":"default"},"air_conditioner_use":{"description":null,"object":{"air_conditioner_use":{"fugitive_emission":0.4994479354338,"fugitive_emission_units":"kilograms_per_square_metre","name":null}},"methodology":"default"},"predicted_fuel_shares":{"description":"{:fuel_oil=>0.4167932348735287,
:natural_gas=>0.1613371886801841, :propane=>0.2526592181590731, :kerosene=>0.008254483207514767,
:biomass=>0.014356500368116514, :coal=>0.0002819952840317706, :electricity=>0.14631737942755108}","object":{"fuel_oil":0.4167932348735287,"natural_gas":0.1613371886801841,"propane":0.2526592181590731,"kerosene":0.008254483207514767,"biomass":0.014356500368116514,"coal":0.0002819952840317706,"electricity":0.14631737942755108},"methodology":"from
research"},"predicted_annual_energy_consumption":{"description":"264563158193.84476","object":264563158193.84476,"methodology":"from
research"},"predicted_annual_fuel_oil_consumption":{"description":"199.0748055102","object":199.0748055102,"methodology":"default"},"predicted_annual_natural_gas_consumption":{"description":"42683876171.345726","object":42683876171.345726,"methodology":"default"},"predicted_annual_propane_consumption":{"description":"183.2517842698","object":183.2517842698,"methodology":"default"},"predicted_annual_kerosene_consumption":{"description":"4.0503906046","object":4.0503906046,"methodology":"default"},"predicted_annual_biomass_consumption":{"description":"3798201078.0","object":3798201078.0,"methodology":"default"},"predicted_annual_coal_consumption":{"description":"2.871239704507795","object":2.871239704507795,"methodology":"default"},"predicted_annual_electricity_use":{"description":"10752.83","object":10752.83,"methodology":"default"},"active_subtimeframe":{"description":"2012-01-01/2013-01-01","object":"2012-01-01/2013-01-01","methodology":"from
acquisition and retirement"},"acquisition":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
retirement"},"retirement":{"description":"2013-01-01","object":"2013-01-01","methodology":"from
acquisition"},"floorspace_estimate":{"description":"214.47688717440002","object":214.47688717440002,"methodology":"default"}},"emitter":"Residence","equivalents":{"cars_off_the_road_for_a_year":0.6985825020714374,"cars_off_the_road_for_a_month":8.375313294065254,"cars_off_the_road_for_a_week":36.291744819150765,"cars_off_the_road_for_a_day":254.7369578707308,"cars_to_priuses_for_a_year":1.3971650041428747,"cars_to_priuses_for_a_month":16.75062658813051,"cars_to_priuses_for_a_week":72.58348963830153,"cars_to_priuses_for_a_day":509.4739157414616,"one_way_domestic_flight":12.47468753698995,"round_trip_domestic_flight":6.237343768494975,"one_way_cross_country_flight":4.383413282228469,"round_trip_cross_country_flight":2.1917066411142345,"vegan_meals_instead_of_non_vegan_ones":3088.6827354085644,"days_of_veganism":1029.5609118028547,"weeks_of_veganism":147.07848524380952,"months_of_veganism":34.31882500560835,"years_of_veganism":2.8211985660577277,"barrels_of_petroleum":8.928037911088808,"canisters_of_bbq_propane":159.9331709550032,"railroad_cars_full_of_coal":0.019191826979984544,"homes_energy_in_a_year":0.3723214434117001,"homes_energy_in_a_month":4.448665493960417,"homes_energy_in_a_week":19.272432653300477,"homes_energy_in_a_day":135.29086511270302,"homes_electricity_in_a_year":0.5642397132115455,"homes_electricity_in_a_month":6.751684731558561,"homes_electricity_in_a_week":29.256021048288435,"homes_electricity_in_a_day":205.34871032043858,"homes_with_lowered_thermostat_2_degrees_for_a_winter":20.147579963587773,"homes_with_raised_thermostat_3_degrees_for_a_summer":9.058542334552705,"replaced_refrigerators":3.865233953768887,"loads_of_cold_laundry":1760.1285127191343,"lightbulbs_for_a_year":7.0856225210102926,"lightbulbs_for_a_month":86.22887862107054,"lightbulbs_for_a_week":369.55014359579036,"lightbulbs_for_a_day":2586.8625202667204,"lightbulbs_for_an_evening":15521.178959965717,"lightbulbs_to_CFLs_for_a_day":44031.71651940903,"lightbulbs_to_CFLs_for_a_week":6290.244120382606,"lightbulbs_to_CFLs_for_a_month":1467.7256752174858,"lightbulbs_to_CFLs_for_a_year":120.63598603078682,"days_with_lightbulbs_to_CFLs":978.4837834783237,"weeks_with_lightbulbs_to_CFLs":139.7817526260194,"months_with_lightbulbs_to_CFLs":32.61459076978573,"years_with_lightbulbs_to_CFLs":2.6791790464058423,"recycled_kgs_of_trash":2647.147887176248,"recycled_bags_of_trash":1466.7737605992786},"methodology":"http://impact.brighterplanet.com/residences?timeframe=2012-01-01%2F2013-01-01&urbanity=City","scope":null,"timeframe":"2012-01-01/2013-01-01","characteristics":{"urbanity":{"description":"City","object":{"urbanity":{"name":"City"}}}},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: origin_airport=MSN&destination_airport=ORD&segments_per_trip=1&trips=1&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"114.6 kg","object":{"value":114.57907360899101,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"836.8
MJ","object":{"value":836.784797960347,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"22.239122696392375","object":22.239122696392375,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"798.0839580419192","object":798.0839580419192,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"100.8961154095222","object":100.8961154095222,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"100.8961154095222","object":100.8961154095222,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"94.29543496217028","object":94.29543496217028,"methodology":"from
airports"},"route_inefficiency_factor":{"description":"1.07","object":1.07,"methodology":"from
country"},"dogleg_factor":{"description":"1.0","object":1.0,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"Fuel use equation","object":{"m3":4.046124738717439e-08,"m2":-4.096578631680186e-05,"m1":2.7511987541689704,"b":520.8741650385462},"methodology":"from
cohort"},"fuel":{"description":"Jet Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"44","object":44,"methodology":"from
seats and load factor"},"seats":{"description":"51.614277332823946","object":51.614277332823946,"methodology":"from
cohort"},"load_factor":{"description":"0.8511664076308222","object":0.8511664076308222,"methodology":"from
cohort"},"freight_share":{"description":"2.3873554715207264e-06","object":2.3873554715207264e-06,"methodology":"from
cohort"},"country":{"description":"US","object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":9.2669,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":882.0,"cooling_degree_days_units":"degrees_celsius","electricity_emission_factor":0.589455,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.0615633,"flight_route_inefficiency_factor":1.07,"heating_degree_days":2159.0,"heating_degree_days_units":"degrees_celsius","iso_3166_alpha_3_code":"USA","iso_3166_code":"US","iso_3166_numeric_code":840,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"United
States","rail_passengers":4467000000.0,"rail_speed":32.4972,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.0957617,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.0194247,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":12.9952,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.140512,"rail_trip_electricity_intensity_units":"kilowatt_hours_per_passenger_kilometre"}},"methodology":"from
origin airport and destination airport"},"cohort":{"description":"BrighterPlanet::Flight::ImpactModel::FlightSegmentCohort","object":{"members":91,"sql":"SELECT
* FROM `flight_segments` WHERE (`flight_segments`.`source` = ''BTS T100''
AND `flight_segments`.`year` IN (2011, 2012) AND `flight_segments`.`passengers`
> 0) AND `flight_segments`.`origin_airport_iata_code` = ''MSN'' AND `flight_segments`.`destination_airport_iata_code`
= ''ORD''"},"methodology":"from segments per trip and input"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.020853391396836365,"cars_off_the_road_for_a_month":0.2500115386148184,"cars_off_the_road_for_a_week":1.08334514097301,"cars_off_the_road_for_a_day":7.604154799134297,"cars_to_priuses_for_a_year":0.04170678279367273,"cars_to_priuses_for_a_month":0.5000230772296368,"cars_to_priuses_for_a_week":2.16669028194602,"cars_to_priuses_for_a_day":15.208309598268594,"one_way_domestic_flight":0.3723819892292208,"round_trip_domestic_flight":0.1861909946146104,"one_way_cross_country_flight":0.13084930206146772,"round_trip_cross_country_flight":0.06542465103073386,"vegan_meals_instead_of_non_vegan_ones":92.20029100519815,"days_of_veganism":30.73343033506605,"weeks_of_veganism":4.390440942549318,"months_of_veganism":1.0244514971379886,"years_of_veganism":0.08421561910260839,"barrels_of_petroleum":0.2665109252145131,"canisters_of_bbq_propane":4.774166260065829,"railroad_cars_full_of_coal":0.0005728953680449551,"homes_energy_in_a_year":0.011114170140072127,"homes_energy_in_a_month":0.13279714631282058,"homes_energy_in_a_week":0.5753015285907439,"homes_energy_in_a_day":4.0385686074961065,"homes_electricity_in_a_year":0.016843123820521676,"homes_electricity_in_a_month":0.20154459047821519,"homes_electricity_in_a_week":0.8733216990477295,"homes_electricity_in_a_day":6.12986585900741,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.6014255573735938,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.2704066137172188,"replaced_refrigerators":0.11538112712425395,"loads_of_cold_laundry":52.541609152286135,"lightbulbs_for_a_year":0.2115129698821974,"lightbulbs_for_a_month":2.5740188886259827,"lightbulbs_for_a_week":11.031444048926437,"lightbulbs_for_a_day":77.22045207970588,"lightbulbs_for_an_evening":463.32282705730887,"lightbulbs_to_CFLs_for_a_day":1314.3910930077736,"lightbulbs_to_CFLs_for_a_week":187.7701234070895,"lightbulbs_to_CFLs_for_a_month":43.81308990382681,"lightbulbs_to_CFLs_for_a_year":3.601105704456978,"days_with_lightbulbs_to_CFLs":29.208726602551206,"weeks_with_lightbulbs_to_CFLs":4.172626123618626,"months_with_lightbulbs_to_CFLs":0.9735783884555965,"years_with_lightbulbs_to_CFLs":0.07997619337907573,"recycled_kgs_of_trash":79.02003100980869,"recycled_bags_of_trash":43.78467429357178},"methodology":"http://impact.brighterplanet.com/flights?destination_airport=ORD&origin_airport=MSN&segments_per_trip=1&timeframe=2012-01-01%2F2013-01-01&trips=1","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2012-01-01/2013-01-01","characteristics":{"segments_per_trip":{"description":"1","object":1},"trips":{"description":"1","object":1},"origin_airport":{"description":"MSN","object":{"airport":{"city":"Madison","country_iso_3166_code":"US","country_name":"United
States","iata_code":"MSN","latitude":43.1399,"longitude":-89.3375,"name":"Dane
County Regional Truax Field"}}},"destination_airport":{"description":"ORD","object":{"airport":{"city":"Chicago","country_iso_3166_code":"US","country_name":"United
States","iata_code":"ORD","latitude":41.9786,"longitude":-87.9048,"name":"Chicago
Ohare International"}}}},"errors":["API key \"carbon_test\" could not be verified.
Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
- request:
method: post
uri: http://impact.brighterplanet.com/automobiles.json
body:
encoding: US-ASCII
string: make=Nissan&model=Altima&year=2006&automobile_fuel%5Bcode%5D=R&timeframe=2011-01-01%2F2012-01-01&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:06:19 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"4520.8 kg","object":{"value":4520.789934497878,"units":"kilograms"},"methodology":"from
co2 emission, ch4 emission, n2o emission, and hfc emission"},"co2_emission":{"description":"4308.585980497603","object":4308.585980497603,"methodology":"from
fuel use and automobile fuel"},"co2_biogenic_emission":{"description":"0.0","object":0.0,"methodology":"from
fuel use and automobile fuel"},"ch4_emission":{"description":"4.537572120026403","object":4.537572120026403,"methodology":"from
fuel use and automobile fuel"},"n2o_emission":{"description":"15.37211589011779","object":15.37211589011779,"methodology":"from
fuel use and automobile fuel"},"hfc_emission":{"description":"192.29426599013075","object":192.29426599013075,"methodology":"from
fuel use and automobile fuel"},"energy":{"description":"63708.4 MJ","object":{"value":63708.41114166553,"units":"megajoules"},"methodology":"from
fuel use and automobile fuel"},"fuel_use":{"description":"1,839.8372129905256
l","object":{"value":1839.8372129905256,"units":"litres"},"methodology":"from
fuel efficiency and distance"},"distance":{"description":"17845.6","object":17845.6,"methodology":"from
annual distance"},"annual_distance":{"description":"17,845.6 km","object":{"value":17845.6,"units":"kilometres"},"methodology":"from
automobile fuel"},"speed":{"description":"50.94382232429702 km/h","object":{"value":50.94382232429702,"units":"kilometres_per_hour"},"methodology":"from
urbanity and safe country"},"fuel_efficiency":{"description":"9.699553783344362
km/l","object":{"value":9.699553783344362,"units":"kilometres_per_litre"},"methodology":"from
make model year and urbanity"},"hybridity_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"urbanity":{"description":"0.43","object":0.43,"methodology":"from
safe country"},"safe_country":{"description":null,"object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":8.226530750610781,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":null,"cooling_degree_days_units":null,"electricity_emission_factor":0.626089,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.096,"flight_route_inefficiency_factor":1.100000023841858,"heating_degree_days":null,"heating_degree_days_units":null,"iso_3166_alpha_3_code":null,"iso_3166_code":null,"iso_3166_numeric_code":null,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"fallback","rail_passengers":null,"rail_speed":32.49720001220703,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.06364482122342524,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.008762920291076415,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":37.11446191042177,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.10806735200626398,"rail_trip_electricity_intensity_units":"kilowatt_hour_per_passenger_kilometre"}},"methodology":"default"},"active_subtimeframe":{"description":"2011-01-01/2012-01-01","object":"2011-01-01/2012-01-01","methodology":"from
acquisition and retirement"},"acquisition":{"description":"2006-01-01","object":"2006-01-01","methodology":"from
year"},"retirement":{"description":"2012-01-01","object":"2012-01-01","methodology":"default"},"make_model_year":{"description":"Nissan
ALTIMA 2006","object":{"automobile_make_model_year":{"fuel_code":"R","fuel_efficiency_city":8.15793,"fuel_efficiency_city_units":"kilometres_per_litre","fuel_efficiency_highway":11.3122,"fuel_efficiency_highway_units":"kilometres_per_litre","hybridity":false,"make_name":"Nissan","model_name":"ALTIMA","name":"Nissan
ALTIMA 2006","year":2006}},"methodology":"from make, model, and year"},"make_year":{"description":"Nissan
2006","object":{"automobile_make_year":{"fuel_efficiency":11.2297,"fuel_efficiency_units":"kilometres_per_litre","make_name":"Nissan","name":"Nissan
2006","volume":1076456,"year":2006}},"methodology":"from make and year"},"make_model":{"description":"Nissan
ALTIMA","object":{"automobile_make_model":{"fuel_efficiency_city":8.47904,"fuel_efficiency_city_units":"kilometres_per_litre","fuel_efficiency_highway":11.65,"fuel_efficiency_highway_units":"kilometres_per_litre","make_name":"Nissan","model_name":"ALTIMA","name":"Nissan
ALTIMA"}},"methodology":"from make and model"}},"emitter":"Automobile","equivalents":{"cars_off_the_road_for_a_year":0.8227837680786138,"cars_off_the_road_for_a_month":9.86436363707437,"cars_off_the_road_for_a_week":42.744068830677435,"cars_off_the_road_for_a_day":300.0267447928861,"cars_to_priuses_for_a_year":1.6455675361572275,"cars_to_priuses_for_a_month":19.72872727414874,"cars_to_priuses_for_a_week":85.48813766135487,"cars_to_priuses_for_a_day":600.0534895857722,"one_way_domestic_flight":14.692567287118102,"round_trip_domestic_flight":7.346283643559051,"one_way_cross_country_flight":5.1627421051965765,"round_trip_cross_country_flight":2.5813710525982883,"vegan_meals_instead_of_non_vegan_ones":3637.820890021294,"days_of_veganism":1212.6069633404313,"weeks_of_veganism":173.22762871008968,"months_of_veganism":40.42038280434552,"years_of_veganism":3.32278060185594,"barrels_of_petroleum":10.515357387642064,"canisters_of_bbq_propane":188.36775420072308,"railroad_cars_full_of_coal":0.022603949672489392,"homes_energy_in_a_year":0.4385166236462941,"homes_energy_in_a_month":5.2395955340830405,"homes_energy_in_a_week":22.698886261113845,"homes_energy_in_a_day":159.3442828212467,"homes_electricity_in_a_year":0.664556120371188,"homes_electricity_in_a_month":7.9520694947817665,"homes_electricity_in_a_week":34.45746088074283,"homes_electricity_in_a_day":241.85774070570196,"homes_with_lowered_thermostat_2_degrees_for_a_winter":23.72962636617936,"homes_with_raised_thermostat_3_degrees_for_a_summer":10.669064245414992,"replaced_refrigerators":4.552435464039363,"loads_of_cold_laundry":2073.062473943216,"lightbulbs_for_a_year":8.345378219083083,"lightbulbs_for_a_month":101.55954587849482,"lightbulbs_for_a_week":435.25261331358666,"lightbulbs_for_a_day":3046.7818555649105,"lightbulbs_for_an_evening":18280.695654179395,"lightbulbs_to_CFLs_for_a_day":51860.13323463397,"lightbulbs_to_CFLs_for_a_week":7408.589170436301,"lightbulbs_to_CFLs_for_a_month":1728.6732175231018,"lightbulbs_to_CFLs_for_a_year":142.0839068513338,"days_with_lightbulbs_to_CFLs":1152.448811682068,"weeks_with_lightbulbs_to_CFLs":164.6336070446092,"months_with_lightbulbs_to_CFLs":38.41315207342846,"years_with_lightbulbs_to_CFLs":3.155511374279519,"recycled_kgs_of_trash":3117.785382276134,"recycled_bags_of_trash":1727.5520616193464},"methodology":"http://impact.brighterplanet.com/automobiles?automobile_fuel%5Bcode%5D=R&make=Nissan&model=Altima&timeframe=2011-01-01%2F2012-01-01&year=2006","scope":"The
automobile emission estimate is the total anthropogenic emissions from fuel
and air conditioning used by the automobile during the timeframe. It includes
CO2 emissions from combustion of non-biogenic fuel, CH4 and N2O emissions
from combustion of all fuel, and fugitive HFC emissions from air conditioning.","timeframe":"2011-01-01/2012-01-01","characteristics":{"make":{"description":"Nissan","object":{"automobile_make":{"fuel_efficiency":11.9656,"fuel_efficiency_units":"kilometres_per_litre","name":"Nissan"}}},"model":{"description":"ALTIMA","object":{"automobile_model":{"name":"ALTIMA"}}},"year":{"description":2006,"object":{"automobile_year":{"year":2006}}},"automobile_fuel":{"description":"regular
gasoline","object":{"automobile_fuel":{"annual_distance":17845.6,"annual_distance_units":"kilometres","base_fuel_name":"Motor
Gasoline","blend_fuel_name":null,"blend_portion":null,"ch4_emission_factor":0.00246629,"ch4_emission_factor_units":"kilograms_co2e_per_litre","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.34183,"co2_emission_factor_units":"kilograms_per_litre","code":"R","distance_key":"gasoline","ef_key":"gasoline","emission_factor":2.45717,"emission_factor_units":"kilograms_co2e_per_litre","energy_content":34.6272,"energy_content_units":"megajoules_per_litre","hfc_emission_factor":0.104517,"hfc_emission_factor_units":"kilograms_co2e_per_litre","n2o_emission_factor":0.00835515,"n2o_emission_factor_units":"kilograms_co2e_per_litre","name":"regular
gasoline"}}}},"errors":["API key \"carbon_test\" could not be verified. Please
register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:06:19 GMT
recorded_with: VCR 2.2.0

Carbon

Carbon is a Ruby API client and command-line console for the Brighter Planet impact estimate web service, which is located at http://impact.brighterplanet.com. By querying the web service, it can estimate the carbon emissions, energy usage, and other environmental impacts of many real-life objects, such as cars and houses, based on particular characteristics that they may have.

Full documentation: RDoc

Quick start 1: experimenting with the console

You'll need a Brighter Planet API key. See the "API keys" section below for details.

First get the gem:

$ gem install carbon

Then start the console:

$ carbon
carbon->

Provide your key:

carbon-> key '123ABC'
  => Using key 123ABC

Start a flight calculation:

carbon-> flight
  => 1210.66889895298 kg CO2e
flight*>

Start providing characteristics:

flight*> origin_airport 'jfk'
  => 1593.46008200024 kg CO2e
flight*> destination_airport 'lax'
  => 1766.55536727522 kg CO2e

Review what you've entered:

flight*> characteristics
  => origin_airport: jfk
     destination_airport: lax

See how the calculation's being made:

flight*> methodology
  => emission: from fuel and passengers with coefficients
     [ ... ]
     cohort: from t100

See intermediate calculations:

flight*> reports
  => emission: 1766.55536727522
     [ ... ]
     cohort: {"members"=>262}

Generate a methodology URL:

flight*> url
  => http://impact.brighterplanet.com/flights.json?origin_airport=jfk&destination_airport=lax&key=123ABC

And when you're done:

flight*> done
  => Saved as flight #0
carbon->

You can recall this flight anytime during this same session:

carbon-> flight 0
  => 1766.55536727522 kg CO2e
flight*> characteristics
  => origin_airport: jfk
     destination_airport: lax

For more, see the "Console" section below.

Quick start 2: using the library in your application

You'll need a Brighter Planet API key. See the "API keys" section below for details.

Carbon works by extending any Ruby class to be an emission source. You include Carbon and then use the emit_as DSL...

# see Carbon::ClassMethods#emit_as for more details
class MyFlight
  def airline
    # ... => MyAirline(:name, :icao_code, ...)
  end
  def aircraft
    # ... => MyAircraft(:name, :icao_code, ...)
  end
  def origin
    # ... => String
  end
  def destination
    # ... => String
  end
  def segments_per_trip
    # ... => Integer
  end
  def trips
    # ... => Integer
  end
  include Carbon
  emit_as 'Flight' do
    provide :segments_per_trip
    provide :trips
    provide :origin, :as => :origin_airport, :key => :iata_code
    provide :destination, :as => :destination_airport, :key => :iata_code
    provide(:airline, :key => :iata_code) { |f| f.airline.try(:iata_code) }
    provide(:aircraft, :key => :icao_code) { { |f| f.aircraft.try(:icao_code) }
  end
end

See RDoc on Carbon::ClassMethods#emit_as for all the details.

The final URL will be something like

http://impact.brighterplanet.com/flights.json?segments_per_trip=1&trips=1&origin_airport[iata_code]=MSN&destination_airport[iata_code]=ORD&airline[iata_code]=UA&aircraft[icao_code]=B737

When you want to calculate impacts, simply call MyFlight#impact.

?> my_flight = MyFlight.new([...])
=> #<MyFlight [...]>
?> my_impact = my_flight.impact(:timeframe => Timeframe.new(:year => 2009))
=> #<Hashie::Mash [...]>
?> my_impact.decisions.carbon.object.value
=> 1014.92
?> my_impact.decisions.carbon.object.units
=> "kilograms"
?> my_impact.methodology
=> "http://impact.brighterplanet.com/flights?[...]"

See RDoc on Carbon#impact for all the details.

API keys

You should get an API key from http://keys.brighterplanet.com and set it globally:

Carbon.key = '12903019230128310293'

Now all of your queries will use that key.

Gotcha: timeframes and 0.0kg results

You submit this query about a flight in 2009, but the result is 0.0 kilograms. Why?

$ carbon carbon-> flight [...] flight*> date '2009-05-03' => 0.0 kg CO2e flight*> url => http://impact.brighterplanet.com/flights?date=2009-05-03

It's telling you that a flight in 2009 did not result in any 2011 emissions (the default timeframe is the current year).

flight*> timeframe '2009' => 847.542137647608 kg CO2e flight*> url => http://impact.brighterplanet.com/flights?date=2009-05-03&timeframe=2009-01-01/2010-01-01

So, 850 kilograms emitted in 2009.

Console

This library includes a special console for performing calculations interactively. Quick Start #1 provides an example session. Here is a command reference:

Shell mode

help : Displays a list of emitter types.

key yourkey : Set the developer key that should be used for this session. Alternatively, put this key in ~/.brighter_planet and it will be auto-selected on console startup.

emitter : (e.g. flight) Enters emitter mode using this emitter type.

emitter num : (e.g. flight 0) Recalls a previous emitter from this session.

exit : Quits.

Emitter mode

In Emitter mode, the prompt displays the emitter type in use. If a timeframe has been set, the timeframe is also included in the prompt.

help : Displays a list of characteristics for this emitter type.

characteristic value : (e.g. origin_airport 'lax') : Provide a characteristic. Remember, this is Ruby we're dealing with, so strings must be quoted.

timeframe : Display the current timeframe in effect on the emission estimate.

timeframe timeframe : (e.g. timeframe '2009-01-01/2010-01-01' or just timeframe '2009') Set a timeframe on the emission estimate.

emission : Displays the current emission in kilograms CO2e for this emitter.

lbs, pounds, or tons : Display the emission using different units.

characteristics : Lists the characteristics you have provided so far.

methodology : Summarizes how the calculation is being made.

reports : Displays intermediate calculations that were made in pursuit of the emission estimate.

url : Generates a methodology URL suitable for pasting into your browser for further inspection.

done : Saves this emitter and returns to shell mode.

Copyright

Copyright (c) 2012 Brighter Planet.

require 'hashie/mash'
require 'avro'
require 'multi_json'
require 'active_support/core_ext'
module AvroHelper
SCALAR = ['boolean', 'int', 'float', 'string' ]
OPTIONAL_SCALAR = SCALAR + [ 'null' ]
OPTIONAL_STRING = ['string', 'null']
def AvroHelper.api_paths(schema, parents = nil, last_type = nil, &blk)
return unless schema.is_a?(::Hash)
schema = ::Hashie::Mash.new(schema) unless schema.is_a?(::Hashie::Mash)
my_name = schema.name
my_type = if schema.type == 'record'
my_schema = schema
schema.type
elsif schema.type.is_a?(::Hash)
my_schema = schema.type
schema.type.type
end
nested_schemas = if my_schema
case my_type
when 'array'
my_schema.items
when 'map'
my_schema.values
when 'record'
my_schema.fields
end
end
nested_schemas = Array.wrap nested_schemas
# if the last type was enumerable, then i'm anonymous
me = case last_type
when 'array'
'[]'
when 'map'
'{}'
when NilClass
nil
else
my_name
end
nested_schemas.each { |x| api_paths(x, [parents, me].flatten.compact, my_type, &blk) }
# don't try to print the top leve which will be 'v2' depending on the api version number
return unless parents
if my_name.present? and nested_schemas.none? { |x| x.is_a?(::Hash) }
children = case my_type
when 'array'
'[]'
when 'map'
'{}'
end
blk.call [parents, me, children].flatten.compact.join('.')
end
end
def AvroHelper.recursively_stringify_keys(hash)
hash.inject({}) do |result, (key, value)|
new_key = case key
when ::Symbol then key.to_s
else key
end
new_value = case value
when ::Hash then recursively_stringify_keys(value)
when ::Array then value.map { |i| i.is_a?(::Hash) ? recursively_stringify_keys(i) : i }
else value
end
result[new_key] = new_value
result
end
end
end
#!/usr/bin/env ruby
require 'rubygems'
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) unless $LOAD_PATH.include?(File.expand_path('../../lib', __FILE__))
require 'carbon/shell'
Bombshell.launch(Carbon::Shell)
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/carbon/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'carbon'
s.version = Carbon::VERSION
s.author = 'Seamus Abshere'
s.email = ['seamus@abshere.net', 'dkastner@gmail.com', 'andy@rossmeissl.net']
s.summary = 'Brighter Planet API client for Ruby'
s.description = 'Brighter Planet API client for Ruby'
s.homepage = 'https://github.com/brighterplanet/carbon'
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ["lib"]
s.add_runtime_dependency 'activesupport'
s.add_runtime_dependency 'bombshell'
s.add_runtime_dependency 'brighter_planet_metadata'
s.add_runtime_dependency 'cache_method'
s.add_runtime_dependency 'celluloid', '>=0.11.0'
s.add_runtime_dependency 'conversions'
s.add_runtime_dependency 'hashie'
s.add_runtime_dependency 'multi_json'
s.add_development_dependency 'aruba'
s.add_development_dependency 'avro'
s.add_development_dependency 'cucumber'
s.add_development_dependency 'fakeweb'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
s.add_development_dependency 'timeframe'
s.add_development_dependency 'vcr'
s.add_development_dependency 'yard'
end
require 'active_support/core_ext'
require 'carbon/query'
require 'carbon/query_pool'
require 'carbon/registry'
module Carbon
DOMAIN = 'http://impact.brighterplanet.com'.freeze
CONCURRENCY = 16
# @private
# Make sure there are no warnings about class vars.
@@key = nil unless defined?(@@key)
# @private
# Make sure there are no warnings about class vars.
@@domain = nil unless defined?(@@domain)
# Set the Brighter Planet API key that you can get from http://keys.brighterplanet.com
#
# @param [String] key The alphanumeric key.
#
# @return [nil]
def Carbon.key=(key)
@@key = key
nil
end
# Get the key you've set.
#
# @return [String] The key you set.
def Carbon.key
@@key
end
# Set an alternate API endpoint. You probably shouldn't do this.
#
# @param [String] domain ("http://impact.brighterplanet.com") The API endpoint
#
# @return [nil]
def Carbon.domain=(domain)
@@domain = domain
nil
end
# Where we send queries.
#
# @return [String] The API endpoint.
def Carbon.domain
@@domain || DOMAIN
end
# Get impact estimates from Brighter Planet CM1; low-level method that does _not_ require you to define {Carbon::ClassMethods#emit_as} blocks; just pass emitter/param or objects that respond to +#as_impact_query+.
#
# Return values are {http://rdoc.info/github/intridea/hashie/Hashie/Mash Hashie::Mash} objects because they are a simple way to access a deeply nested response.
#
# Here's a map of what's included in a response:
#
# certification
# characteristics.{}.description
# characteristics.{}.object
# compliance.[]
# decisions.{}.description
# decisions.{}.methodology
# decisions.{}.object
# emitter
# equivalents.{}
# errors.[]
# methodology
# scope
# timeframe.endDate
# timeframe.startDate
#
# @overload query(emitter, params)
# The simplest form.
# @param [String] emitter The {http://impact.brighterplanet.com/emitters.json emitter name}.
# @param [optional, Hash] params Characteristics like airline/airport/etc., your API key (if you didn't set it globally), timeframe, compliance, etc.
# @option params [Timeframe] :timeframe (Timeframe.this_year) What time period to focus the calculation on. See {https://github.com/rossmeissl/timeframe timeframe} documentation.
# @option params [Array<Symbol>] :comply ([]) What {http://impact.brighterplanet.com/protocols.json calculation protocols} to require.
# @option params [String, Numeric] <i>characteristic</i> Pieces of data about an emitter. The {http://impact.brighterplanet.com/flights/options Flight characteristics API} lists valid keys like +:aircraft+, +:origin_airport+, etc.
# @return [Hashie::Mash] The API response, contained in an easy-to-use +Hashie::Mash+
#
# @overload query(obj)
# Pass in a single query-able object.
# @param [#as_impact_query] obj An object that responds to +#as_impact_query+, generally because you've declared {Carbon::ClassMethods#emit_as} on its parent class.
# @return [Hashie::Mash] The API response, contained in an easy-to-use +Hashie::Mash+
#
# @overload query(array)
# Get impact estimates for multiple query-able objects concurrently.
# @param [Array<Array, #as_impact_query>] array An array of plain queries and/or objects that respond to +#as_impact_query+.
# @return [Hash{Object => Hashie::Mash}] A +Hash+ of +Hashie::Mash+ objects, keyed on the original query object.
#
# @note We make up to 16 requests concurrently (hardcoded, per the Brighter Planet Terms of Service) and it can be more than 90% faster than running queries serially!
#
# @note +[emitter, params]+ is called a "plain query."
#
# @raise [ArgumentError] If your arguments don't match any of the method signatures.
#
# @raise [ArgumentError] If you try to pass a block - you probably want +Carbon.query(array).each {}+ or something.
#
# @example A flight taken in 2009
# Carbon.query('Flight', :origin_airport => 'MSN', :destination_airport => 'ORD', :date => '2009-01-01', :timeframe => Timeframe.new(:year => 2009), :comply => [:tcr])
#
# @example How do I use a +Hashie::Mash+?
# 1.8.7 :001 > require 'rubygems'
# => true
# 1.8.7 :002 > require 'hashie/mash'
# => true
# 1.8.7 :003 > mash = Hashie::Mash.new(:hello => 'world')
# => #<Hashie::Mash hello="world">
# 1.8.7 :004 > mash.hello
# => "world"
# 1.8.7 :005 > mash['hello']
# => "world"
# 1.8.7 :006 > mash[:hello]
# => "world"
# 1.8.7 :007 > mash.keys
# => ["hello"]
#
# @example Other examples of what's in the response
# my_impact.carbon.object.value
# my_impact.characteristics.airline.description
# my_impact.equivalents.lightbulbs_for_a_week
#
# @example Flights and cars (concurrently, as arrays)
# queries = [
# ['Flight', {:origin_airport => 'MSN', :destination_airport => 'ORD', :date => '2009-01-01', :timeframe => Timeframe.new(:year => 2009), :comply => [:tcr]}],
# ['Flight', {:origin_airport => 'SFO', :destination_airport => 'LAX', :date => '2011-09-29', :timeframe => Timeframe.new(:year => 2011), :comply => [:iso]}],
# ['Automobile', {:make => 'Nissan', :model => 'Altima', :timeframe => Timeframe.new(:year => 2008), :comply => [:tcr]}]
# ]
# Carbon.query(queries)
#
# @example Flights and cars (concurrently, as query-able objects)
# Carbon.query(MyFlight.all+MyCar.all).each do |car_or_flight, impact|
# puts "Carbon emitter by #{car_or_flight} was #{impact.decisions.carbon.object.value.round(1)}"
# end
def Carbon.query(*args)
raise ::ArgumentError, "Don't pass a block directly - instead use Carbon.query(array).each (for example)." if block_given?
Query.perform(*args)
end
# Called when you +include Carbon+ and adds the class method +emit_as+.
# @private
def Carbon.included(klass)
klass.extend ClassMethods
end
# Mixed into any class that includes +Carbon+.
module ClassMethods
# DSL for declaring how to represent this class an an emitter.
#
# See also {Carbon::Registry::Registrar#provide}.
#
# You get this when you +include Carbon+ in a class.
#
# @param [String] emitter The {http://impact.brighterplanet.com/emitters.json camelcased emitter name}.
#
# @return [nil]
#
# @example MyFlight
# # A a flight in your data warehouse
# class MyFlight
# def airline
# # ... => MyAirline(:name, :icao_code, ...)
# end
# def aircraft
# # ... => MyAircraft(:name, :icao_code, ...)
# end
# def origin
# # ... => String
# end
# def destination
# # ... => String
# end
# def segments_per_trip
# # ... => Integer
# end
# def trips
# # ... => Integer
# end
# include Carbon
# emit_as 'Flight' do
# provide :segments_per_trip
# provide :trips
# provide :origin, :as => :origin_airport, :key => :iata_code
# provide :destination, :as => :destination_airport, :key => :iata_code
# provide(:airline, :key => :iata_code) { |f| f.airline.try(:iata_code) }
# provide(:aircraft, :key => :icao_code) { { |f| f.aircraft.try(:icao_code) }
# end
# end
def emit_as(emitter, &blk)
emitter = emitter.to_s.singularize.camelcase
registrar = Registry::Registrar.new self, emitter
registrar.instance_eval(&blk)
end
end
# A query like what you could pass into +Carbon.query+.
#
# @param [Hash] extra_params Anything you want to override.
#
# @option extra_params [Timeframe] :timeframe
# @option extra_params [Array<Symbol>] :comply
# @option extra_params [String] :key In case you didn't define it globally, or want to use a different one here.
# @option extra_params [String, Numeric] <i>characteristic</i> Override pieces of data about an emitter.
#
# @return [Array] Something you could pass into +Carbon.query+.
def as_impact_query(extra_params = {})
registration = Registry.instance[self.class.name]
params = registration.characteristics.inject({}) do |memo, (method_id, translation_options)|
k = translation_options.has_key?(:as) ? translation_options[:as] : method_id
if translation_options.has_key?(:key)
k = "#{k}[#{translation_options[:key]}]"
end
v = if translation_options.has_key?(:blk)
translation_options[:blk].call self
else
send method_id
end
if v.present?
memo[k] = v
end
memo
end
params.merge! extra_params
if Carbon.key and not params.has_key?(:key)
params[:key] = Carbon.key
end
[ registration.emitter, params ]
end
# Get an impact estimate from Brighter Planet CM1; high-level convenience method that requires a {Carbon::ClassMethods#emit_as} block.
#
# You get this when you +include Carbon+ in a class.
#
# See {Carbon.query} for an explanation of the return value, a +Hashie::Mash+.
#
# @param [Hash] extra_params Anything you want to override.
#
# @option extra_params [Timeframe] :timeframe
# @option extra_params [Array<Symbol>] :comply
# @option extra_params [String] :key In case you didn't define it globally, or want to use a different one here.
# @option extra_params [String, Numeric] <i>characteristic</i> Override pieces of data about an emitter.
#
# @return [Hashie::Mash]
#
# @example Getting impact estimate for MyFlight
# ?> my_flight = MyFlight.new([...])
# => #<MyFlight [...]>
# ?> my_impact = my_flight.impact(:timeframe => Timeframe.new(:year => 2009))
# => #<Hashie::Mash [...]>
# ?> my_impact.decisions.carbon.object.value
# => 1014.92
# ?> my_impact.decisions.carbon.object.units
# => "kilograms"
# ?> my_impact.methodology
# => "http://impact.brighterplanet.com/flights?[...]"
def impact(extra_params = {})
plain_query = as_impact_query extra_params
Carbon.query(*plain_query)
end
end
---
http_interactions:
- request:
method: post
uri: http://carbon.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:05:43 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"emission":1087.1649532388976,"emitter":"Flight","timeframe":"2012-01-01/2013-01-01","methodology":"http://impact.brighterplanet.com/flights?timeframe=2012-01-01%2F2013-01-01","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","complies":[],"equivalents":{"cars_off_the_road_for_a_year":0.19786402148947937,"cars_off_the_road_for_a_month":2.3721939279672744,"cars_off_the_road_for_a_week":10.279144632873777,"cars_off_the_road_for_a_day":72.15078928665267,"cars_to_priuses_for_a_year":0.39572804297895875,"cars_to_priuses_for_a_month":4.744387855934549,"cars_to_priuses_for_a_week":20.558289265747554,"cars_to_priuses_for_a_day":144.30157857330533,"one_way_domestic_flight":3.533286098026417,"round_trip_domestic_flight":1.7666430490132086,"one_way_cross_country_flight":1.2415423765988212,"round_trip_cross_country_flight":0.6207711882994106,"vegan_meals_instead_of_non_vegan_ones":874.8275047269489,"days_of_veganism":291.6091682423163,"weeks_of_veganism":41.657986678208076,"months_of_veganism":9.720341846908983,"years_of_veganism":0.7990662406305897,"barrels_of_petroleum":2.528745681233676,"canisters_of_bbq_propane":45.29890210660515,"railroad_cars_full_of_coal":0.005435824766194489,"homes_energy_in_a_year":0.10545500046417307,"homes_energy_in_a_month":1.2600241808038823,"homes_energy_in_a_week":5.458655230212505,"homes_energy_in_a_day":38.319303106811425,"homes_electricity_in_a_year":0.15981324812611794,"homes_electricity_in_a_month":1.9123231527472209,"homes_electricity_in_a_week":8.286371273586878,"homes_electricity_in_a_day":58.16223783332778,"homes_with_lowered_thermostat_2_degrees_for_a_winter":5.706528839550974,"homes_with_raised_thermostat_3_degrees_for_a_summer":2.5657092896437987,"replaced_refrigerators":1.09477510791157,"loads_of_cold_laundry":498.5325352871354,"lightbulbs_for_a_year":2.006906503679005,"lightbulbs_for_a_month":24.423160674511834,"lightbulbs_for_a_week":104.67006736793459,"lightbulbs_for_a_day":732.6937330704019,"lightbulbs_for_an_evening":4396.1634855873635,"lightbulbs_to_CFLs_for_a_day":12471.386669121135,"lightbulbs_to_CFLs_for_a_week":1781.626356398747,"lightbulbs_to_CFLs_for_a_month":415.7133963143494,"lightbulbs_to_CFLs_for_a_year":34.16850731534531,"days_with_lightbulbs_to_CFLs":277.14226420956624,"weeks_with_lightbulbs_to_CFLs":39.59128610210093,"months_with_lightbulbs_to_CFLs":9.237640607670912,"years_with_lightbulbs_to_CFLs":0.7588411373607507,"recycled_kgs_of_trash":749.7687458259719,"recycled_bags_of_trash":415.44377940594615},"emission_units":"kilograms","execution_id":"UNSUPPORTED","errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"],"reports":[{"committee":{"name":"emission"},"conclusion":{"value":1087.1649532388976,"units":"kilograms"},"quorum":{"name":"from
fuel use and greenhouse gas emission factor"}},{"committee":{"name":"ghg_emission_factor"},"conclusion":5.15214,"quorum":{"name":"from
fuel and aviation multiplier"}},{"committee":{"name":"aviation_multiplier"},"conclusion":2.0,"quorum":{"name":"default"}},{"committee":{"name":"energy"},"conclusion":{"value":7939.69681453416,"units":"megajoules"},"quorum":{"name":"from
fuel use and fuel"}},{"committee":{"name":"fuel_use"},"conclusion":211.0123081358227,"quorum":{"name":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"}},{"committee":{"name":"fuel_per_segment"},"conclusion":8477.788829453548,"quorum":{"name":"from
adjusted distance per segment and fuel use coefficients"}},{"committee":{"name":"seat_class_multiplier"},"conclusion":1.0,"quorum":{"name":"default"}},{"committee":{"name":"distance_class"},"conclusion":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"quorum":{"name":"from adjusted distance per segment"}},{"committee":{"name":"adjusted_distance_per_segment"},"conclusion":962.1615428278766,"quorum":{"name":"from
adjusted distance and segments per trip"}},{"committee":{"name":"adjusted_distance"},"conclusion":1616.4313919508327,"quorum":{"name":"from
distance, route inefficiency factor, and dogleg factor"}},{"committee":{"name":"distance"},"conclusion":1262.599964160848,"quorum":{"name":"default"}},{"committee":{"name":"route_inefficiency_factor"},"conclusion":1.100000023841858,"quorum":{"name":"default"}},{"committee":{"name":"dogleg_factor"},"conclusion":1.1638548181950328,"quorum":{"name":"from
segments per trip"}},{"committee":{"name":"fuel_use_coefficients"},"conclusion":{"m3":1.0532072472371498e-07,"m2":-0.00015627733290887285,"m1":7.148223019744806,"b":1650.9061605236384},"quorum":{"name":"default"}},{"committee":{"name":"fuel"},"conclusion":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"quorum":{"name":"default"}},{"committee":{"name":"passengers"},"conclusion":131,"quorum":{"name":"from
seats and load factor"}},{"committee":{"name":"seats"},"conclusion":169.27798641328772,"quorum":{"name":"default"}},{"committee":{"name":"load_factor"},"conclusion":0.7731146349652108,"quorum":{"name":"default"}},{"committee":{"name":"freight_share"},"conclusion":0.06885888622195808,"quorum":{"name":"default"}},{"committee":{"name":"trips"},"conclusion":1.7,"quorum":{"name":"default"}},{"committee":{"name":"segments_per_trip"},"conclusion":1.68,"quorum":{"name":"default"}},{"committee":{"name":"date"},"conclusion":"2012-01-01","quorum":{"name":"from
timeframe"}}],"carbon":{"value":1087.1649532388976,"units":"kilograms"},"ghg_emission_factor":5.15214,"aviation_multiplier":2.0,"energy":{"value":7939.69681453416,"units":"megajoules"},"fuel_use":211.0123081358227,"fuel_per_segment":8477.788829453548,"seat_class_multiplier":1.0,"distance_class":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"adjusted_distance_per_segment":962.1615428278766,"adjusted_distance":1616.4313919508327,"distance":1262.599964160848,"route_inefficiency_factor":1.100000023841858,"dogleg_factor":1.1638548181950328,"fuel_use_coefficients":{"m3":1.0532072472371498e-07,"m2":-0.00015627733290887285,"m1":7.148223019744806,"b":1650.9061605236384},"fuel":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"passengers":131,"seats":169.27798641328772,"load_factor":0.7731146349652108,"freight_share":0.06885888622195808,"trips":1.7,"segments_per_trip":1.68,"date":"2012-01-01"}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:05:43 GMT
recorded_with: VCR 2.2.0
require 'helper'
require 'timeframe'
require 'benchmark'
require 'my_nissan_altima'
Thread.abort_on_exception = true
Carbon.key = 'carbon_test'
describe Carbon do
before do
flush_cache!
end
describe '.query' do
context 'serial' do
it "calculates flight impact" do
VCR.use_cassette 'LAX->SFO flight', :record => :once do
result = Carbon.query('Flight', :origin_airport => 'LAX', :destination_airport => 'SFO', :segments_per_trip => 1, :trips => 1)
result.decisions.carbon.object.value.should be_within(50).of(200)
end
end
it "can be used on an object that responds to #as_impact_query" do
VCR.use_cassette '2006 Altima', :record => :once do
Carbon.query(MyNissanAltima.new(2006)).decisions.should == MyNissanAltima.new(2006).impact.decisions
end
end
it "gets back characteristics" do
VCR.use_cassette 'LAX->SFO flight', :record => :once do
result = Carbon.query('Flight', :origin_airport => 'LAX', :destination_airport => 'SFO', :segments_per_trip => 1, :trips => 1)
result.characteristics.origin_airport.description.should =~ %r{lax}i
end
end
it "tells you if the query is successful" do
VCR.use_cassette 'Flight', :record => :once do
result = Carbon.query('Flight')
result.success.should be_true
end
end
it "is gentle about errors" do
VCR.use_cassette 'Monkey', :record => :once do
result = Carbon.query('Monkey')
result.success.should be_false
end
end
it "sends timeframe properly" do
VCR.use_cassette 'timeframed flight', :record => :once do
result = Carbon.query('Flight', :timeframe => Timeframe.new(:year => 2009))
result.timeframe.should == '2009-01-01/2010-01-01'
end
end
it "sends key properly" do
VCR.use_cassette 'flight with key 1', :record => :once do
result = Carbon.query('Flight', :key => 'carbon_test1')
result.errors.first.should =~ /carbon_test1/
end
VCR.use_cassette 'flight with key 2', :record => :once do
result = Carbon.query('Flight', :key => 'carbon_test2')
result.errors.first.should =~ /carbon_test2/
end
end
it "allows choosing domain" do
VCR.use_cassette 'carbon.bp.com flight', :record => :once do
result = Carbon.query('Flight', :domain => 'http://carbon.brighterplanet.com')
result.carbon.value.should > 0
end
end
it "raises ArgumentError if args are bad" do
expect do
Carbon.query(['Flight'])
end.should raise_error(ArgumentError)
end
end
context 'in parallel', :multi => true do
before do
VCR.turn_off!
@queries = []
@queries << ['Flight', {:origin_airport => 'LAX', :destination_airport => 'SFO', :segments_per_trip => 1, :trips => 1}]
@queries << ['Flight', {:origin_airport => 'MSN', :destination_airport => 'ORD', :segments_per_trip => 1, :trips => 1}]
@queries << ['Flight', {:origin_airport => 'IAH', :destination_airport => 'DEN', :segments_per_trip => 1, :trips => 1}]
@queries << ['RailTrip', {:distance => 25}]
@queries << ['RailTrip', {:rail_class => 'commuter'}]
@queries << ['RailTrip', {:rail_traction => 'electric'}]
@queries << ['AutomobileTrip', {:make => 'Nissan', :model => 'Altima'}]
@queries << ['AutomobileTrip', {:make => 'Toyota', :model => 'Prius'}]
@queries << ['AutomobileTrip', {:make => 'Ford', :model => 'Taurus'}]
@queries << ['Residence', {:urbanity => 'City'}]
@queries << ['Residence', {:zip_code => '53703'}]
@queries << ['Residence', {:bathrooms => 4}]
@queries << ['Monkey', {:bananas => '1'}]
@queries << ['Monkey', {:bananas => '2'}]
@queries << ['Monkey', {:bananas => '3'}]
@queries = @queries.sort_by { rand }
end
after do
VCR.turn_on!
end
it "is easy to use" do
flight = ['Flight']
rail_trip = ['RailTrip']
results = Carbon.query([flight, rail_trip])
results[flight].decisions.should == Carbon.query('Flight').decisions
results[rail_trip].decisions.should == Carbon.query('RailTrip').decisions
end
it "doesn't hang up on 0 queries" do
Timeout.timeout(0.5) { Carbon.query([]) }.should ==(Hash.new)
end
it "raises if you pass it a block directly" do
expect do
Carbon.query([]) { }
end.should raise_error(ArgumentError)
end
it "can be used on objects that respond to #as_impact_query" do
a = MyNissanAltima.new(2001)
b = MyNissanAltima.new(2006)
ab1 = Carbon.query([a, b])
ab2 = Carbon.query([a.as_impact_query, b.as_impact_query])
ab1.keys.should == [a, b]
ab2.keys.should == [a.as_impact_query, b.as_impact_query]
ab1.each do |k, v|
ab2[k.as_impact_query].should == v
end
end
it "runs multiple queries at once" do
reference_results = @queries.inject({}) do |memo, query|
memo[query] = Carbon.query(*query)
memo
end
ts = []
3.times do
ts << Thread.new do
flush_cache! # important!
multi_results = Carbon.query(@queries)
error_count = 0
multi_results.each do |query, result|
if result.success
result.decisions.carbon.object.value.should > 0
result.decisions.carbon.object.value.should < 10_000
else
error_count += 1
end
end
error_count.should == 3
reference_results.each do |query, reference_result|
if reference_result.success
multi_results[query].decisions.should == reference_result.decisions
else
multi_results[query].should == reference_result
end
end
end
end
ts.each do |t|
t.join
end
end
it "is faster than single threaded" do
# warm up the cache on the other end
@queries.each { |query| Carbon.query(*query) }
flush_cache! # important!
single_threaded_time = Benchmark.realtime do
@queries.each { |query| Carbon.query(*query) }
end
flush_cache! # important!
multi_threaded_time = Benchmark.realtime do
Carbon.query(@queries)
end
cached_single_threaded_time = Benchmark.realtime do
@queries.each { |query| Carbon.query(*query) }
end
cached_multi_threaded_time = Benchmark.realtime do
Carbon.query(@queries)
end
multi_threaded_time.should < single_threaded_time
cached_single_threaded_time.should < multi_threaded_time
cached_multi_threaded_time.should < multi_threaded_time
$stderr.puts " Multi-threaded was #{((single_threaded_time - multi_threaded_time) / single_threaded_time * 100).round}% faster than single-threaded"
$stderr.puts " Cached single-threaded was #{((multi_threaded_time - cached_single_threaded_time) / multi_threaded_time * 100).round}% faster than uncached multi-threaded"
$stderr.puts " Cached multi-threaded was #{((multi_threaded_time - cached_multi_threaded_time) / multi_threaded_time * 100).round}% faster than uncached multi-threaded"
end
it "safely uniq's and caches queries" do
reference_results = @queries.inject({}) do |memo, query|
memo[query] = Carbon.query(*query)
memo
end
flush_cache! # important!
3.times do
multi_results = Carbon.query(@queries)
reference_results.each do |query, reference_result|
if reference_result.success
multi_results[query].decisions.should == reference_result.decisions
else
multi_results[query].should == reference_result
end
end
end
end
end
end
describe "mixin" do
describe :emit_as do
it "overwrites old emit_as blocks" do
eval %{class MyFoo; include Carbon; end}
MyFoo.emit_as('Automobile') { provide(:make) }
Carbon::Registry.instance['MyFoo'].characteristics.keys.should == [:make]
MyFoo.emit_as('Automobile') { provide(:model) }
Carbon::Registry.instance['MyFoo'].characteristics.keys.should == [:model]
end
end
describe '#impact' do
it 'calculates a single impact' do
VCR.use_cassette '2006 Altima', :record => :once do
impact = MyNissanAltima.new(2006).impact
impact.decisions.carbon.object.value.should > 0
impact.characteristics.make.description.should =~ %r{Nissan}i
impact.characteristics.model.description.should =~ %r{Altima}i
impact.characteristics.year.description.to_i.should == 2006
impact.characteristics.automobile_fuel.description.should =~ %r{regular gasoline}
end
end
it 'accepts a timeframe option' do
VCR.use_cassette '2006 Altima in 2010', :record => :once do
impact_2010 = MyNissanAltima.new(2006).impact(:timeframe => Timeframe.new(:year => 2010))
impact_2010.timeframe.should =~ /^2010-01-01/
end
VCR.use_cassette '2006 Altima in 2011', :record => :once do
impact_2011 = MyNissanAltima.new(2006).impact(:timeframe => Timeframe.new(:year => 2011))
impact_2011.timeframe.should =~ /^2011-01-01/
end
end
end
end
end
3.0.0 / 2012-06-08
* Breaking changes
* Ruby 1.9 only because it uses celluloid / fibers.
* Enhancements
* When doing multiple queries, use Celluloid [worker] pools instead of creating new threads
* Use RSpec as the API testing framework
2.2.3 / 2012-04-12
* Enhancements
* Raise an ArgumentError if you make the common mistake of calling Carbon.query(array) {} instead of Carbon.query(array).each {}
* Bug fixes
* Fix how shell gets characteristics for an emitter
2.2.2 / 2012-04-05
* Enhancements
* Allow choosing domain (API endpoint)
* Slightly improved method signature explanations: query_array -> plain_query, o -> obj, os -> array
* Bug fixes
* Actually send keys set with Carbon.key
2.2.1 / 2012-03-21
* Enhancements
* Switched from EventMachine to pure Ruby threads, a small speed sacrifice that gains us compatibilty with MRI 1.8, MRI 1.9, and JRuby. Also works better in multithreaded environments - no accidentally turning off somebody's EventMachine reactor :)
2.2.0 / 2012-03-20
* Enhancements
* Carbon.query(os) now returns a Hash keyed by the "os", instead of just a carefully ordered Array.
* Breaking changes
* Carbon.query(os) has a different return value!
2.1.0 / 2012-03-14
* Enhancements
* Simplified API down to just Carbon.query. It has three method signatures.
* Simplified EventMachine reactor
* Limited concurrency to 16 connections at a time
* Breaking changes
* Simplified API down to just Carbon.query :)
2.0.3 / 2012-03-13
* Enhancements
* Automatically skip redundant queries and cache things for an hour (in-process, unless you set up CacheMethod.config.storage = $memcached or something)
2.0.2 / 2012-03-13
* Bug fixes
* Don't hang up on Carbon.multi if 0 queries are passed
2.0.1 / 2012-03-12
* Bug fixes
* Don't send blank (incl. nil) characteristics
* Documentation changes
* Recommend people use Object#try when passing a block to #provide
2.0.0 / 2012-03-09
* Breaking changes
* #emission_estimate has been removed in favor of #impact
* Response structure now mirrors what you get from http://impact.brighterplanet.com
* Enhancements
* Carbon.multi method for parallelizing requests
* Tested with MRI 1.8 and MRI 1.9
require 'active_support/core_ext'
require File.expand_path('../avro_helper', __FILE__)
module Cm1Avro
class Impact
def notes
[
"All emitters return carbon (@impact_response.decisions.carbon).",
"Check emitter documentation to see what other impacts (energy, waste, etc.) are returned."
]
end
def dns_name
'impact.brighterplanet.com'
end
def namespace
dns_name.split('.').reverse.join('.')
end
def example
{"compliance"=>[],
"decisions"=>
{"carbon"=>
{"description"=>"78.7 kg",
"object"=>{"value"=>78.67540811299375, "units"=>"kilograms"},
"methodology"=>"from fuel use and greenhouse gas emission factor"},
"ghg_emission_factor"=>
{"description"=>"5.15214",
"object"=>5.15214,
"methodology"=>"from fuel and aviation multiplier"},
"aviation_multiplier"=>
{"description"=>"2.0", "object"=>2.0, "methodology"=>"default"},
"energy"=>
{"description"=>"574.6 MJ",
"object"=>{"value"=>574.5759972448694, "units"=>"megajoules"},
"methodology"=>"from fuel use and fuel"},
"fuel_use"=>
{"description"=>"15.270432890603466",
"object"=>15.270432890603466,
"methodology"=>
"from fuel per segment, segments per trip, trips, freight_share, passengers, seat class multiplier, fuel, date, and timeframe"},
"fuel_per_segment"=>
{"description"=>"1480.9925950502234",
"object"=>1480.9925950502234,
"methodology"=>
"from adjusted distance per segment and fuel use coefficients"},
"seat_class_multiplier"=>
{"description"=>"1.0", "object"=>1.0, "methodology"=>"default"},
"distance_class"=>
{"description"=>"short haul",
"object"=>
{"flight_distance_class"=>
{"distance"=>1108.0,
"distance_units"=>"kilometres",
"max_distance"=>3700.0,
"max_distance_units"=>"kilometres",
"min_distance"=>0.0,
"min_distance_units"=>"kilometres",
"name"=>"short haul"}},
"methodology"=>"from adjusted distance per segment"},
"adjusted_distance_per_segment"=>
{"description"=>"100.8961154095222",
"object"=>100.8961154095222,
"methodology"=>"from adjusted distance and segments per trip"},
"adjusted_distance"=>
{"description"=>"100.8961154095222",
"object"=>100.8961154095222,
"methodology"=>
"from distance, route inefficiency factor, and dogleg factor"},
"distance"=>
{"description"=>"94.29543496217028",
"object"=>94.29543496217028,
"methodology"=>"from airports"},
"route_inefficiency_factor"=>
{"description"=>"1.07", "object"=>1.07, "methodology"=>"from country"},
"dogleg_factor"=>
{"description"=>"1.0",
"object"=>1.0,
"methodology"=>"from segments per trip"},
"fuel_use_coefficients"=>
{"description"=>
"BrighterPlanet::Flight::ImpactModel::FuelUseEquation::Given",
"object"=>{"m3"=>4.986e-08, "m2"=>8.255e-05, "m1"=>5.246, "b"=>950.8},
"methodology"=>"from aircraft"},
"fuel"=>
{"description"=>"Jet Fuel",
"object"=>
{"fuel"=>
{"biogenic_fraction"=>0.0,
"carbon_content"=>18.672,
"carbon_content_units"=>"grams_per_megajoule",
"co2_biogenic_emission_factor"=>0.0,
"co2_biogenic_emission_factor_units"=>"kilograms_per_litre",
"co2_emission_factor"=>2.57607,
"co2_emission_factor_units"=>"kilograms_per_litre",
"density"=>0.8156,
"density_units"=>"kilograms_per_litre",
"energy_content"=>37.6267,
"energy_content_units"=>"megajoules_per_litre",
"name"=>"Jet Fuel",
"oxidation_factor"=>1.0,
"physical_units"=>nil}},
"methodology"=>"default"},
"passengers"=>
{"description"=>"111",
"object"=>111,
"methodology"=>"from seats and load factor"},
"seats"=>
{"description"=>"143.096",
"object"=>143.096,
"methodology"=>"from aircraft"},
"load_factor"=>
{"description"=>"0.7734122348583675",
"object"=>0.7734122348583675,
"methodology"=>"default"},
"freight_share"=>
{"description"=>"0.0665336701213722",
"object"=>0.0665336701213722,
"methodology"=>"default"},
"country"=>
{"description"=>"US",
"object"=>
{"country"=>
{"automobile_city_speed"=>32.0259,
"automobile_city_speed_units"=>"kilometres_per_hour",
"automobile_fuel_efficiency"=>9.2669,
"automobile_fuel_efficiency_units"=>"kilometres_per_litre",
"automobile_highway_speed"=>91.8935,
"automobile_highway_speed_units"=>"kilometres_per_hour",
"automobile_trip_distance"=>16.3348,
"automobile_trip_distance_units"=>"kilometres",
"automobile_urbanity"=>0.43,
"cooling_degree_days"=>882.0,
"cooling_degree_days_units"=>"degrees_celsius",
"electricity_emission_factor"=>0.589455,
"electricity_emission_factor_units"=>
"kilograms_co2e_per_kilowatt_hour",
"electricity_loss_factor"=>0.0615633,
"flight_route_inefficiency_factor"=>1.07,
"heating_degree_days"=>2159.0,
"heating_degree_days_units"=>"degrees_celsius",
"iso_3166_alpha_3_code"=>"USA",
"iso_3166_code"=>"US",
"iso_3166_numeric_code"=>840,
"lodging_district_heat_intensity"=>1.73952,
"lodging_district_heat_intensity_units"=>"megajoules_per_room_night",
"lodging_electricity_intensity"=>33.3145,
"lodging_electricity_intensity_units"=>
"kilowatt_hours_per_room_night",
"lodging_fuel_oil_intensity"=>0.411674,
"lodging_fuel_oil_intensity_units"=>"gallons_per_room_night",
"lodging_natural_gas_intensity"=>1.96714,
"lodging_natural_gas_intensity_units"=>"cubic_metres_per_room_night",
"lodging_occupancy_rate"=>0.601,
"name"=>"United States",
"rail_passengers"=>4467000000.0,
"rail_speed"=>32.4972,
"rail_speed_units"=>"kilometres_per_hour",
"rail_trip_co2_emission_factor"=>0.0957617,
"rail_trip_co2_emission_factor_units"=>
"kilograms_per_passenger_kilometre",
"rail_trip_diesel_intensity"=>0.0194247,
"rail_trip_diesel_intensity_units"=>"litres_per_passenger_kilometre",
"rail_trip_distance"=>12.9952,
"rail_trip_distance_units"=>"kilometres",
"rail_trip_electricity_intensity"=>0.140512,
"rail_trip_electricity_intensity_units"=>
"kilowatt_hours_per_passenger_kilometre"}},
"methodology"=>"from origin airport and destination airport"},
"date"=>
{"description"=>"2012-01-01",
"object"=>"2012-01-01",
"methodology"=>"from timeframe"}},
"emitter"=>"Flight",
"equivalents"=>
{"cars_off_the_road_for_a_year"=>0.014318924276564863,
"cars_off_the_road_for_a_month"=>0.17166974050255235,
"cars_off_the_road_for_a_week"=>0.743875983708356,
"cars_off_the_road_for_a_day"=>5.221372134826943,
"cars_to_priuses_for_a_year"=>0.028637848553129727,
"cars_to_priuses_for_a_month"=>0.3433394810051047,
"cars_to_priuses_for_a_week"=>1.487751967416712,
"cars_to_priuses_for_a_day"=>10.442744269653886,
"one_way_domestic_flight"=>0.25569507636722966,
"round_trip_domestic_flight"=>0.12784753818361483,
"one_way_cross_country_flight"=>0.08984731606503886,
"round_trip_cross_country_flight"=>0.04492365803251943,
"vegan_meals_instead_of_non_vegan_ones"=>63.309078128220605,
"days_of_veganism"=>21.1030260427402,
"weeks_of_veganism"=>3.014684288073694,
"months_of_veganism"=>0.7034368239382771,
"years_of_veganism"=>0.057826424963050405,
"barrels_of_petroleum"=>0.18299899927082347,
"canisters_of_bbq_propane"=>3.278168229844111,
"railroad_cars_full_of_coal"=>0.0003933770405649688,
"homes_energy_in_a_year"=>0.007631514586960394,
"homes_energy_in_a_month"=>0.09118479800295977,
"homes_energy_in_a_week"=>0.39502922413534164,
"homes_energy_in_a_day"=>2.7730721097586906,
"homes_electricity_in_a_year"=>0.011565284992610081,
"homes_electricity_in_a_month"=>0.138390042870756,
"homes_electricity_in_a_week"=>0.5996639606372384,
"homes_electricity_in_a_day"=>4.209055658637053,
"homes_with_lowered_thermostat_2_degrees_for_a_winter"=>0.4129672171851042,
"homes_with_raised_thermostat_3_degrees_for_a_summer"=>0.18567396314666526,
"replaced_refrigerators"=>0.07922613596978471,
"loads_of_cold_laundry"=>36.077552495110645,
"lightbulbs_for_a_year"=>0.14523480337658645,
"lightbulbs_for_a_month"=>1.7674430432584045,
"lightbulbs_for_a_week"=>7.574710942302812,
"lightbulbs_for_a_day"=>53.023212622344026,
"lightbulbs_for_an_evening"=>318.1393544094722,
"lightbulbs_to_CFLs_for_a_day"=>902.523055958413,
"lightbulbs_to_CFLs_for_a_week"=>128.93184265822813,
"lightbulbs_to_CFLs_for_a_month"=>30.08413858047089,
"lightbulbs_to_CFLs_for_a_year"=>2.4726894015832803,
"days_with_lightbulbs_to_CFLs"=>20.05609238698059,
"weeks_with_lightbulbs_to_CFLs"=>2.8651223372508934,
"months_with_lightbulbs_to_CFLs"=>0.6685049427361078,
"years_with_lightbulbs_to_CFLs"=>0.05491543486286964,
"recycled_kgs_of_trash"=>54.258888582166705,
"recycled_bags_of_trash"=>30.064627079258866},
"methodology"=>
"http://impact.brighterplanet.com/flights?aircraft[icao_code]=B737&airline[iata_code]=UA&destination_airport[iata_code]=ORD&origin_airport[iata_code]=MSN&segments_per_trip=1&trips=1",
"scope"=>
"The flight greenhouse gas emission is the anthropogenic greenhouse gas emissions attributed to a single passenger on this flight. It includes CO2 emissions from combustion of non-biogenic fuel and extra forcing effects of high-altitude fuel combustion.",
"timeframe"=>{"startDate"=>"2012-01-01", "endDate"=>"2013-01-01"},
"characteristics"=>
{"segments_per_trip"=>{"description"=>"1", "object"=>1},
"trips"=>{"description"=>"1", "object"=>1},
"origin_airport"=>
{"description"=>"MSN",
"object"=>
{"airport"=>
{"city"=>"Madison",
"country_iso_3166_code"=>"US",
"country_name"=>"United States",
"iata_code"=>"MSN",
"latitude"=>43.1399,
"longitude"=>-89.3375,
"name"=>"Dane County Regional Truax Field"}}},
"destination_airport"=>
{"description"=>"ORD",
"object"=>
{"airport"=>
{"city"=>"Chicago",
"country_iso_3166_code"=>"US",
"country_name"=>"United States",
"iata_code"=>"ORD",
"latitude"=>41.9786,
"longitude"=>-87.9048,
"name"=>"Chicago Ohare International"}}},
"airline"=>
{"description"=>"United Airlines",
"object"=>
{"airline"=>
{"bts_code"=>"UA",
"iata_code"=>"UA",
"icao_code"=>"UAL",
"name"=>"United Airlines"}}},
"aircraft"=>
{"description"=>"B737",
"object"=>
{"aircraft"=>
{"aircraft_type"=>"Landplane",
"b"=>950.8,
"b_units"=>"kilograms",
"class_code"=>"Medium 2 engine Jet",
"description"=>"boeing 737-700",
"engine_type"=>"Jet",
"engines"=>2,
"fuel_use_specificity"=>"aircraft",
"icao_code"=>"B737",
"m1"=>5.246,
"m1_units"=>"kilograms_per_nautical_mile",
"m2"=>8.255e-05,
"m2_units"=>"kilograms_per_square_nautical_mile",
"m3"=>4.986e-08,
"m3_units"=>"kilograms_per_cubic_nautical_mile",
"manufacturer_name"=>"BOEING",
"model_name"=>"737-700",
"passengers"=>322259000.0,
"seats"=>143.096,
"seats_specificity"=>"aircraft",
"weight_class"=>"Large"}}}},
"errors"=>[]}
end
def avro_response_schema
timeframe = {
:type => 'record',
:name => 'Timeframe',
:fields => [
{ :name => 'startDate', :type => 'string' },
{ :name => 'endDate', :type => 'string' },
]
}
decision_object = {
:namespace => namespace,
:type => 'record',
:name => 'DecisionObject',
:fields => [
{ :name => 'value', :type => AvroHelper::OPTIONAL_SCALAR },
{ :name => 'units', :type => AvroHelper::OPTIONAL_STRING },
]
}
characteristic_object = {
:namespace => namespace,
:type => 'record',
:name => 'CharacteristicObject',
:fields => [
{ :name => 'value', :type => AvroHelper::OPTIONAL_SCALAR },
{ :name => 'units', :type => AvroHelper::OPTIONAL_STRING },
]
}
# { :type => 'map', :values => AvroHelper::OPTIONAL_SCALAR }
decision = {
:namespace => namespace,
:type => 'record',
:name => 'Decision',
:fields => [
{ :name => 'description', :type => 'string' },
{ :name => 'object', :type => (AvroHelper::SCALAR+[decision_object]) }, # should really be optional map
{ :name => 'methodology', :type => 'string' }
]
}
characteristic = {
:namespace => namespace,
:type => 'record',
:name => 'Characteristic',
:fields => [
{ :name => 'description', :type => 'string' },
{ :name => 'object', :type => (AvroHelper::SCALAR+[characteristic_object]) }, # should really be optional map
]
}
{
:namespace => namespace,
:type => 'record',
:name => 'Response',
:fields => [
{ :name => 'emitter', :type => 'string' },
{ :name => 'characteristics', :type => { :type => 'map', :values => characteristic } },
{ :name => 'decisions', :type => { :type => 'map', :values => decision } },
{ :name => 'errors', :type => { :type => 'array', :items => 'string' } },
{ :name => 'timeframe', :type => timeframe },
{ :name => 'methodology', :type => 'string' },
# { :name => 'audit_id', :type => 'string' }, # paid extra
{ :name => 'scope', :type => 'string' },
{ :name => 'compliance', :type => { :type => 'array', :items => 'string' } },
{ :name => 'equivalents', :type => { :type => 'map', :values => 'float' } },
{ :name => 'certification', :type => AvroHelper::OPTIONAL_STRING },
]
}
end
end
class Carbon
def notes
[
"DEPRECATED. Use impact.brighterplanet.com, which will give you @impact_response.decisions.carbon",
"Characteristics are mixed into the root of the response. For example: @carbon_response.origin_airport",
"Used by Brighter Planet carbon library versions < 1.2"
]
end
def dns_name
'carbon.brighterplanet.com'
end
def namespace
dns_name.split('.').reverse.join('.')
end
def avro_response_schema
quorum = {
:namespace => namespace,
:type => 'record',
:name => 'Quorum',
:fields => [
{ :name => 'name', :type => 'string' },
{ :name => 'requirements', :type => { :type => 'array', :items => 'string' } },
{ :name => 'appreciates', :type => { :type => 'array', :items => 'string' } },
{ :name => 'complies', :type => { :type => 'array', :items => 'string' } }
]
}
committee_stub = {
:namespace => namespace,
:type => 'record',
:name => 'Committee',
:fields => [
{ :name => 'name', :type => 'string' }
]
}
report = {
:namespace => namespace,
:type => 'record',
:name => 'Report',
:fields => [
{ :name => 'committee', :type => committee_stub },
{ :name => 'conclusion', :type => AvroHelper::SCALAR },
{ :name => 'quorum', :type => quorum }
]
}
{
:namespace => namespace,
:type => 'record',
:name => 'Response',
:fields => [
# { :name => '*', :type => OPTIONAL_SCALAR }, # the characteristics mixed in with the root
{ :name => 'emission', :type => 'float' },
{ :name => 'emitter', :type => 'string' },
{ :name => 'timeframe', :type => 'string' },
{ :name => 'emission_units', :type => 'string' },
{ :name => 'methodology', :type => 'string' },
{ :name => 'execution_id', :type => 'string' },
{ :name => 'scope', :type => 'string' },
{ :name => 'complies', :type => { :type => 'array', :items => 'string' } },
{ :name => 'errors', :type => { :type => 'array', :items => 'string' } },
{ :name => 'equivalents', :type => { :type => 'map', :values => 'float' } },
{ :name => 'reports', :type => { :type => 'array', :items => report } },
{ :name => 'certification', :type => AvroHelper::OPTIONAL_STRING },
]
}
end
def example
ActiveSupport::JSON.decode <<-EOS
{
"emission": 619.3139931256935,
"emitter": "Flight",
"timeframe": "2011-01-01/2012-01-01",
"emission_units": "kilograms",
"methodology": "http://carbon.brighterplanet.com/flights.html?destination_airport[iata_code]=SFO&origin_airport[iata_code]=JAC&timeframe=2011-01-01%2F2012-01-01",
"execution_id": "ae70601773dab95c67665d6bfbba71006c03bd9e",
"scope": "The flight emission estimate is the anthropogenic emissions per passenger from aircraft fuel combustion and radiative forcing. It includes CO2 emissions from combustion of non-biogenic fuel and extra forcing effects of high-altitude combustion.",
"complies": [],
"errors": [],
"equivalents": {
"cars_off_the_road_for_a_year": 0.11271514674887623,
"cars_off_the_road_for_a_month": 1.3513431330002632,
"cars_off_the_road_for_a_week": 5.855613805003432,
"cars_off_the_road_for_a_day": 41.101392467779775,
"cars_to_priuses_for_a_year": 0.22543029349775245,
"cars_to_priuses_for_a_month": 2.7026862660005264,
"cars_to_priuses_for_a_week": 11.711227610006864,
"cars_to_priuses_for_a_day": 82.20278493555955,
"one_way_domestic_flight": 2.012770477658504,
"round_trip_domestic_flight": 1.006385238829252,
"one_way_cross_country_flight": 0.707256580149542,
"round_trip_cross_country_flight": 0.353628290074771,
"vegan_meals_instead_of_non_vegan_ones": 498.35391918633496,
"days_of_veganism": 166.11797306211164,
"weeks_of_veganism": 23.730873588590324,
"months_of_veganism": 5.537286412536825,
"years_of_veganism": 0.4551957849473847,
"barrels_of_petroleum": 1.440524348010363,
"canisters_of_bbq_propane": 25.804956151568273,
"railroad_cars_full_of_coal": 0.0030965699656284678,
"homes_energy_in_a_year": 0.06007345733319227,
"homes_energy_in_a_month": 0.7177849180326789,
"homes_energy_in_a_week": 3.1095755594841075,
"homes_energy_in_a_day": 21.82896031570132,
"homes_electricity_in_a_year": 0.09103915698947694,
"homes_electricity_in_a_month": 1.0893733139080948,
"homes_electricity_in_a_week": 4.720411255604036,
"homes_electricity_in_a_day": 33.132679318231474,
"homes_with_lowered_thermostat_2_degrees_for_a_winter": 3.2507791499167653,
"homes_with_raised_thermostat_3_degrees_for_a_summer": 1.4615810237766367,
"replaced_refrigerators": 0.6236491910775734,
"loads_of_cold_laundry": 283.9938633157043,
"lightbulbs_for_a_year": 1.1432536313100303,
"lightbulbs_for_a_month": 13.912888855568704,
"lightbulbs_for_a_week": 59.626312630155525,
"lightbulbs_for_a_day": 417.386046353068,
"lightbulbs_for_an_evening": 2504.3168974324008,
"lightbulbs_to_CFLs_for_a_day": 7104.445608605558,
"lightbulbs_to_CFLs_for_a_week": 1014.9206242825103,
"lightbulbs_to_CFLs_for_a_month": 236.81514263338204,
"lightbulbs_to_CFLs_for_a_year": 19.46441948994742,
"days_with_lightbulbs_to_CFLs": 157.87676175558803,
"weeks_with_lightbulbs_to_CFLs": 22.55355768765838,
"months_with_lightbulbs_to_CFLs": 5.262310999589017,
"years_with_lightbulbs_to_CFLs": 0.4322811672017341,
"recycled_kgs_of_trash": 427.1129919291002,
"recycled_bags_of_trash": 236.6615527630869
},
"origin_airport": {
"airport": {
"city": "Jacksn Hole",
"country_iso_3166_code": "US",
"country_name": "United States",
"iata_code": "JAC",
"latitude": 43.6073,
"longitude": -110.738,
"name": "Jackson Hole"
}
},
"destination_airport": {
"airport": {
"city": "San Francisco",
"country_iso_3166_code": "US",
"country_name": "United States",
"iata_code": "SFO",
"latitude": 37.619,
"longitude": -122.375,
"name": "San Francisco International"
}
},
"date": "2011-01-01",
"segments_per_trip": 1.68,
"country": {
"country": {
"automobile_city_speed": 32.0259,
"automobile_city_speed_units": "kilometres_per_hour",
"automobile_fuel_efficiency": 9.2669,
"automobile_fuel_efficiency_units": "kilometres_per_litre",
"automobile_highway_speed": 91.8935,
"automobile_highway_speed_units": "kilometres_per_hour",
"automobile_trip_distance": 16.3348,
"automobile_trip_distance_units": "kilometres",
"automobile_urbanity": 0.43,
"flight_route_inefficiency_factor": 1.07,
"iso_3166_code": "US",
"name": "UNITED STATES"
}
},
"trips": 1.7,
"freight_share": 0.070644984859677,
"load_factor": 0.76992050796823,
"seats": 171.0530182753,
"passengers": 132,
"fuel": {
"fuel": {
"biogenic_fraction": 0,
"carbon_content": 18.672,
"carbon_content_units": "grams_per_megajoule",
"co2_biogenic_emission_factor": 0,
"co2_biogenic_emission_factor_units": "kilograms_per_litre",
"co2_emission_factor": 2.57607,
"co2_emission_factor_units": "kilograms_per_litre",
"density": 0.808,
"density_units": "kilograms_per_litre",
"energy_content": 37.6267,
"energy_content_units": "megajoules_per_litre",
"name": "Jet Fuel",
"oxidation_factor": 1
}
},
"fuel_use_coefficients": [
1.0886676283223e-7,
-0.00017055946628547,
6.9195725633675,
1572.3367918346
],
"dogleg_factor": 1.1638548181950328,
"route_inefficiency_factor": 1.07,
"distance": 640.3861758339607,
"adjusted_distance": 797.4886937873359,
"adjusted_distance_per_segment": 474.69565106389047,
"seat_class_multiplier": 1,
"fuel_per_segment": 4830.2396558575165,
"fuel_use": 13795.164457129067,
"aviation_multiplier": 2,
"emission_factor": 3.1882054455445545,
"reports": [
{
"committee": {
"name": "emission"
},
"conclusion": "619.3139931256935",
"quorum": {
"name": "from fuel use, emission factor, freight share, passengers, multipliers, and date",
"requirements": [
"fuel_use",
"emission_factor",
"freight_share",
"passengers",
"seat_class_multiplier",
"aviation_multiplier",
"date"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "emission_factor"
},
"conclusion": "3.1882054455445545",
"quorum": {
"name": "from fuel",
"requirements": [
"fuel"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "aviation_multiplier"
},
"conclusion": "2.0",
"quorum": {
"name": "default",
"requirements": [],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "fuel_use"
},
"conclusion": "13795.164457129067",
"quorum": {
"name": "from fuel per segment and segments per trip and trips",
"requirements": [
"fuel_per_segment",
"segments_per_trip",
"trips"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "fuel_per_segment"
},
"conclusion": "4830.2396558575165",
"quorum": {
"name": "from adjusted distance per segment and fuel use coefficients",
"requirements": [
"adjusted_distance_per_segment",
"fuel_use_coefficients"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "seat_class_multiplier"
},
"conclusion": "1.0",
"quorum": {
"name": "from adjusted distance per segment",
"requirements": [
"adjusted_distance_per_segment"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "adjusted_distance_per_segment"
},
"conclusion": "474.69565106389047",
"quorum": {
"name": "from adjusted distance and segments per trip",
"requirements": [
"adjusted_distance",
"segments_per_trip"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "adjusted_distance"
},
"conclusion": "797.4886937873359",
"quorum": {
"name": "from distance, route inefficiency factor, and dogleg factor",
"requirements": [
"distance",
"route_inefficiency_factor",
"dogleg_factor"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "distance"
},
"conclusion": "640.3861758339607",
"quorum": {
"name": "from airports",
"requirements": [
"origin_airport",
"destination_airport"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "route_inefficiency_factor"
},
"conclusion": "1.07",
"quorum": {
"name": "from country",
"requirements": [
"country"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "dogleg_factor"
},
"conclusion": "1.1638548181950328",
"quorum": {
"name": "from segments per trip",
"requirements": [
"segments_per_trip"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "fuel_use_coefficients"
},
"conclusion": "#<struct BrighterPlanet::Flight::CarbonModel::FuelUseEquation m3=1.0886676283223e-07, m2=-0.00017055946628547, m1=6.9195725633675, b=1572.3367918346>",
"quorum": {
"name": "default",
"requirements": [],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "fuel"
},
"conclusion": "Jet Fuel",
"quorum": {
"name": "default",
"requirements": [],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "passengers"
},
"conclusion": "132",
"quorum": {
"name": "from seats and load factor",
"requirements": [
"seats",
"load_factor"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "seats"
},
"conclusion": "171.0530182753",
"quorum": {
"name": "default",
"requirements": [],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "load_factor"
},
"conclusion": "0.76992050796823",
"quorum": {
"name": "default",
"requirements": [],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "freight_share"
},
"conclusion": "0.070644984859677",
"quorum": {
"name": "default",
"requirements": [],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "trips"
},
"conclusion": "1.7",
"quorum": {
"name": "default",
"requirements": [],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "country"
},
"conclusion": "#<Country:0xb035ac4>",
"quorum": {
"name": "from origin airport and destination airport",
"requirements": [
"origin_airport",
"destination_airport"
],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "segments_per_trip"
},
"conclusion": "1.68",
"quorum": {
"name": "default",
"requirements": [],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
},
{
"committee": {
"name": "date"
},
"conclusion": "2011-01-01",
"quorum": {
"name": "from timeframe",
"requirements": [],
"appreciates": [],
"complies": [
"ghg_protocol_scope_3",
"iso",
"tcr"
]
}
}
]
}
EOS
end
end
end
require 'uri'
require 'net/http'
require 'conversions'
require 'cache_method'
module Carbon
class Shell
# @private
class Emitter < Bombshell::Environment
class << self
# @private
def characteristics(emitter)
::MultiJson.load ::Net::HTTP.get(::URI.parse("http://impact.brighterplanet.com/#{emitter.underscore.pluralize}/options.json"))
rescue
# oops
end
cache_method :characteristics, 300
end
include Bombshell::Shell
include Carbon
# @private
def initialize(name, input = {})
@emitter = name.to_s.singularize.camelcase
@input = input
if characteristics = Emitter.characteristics(@emitter)
characteristics.each do |characteristic|
instance_eval <<-meth
def #{characteristic}(arg = nil)
if arg
@input[:#{characteristic}] = arg.to_s.strip
emission
else
@input[:#{characteristic}]
end
end
meth
end
provisions = characteristics.map { |k| "provide :#{k}"}.join('; ')
emit_as_block = "emit_as(:#{name}) { #{provisions} }"
self.class.class_eval emit_as_block
emission
else
puts " => Sorry, characteristics couldn't be retrieved for #{@emitter.underscore.pluralize}. Please try again later."
done
end
end
# @private
def timeframe(t = nil)
if t
@timeframe = t
emission
elsif @timeframe
puts ' => ' + @timeframe
else
puts ' => (defaults to current year)'
end
end
# @private
def emission
puts " => #{emission_in_kilograms} kg CO2e"
end
# @private
def emission_in_kilograms
impact(:timeframe => @timeframe).decisions.carbon.object.value
end
# @private
def lbs
puts " => #{emission_in_kilograms.kilograms.to :pounds} lbs CO2e"
end
alias :pounds :lbs
# @private
def tons
puts " => #{emission_in_kilograms.kilograms.to :tons} lbs CO2e"
end
# @private
def characteristics
if @input.empty?
puts " => (none)"
else
first = true
@input.each_pair do |key, value|
if first
puts " => #{key}: #{value}"
first = false
else
puts " #{key}: #{value}"
end
end
end
end
# @private
def url
puts " => #{impact(:timeframe => @timeframe).methodology}"
end
# @private
def methodology
first = true
impact(:timeframe => @timeframe).decisions.each do |name, report|
if first
w = ' => '
first = false
else
w = ' '
end
puts w + "#{name}: #{report.methodology}"
end
end
# @private
def reports
first = true
impact(:timeframe => @timeframe).decisions.each do |name, report|
if first
w = ' => '
first = false
else
w = ' '
end
puts w + "#{name}: #{report.object.inspect}"
end
end
# @private
def help
puts " => #{Emitter.characteristics(@emitter).join ', '}"
end
prompt_with do |emitter|
if emitter._timeframe
"#{emitter._name}[#{emitter._timeframe}]*"
else
"#{emitter._name}*"
end
end
# @private
def _name
@emitter
end
# @private
def _timeframe
@timeframe
end
# @private
def inspect
"#<Emitter[#{@emitter}]: #{@input.inspect}>"
end
# @private
def done
$emitters[@emitter] ||= []
$emitters[@emitter] << @input
puts " => Saved as #{@emitter} ##{$emitters[@emitter].length - 1}"
quit
end
end
end
end
require 'aruba/cucumber'
require 'fileutils'
$LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
require 'carbon/shell'
Before do
@aruba_io_wait_seconds = 2
@aruba_timeout_seconds = 5
@dirs = [File.join(ENV['HOME'], 'carbon_features')]
end
---
http_interactions:
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:05:37 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"1087.2 kg","object":{"value":1087.1649532388976,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"7939.7
MJ","object":{"value":7939.69681453416,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"211.0123081358227","object":211.0123081358227,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"8477.788829453548","object":8477.788829453548,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"962.1615428278766","object":962.1615428278766,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"1616.4313919508327","object":1616.4313919508327,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"1262.599964160848","object":1262.599964160848,"methodology":"default"},"route_inefficiency_factor":{"description":"1.100000023841858","object":1.100000023841858,"methodology":"default"},"dogleg_factor":{"description":"1.1638548181950328","object":1.1638548181950328,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"BrighterPlanet::Flight::ImpactModel::FuelUseEquation::Given","object":{"m3":1.0532072472371498e-07,"m2":-0.00015627733290887285,"m1":7.148223019744806,"b":1650.9061605236384},"methodology":"default"},"fuel":{"description":"Jet
Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"131","object":131,"methodology":"from
seats and load factor"},"seats":{"description":"169.27798641328772","object":169.27798641328772,"methodology":"default"},"load_factor":{"description":"0.7731146349652108","object":0.7731146349652108,"methodology":"default"},"freight_share":{"description":"0.06885888622195808","object":0.06885888622195808,"methodology":"default"},"trips":{"description":"1.7","object":1.7,"methodology":"default"},"segments_per_trip":{"description":"1.68","object":1.68,"methodology":"default"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.19786402148947937,"cars_off_the_road_for_a_month":2.3721939279672744,"cars_off_the_road_for_a_week":10.279144632873777,"cars_off_the_road_for_a_day":72.15078928665267,"cars_to_priuses_for_a_year":0.39572804297895875,"cars_to_priuses_for_a_month":4.744387855934549,"cars_to_priuses_for_a_week":20.558289265747554,"cars_to_priuses_for_a_day":144.30157857330533,"one_way_domestic_flight":3.533286098026417,"round_trip_domestic_flight":1.7666430490132086,"one_way_cross_country_flight":1.2415423765988212,"round_trip_cross_country_flight":0.6207711882994106,"vegan_meals_instead_of_non_vegan_ones":874.8275047269489,"days_of_veganism":291.6091682423163,"weeks_of_veganism":41.657986678208076,"months_of_veganism":9.720341846908983,"years_of_veganism":0.7990662406305897,"barrels_of_petroleum":2.528745681233676,"canisters_of_bbq_propane":45.29890210660515,"railroad_cars_full_of_coal":0.005435824766194489,"homes_energy_in_a_year":0.10545500046417307,"homes_energy_in_a_month":1.2600241808038823,"homes_energy_in_a_week":5.458655230212505,"homes_energy_in_a_day":38.319303106811425,"homes_electricity_in_a_year":0.15981324812611794,"homes_electricity_in_a_month":1.9123231527472209,"homes_electricity_in_a_week":8.286371273586878,"homes_electricity_in_a_day":58.16223783332778,"homes_with_lowered_thermostat_2_degrees_for_a_winter":5.706528839550974,"homes_with_raised_thermostat_3_degrees_for_a_summer":2.5657092896437987,"replaced_refrigerators":1.09477510791157,"loads_of_cold_laundry":498.5325352871354,"lightbulbs_for_a_year":2.006906503679005,"lightbulbs_for_a_month":24.423160674511834,"lightbulbs_for_a_week":104.67006736793459,"lightbulbs_for_a_day":732.6937330704019,"lightbulbs_for_an_evening":4396.1634855873635,"lightbulbs_to_CFLs_for_a_day":12471.386669121135,"lightbulbs_to_CFLs_for_a_week":1781.626356398747,"lightbulbs_to_CFLs_for_a_month":415.7133963143494,"lightbulbs_to_CFLs_for_a_year":34.16850731534531,"days_with_lightbulbs_to_CFLs":277.14226420956624,"weeks_with_lightbulbs_to_CFLs":39.59128610210093,"months_with_lightbulbs_to_CFLs":9.237640607670912,"years_with_lightbulbs_to_CFLs":0.7588411373607507,"recycled_kgs_of_trash":749.7687458259719,"recycled_bags_of_trash":415.44377940594615},"methodology":"http://impact.brighterplanet.com/flights?timeframe=2012-01-01%2F2013-01-01","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2012-01-01/2013-01-01","characteristics":{},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:05:37 GMT
recorded_with: VCR 2.2.0
---
http_interactions:
- request:
method: post
uri: http://impact.brighterplanet.com/automobiles.json
body:
encoding: US-ASCII
string: key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:05:38 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"5372.7 kg","object":{"value":5372.7062359752135,"units":"kilograms"},"methodology":"from
co2 emission, ch4 emission, n2o emission, and hfc emission"},"co2_emission":{"description":"5120.937371594278","object":5120.937371594278,"methodology":"from
fuel use and automobile fuel"},"co2_biogenic_emission":{"description":"0.0","object":0.0,"methodology":"from
fuel use and automobile fuel"},"ch4_emission":{"description":"5.274612816444227","object":5.274612816444227,"methodology":"from
fuel use and automobile fuel"},"n2o_emission":{"description":"17.935591286653448","object":17.935591286653448,"methodology":"from
fuel use and automobile fuel"},"hfc_emission":{"description":"228.55866027783722","object":228.55866027783722,"methodology":"from
fuel use and automobile fuel"},"energy":{"description":"75646.8 MJ","object":{"value":75646.77442646708,"units":"megajoules"},"methodology":"from
fuel use and automobile fuel"},"fuel_use":{"description":"2,178.696861134417
l","object":{"value":2178.696861134417,"units":"litres"},"methodology":"from
fuel efficiency and distance"},"distance":{"description":"17923.116724381467","object":17923.116724381467,"methodology":"from
annual distance"},"annual_distance":{"description":"17,923.116724381467 km","object":{"value":17923.116724381467,"units":"kilometres"},"methodology":"from
automobile fuel"},"automobile_fuel":{"description":"fallback","object":{"automobile_fuel":{"annual_distance":17923.116724381467,"annual_distance_units":"kilometres","base_fuel_name":null,"blend_fuel_name":null,"blend_portion":null,"ch4_emission_factor":0.002420994361601003,"ch4_emission_factor_units":"kilograms_co2e_per_litre","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.3504588742684827,"co2_emission_factor_units":"kilograms_per_litre","code":null,"distance_key":null,"ef_key":null,"emission_factor":null,"emission_factor_units":null,"energy_content":34.72111048394262,"energy_content_units":null,"hfc_emission_factor":0.1049061318970414,"hfc_emission_factor_units":"kilograms_co2e_per_litre","n2o_emission_factor":0.008232256449534075,"n2o_emission_factor_units":"kilograms_co2e_per_litre","name":"fallback"}},"methodology":"default"},"speed":{"description":"50.94382232429702
km/h","object":{"value":50.94382232429702,"units":"kilometres_per_hour"},"methodology":"from
urbanity and safe country"},"fuel_efficiency":{"description":"8.226530750610781
km/l","object":{"value":8.226530750610781,"units":"kilometres_per_litre"},"methodology":"from
hybridity multiplier and safe country"},"hybridity_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"urbanity":{"description":"0.43","object":0.43,"methodology":"from
safe country"},"safe_country":{"description":null,"object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":8.226530750610781,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":null,"cooling_degree_days_units":null,"electricity_emission_factor":0.626089,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.096,"flight_route_inefficiency_factor":1.100000023841858,"heating_degree_days":null,"heating_degree_days_units":null,"iso_3166_alpha_3_code":null,"iso_3166_code":null,"iso_3166_numeric_code":null,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"fallback","rail_passengers":null,"rail_speed":32.49720001220703,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.06364482122342524,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.008762920291076415,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":37.11446191042177,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.10806735200626398,"rail_trip_electricity_intensity_units":"kilowatt_hour_per_passenger_kilometre"}},"methodology":"default"},"active_subtimeframe":{"description":"2012-01-01/2013-01-01","object":"2012-01-01/2013-01-01","methodology":"from
acquisition and retirement"},"acquisition":{"description":"2012-01-01","object":"2012-01-01","methodology":"default"},"retirement":{"description":"2013-01-01","object":"2013-01-01","methodology":"default"}},"emitter":"Automobile","equivalents":{"cars_off_the_road_for_a_year":0.9778325349474889,"cars_off_the_road_for_a_month":11.723245006897915,"cars_off_the_road_for_a_week":50.79893746114564,"cars_off_the_road_for_a_day":356.565022056731,"cars_to_priuses_for_a_year":1.9556650698949778,"cars_to_priuses_for_a_month":23.44649001379583,"cars_to_priuses_for_a_week":101.59787492229128,"cars_to_priuses_for_a_day":713.130044113462,"one_way_domestic_flight":17.461295266919443,"round_trip_domestic_flight":8.730647633459721,"one_way_cross_country_flight":6.1356305214836935,"round_trip_cross_country_flight":3.0678152607418467,"vegan_meals_instead_of_non_vegan_ones":4323.346862908187,"days_of_veganism":1441.1156209693954,"weeks_of_veganism":205.87135755009822,"months_of_veganism":48.03736645585438,"years_of_veganism":3.9489390834417817,"barrels_of_petroleum":12.496914704878346,"canisters_of_bbq_propane":223.86455073437924,"railroad_cars_full_of_coal":0.02686353117987607,"homes_energy_in_a_year":0.5211525048895957,"homes_energy_in_a_month":6.226966527495273,"homes_energy_in_a_week":26.97635801083155,"homes_energy_in_a_day":189.37177669941835,"homes_electricity_in_a_year":0.7897878166883564,"homes_electricity_in_a_month":9.4505902690804,"homes_electricity_in_a_week":40.95076693060308,"homes_electricity_in_a_day":287.43441091843795,"homes_with_lowered_thermostat_2_degrees_for_a_winter":28.201335032633896,"homes_with_raised_thermostat_3_degrees_for_a_summer":12.679586716901504,"replaced_refrigerators":5.41031517962704,"loads_of_cold_laundry":2463.718916981266,"lightbulbs_for_a_year":9.918015711610245,"lightbulbs_for_a_month":120.69784559118317,"lightbulbs_for_a_week":517.2734109872216,"lightbulbs_for_a_day":3620.9299950292593,"lightbulbs_for_an_evening":21725.58534288179,"lightbulbs_to_CFLs_for_a_day":61632.87064104,"lightbulbs_to_CFLs_for_a_week":8804.694270803931,"lightbulbs_to_CFLs_for_a_month":2054.4315286309097,"lightbulbs_to_CFLs_for_a_year":168.85878429046497,"days_with_lightbulbs_to_CFLs":1369.6210190872732,"weeks_with_lightbulbs_to_CFLs":195.65784299550933,"months_with_lightbulbs_to_CFLs":45.65188488708139,"years_with_lightbulbs_to_CFLs":3.7501489527106995,"recycled_kgs_of_trash":3705.313719171486,"recycled_bags_of_trash":2053.099097484388},"methodology":"http://impact.brighterplanet.com/automobiles?timeframe=2012-01-01%2F2013-01-01","scope":"The
automobile emission estimate is the total anthropogenic emissions from fuel
and air conditioning used by the automobile during the timeframe. It includes
CO2 emissions from combustion of non-biogenic fuel, CH4 and N2O emissions
from combustion of all fuel, and fugitive HFC emissions from air conditioning.","timeframe":"2012-01-01/2013-01-01","characteristics":{},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:05:38 GMT
recorded_with: VCR 2.2.0
---
http_interactions:
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: key=carbon_test1
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:05:41 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"1087.2 kg","object":{"value":1087.1649532388976,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"7939.7
MJ","object":{"value":7939.69681453416,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"211.0123081358227","object":211.0123081358227,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"8477.788829453548","object":8477.788829453548,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"962.1615428278766","object":962.1615428278766,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"1616.4313919508327","object":1616.4313919508327,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"1262.599964160848","object":1262.599964160848,"methodology":"default"},"route_inefficiency_factor":{"description":"1.100000023841858","object":1.100000023841858,"methodology":"default"},"dogleg_factor":{"description":"1.1638548181950328","object":1.1638548181950328,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"BrighterPlanet::Flight::ImpactModel::FuelUseEquation::Given","object":{"m3":1.0532072472371498e-07,"m2":-0.00015627733290887285,"m1":7.148223019744806,"b":1650.9061605236384},"methodology":"default"},"fuel":{"description":"Jet
Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"131","object":131,"methodology":"from
seats and load factor"},"seats":{"description":"169.27798641328772","object":169.27798641328772,"methodology":"default"},"load_factor":{"description":"0.7731146349652108","object":0.7731146349652108,"methodology":"default"},"freight_share":{"description":"0.06885888622195808","object":0.06885888622195808,"methodology":"default"},"trips":{"description":"1.7","object":1.7,"methodology":"default"},"segments_per_trip":{"description":"1.68","object":1.68,"methodology":"default"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.19786402148947937,"cars_off_the_road_for_a_month":2.3721939279672744,"cars_off_the_road_for_a_week":10.279144632873777,"cars_off_the_road_for_a_day":72.15078928665267,"cars_to_priuses_for_a_year":0.39572804297895875,"cars_to_priuses_for_a_month":4.744387855934549,"cars_to_priuses_for_a_week":20.558289265747554,"cars_to_priuses_for_a_day":144.30157857330533,"one_way_domestic_flight":3.533286098026417,"round_trip_domestic_flight":1.7666430490132086,"one_way_cross_country_flight":1.2415423765988212,"round_trip_cross_country_flight":0.6207711882994106,"vegan_meals_instead_of_non_vegan_ones":874.8275047269489,"days_of_veganism":291.6091682423163,"weeks_of_veganism":41.657986678208076,"months_of_veganism":9.720341846908983,"years_of_veganism":0.7990662406305897,"barrels_of_petroleum":2.528745681233676,"canisters_of_bbq_propane":45.29890210660515,"railroad_cars_full_of_coal":0.005435824766194489,"homes_energy_in_a_year":0.10545500046417307,"homes_energy_in_a_month":1.2600241808038823,"homes_energy_in_a_week":5.458655230212505,"homes_energy_in_a_day":38.319303106811425,"homes_electricity_in_a_year":0.15981324812611794,"homes_electricity_in_a_month":1.9123231527472209,"homes_electricity_in_a_week":8.286371273586878,"homes_electricity_in_a_day":58.16223783332778,"homes_with_lowered_thermostat_2_degrees_for_a_winter":5.706528839550974,"homes_with_raised_thermostat_3_degrees_for_a_summer":2.5657092896437987,"replaced_refrigerators":1.09477510791157,"loads_of_cold_laundry":498.5325352871354,"lightbulbs_for_a_year":2.006906503679005,"lightbulbs_for_a_month":24.423160674511834,"lightbulbs_for_a_week":104.67006736793459,"lightbulbs_for_a_day":732.6937330704019,"lightbulbs_for_an_evening":4396.1634855873635,"lightbulbs_to_CFLs_for_a_day":12471.386669121135,"lightbulbs_to_CFLs_for_a_week":1781.626356398747,"lightbulbs_to_CFLs_for_a_month":415.7133963143494,"lightbulbs_to_CFLs_for_a_year":34.16850731534531,"days_with_lightbulbs_to_CFLs":277.14226420956624,"weeks_with_lightbulbs_to_CFLs":39.59128610210093,"months_with_lightbulbs_to_CFLs":9.237640607670912,"years_with_lightbulbs_to_CFLs":0.7588411373607507,"recycled_kgs_of_trash":749.7687458259719,"recycled_bags_of_trash":415.44377940594615},"methodology":"http://impact.brighterplanet.com/flights?timeframe=2012-01-01%2F2013-01-01","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2012-01-01/2013-01-01","characteristics":{},"errors":["API
key \"carbon_test1\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:05:42 GMT
recorded_with: VCR 2.2.0
---
http_interactions:
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: key=carbon_test2
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:05:42 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"1087.2 kg","object":{"value":1087.1649532388976,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"7939.7
MJ","object":{"value":7939.69681453416,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"211.0123081358227","object":211.0123081358227,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"8477.788829453548","object":8477.788829453548,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"962.1615428278766","object":962.1615428278766,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"1616.4313919508327","object":1616.4313919508327,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"1262.599964160848","object":1262.599964160848,"methodology":"default"},"route_inefficiency_factor":{"description":"1.100000023841858","object":1.100000023841858,"methodology":"default"},"dogleg_factor":{"description":"1.1638548181950328","object":1.1638548181950328,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"BrighterPlanet::Flight::ImpactModel::FuelUseEquation::Given","object":{"m3":1.0532072472371498e-07,"m2":-0.00015627733290887285,"m1":7.148223019744806,"b":1650.9061605236384},"methodology":"default"},"fuel":{"description":"Jet
Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"131","object":131,"methodology":"from
seats and load factor"},"seats":{"description":"169.27798641328772","object":169.27798641328772,"methodology":"default"},"load_factor":{"description":"0.7731146349652108","object":0.7731146349652108,"methodology":"default"},"freight_share":{"description":"0.06885888622195808","object":0.06885888622195808,"methodology":"default"},"trips":{"description":"1.7","object":1.7,"methodology":"default"},"segments_per_trip":{"description":"1.68","object":1.68,"methodology":"default"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.19786402148947937,"cars_off_the_road_for_a_month":2.3721939279672744,"cars_off_the_road_for_a_week":10.279144632873777,"cars_off_the_road_for_a_day":72.15078928665267,"cars_to_priuses_for_a_year":0.39572804297895875,"cars_to_priuses_for_a_month":4.744387855934549,"cars_to_priuses_for_a_week":20.558289265747554,"cars_to_priuses_for_a_day":144.30157857330533,"one_way_domestic_flight":3.533286098026417,"round_trip_domestic_flight":1.7666430490132086,"one_way_cross_country_flight":1.2415423765988212,"round_trip_cross_country_flight":0.6207711882994106,"vegan_meals_instead_of_non_vegan_ones":874.8275047269489,"days_of_veganism":291.6091682423163,"weeks_of_veganism":41.657986678208076,"months_of_veganism":9.720341846908983,"years_of_veganism":0.7990662406305897,"barrels_of_petroleum":2.528745681233676,"canisters_of_bbq_propane":45.29890210660515,"railroad_cars_full_of_coal":0.005435824766194489,"homes_energy_in_a_year":0.10545500046417307,"homes_energy_in_a_month":1.2600241808038823,"homes_energy_in_a_week":5.458655230212505,"homes_energy_in_a_day":38.319303106811425,"homes_electricity_in_a_year":0.15981324812611794,"homes_electricity_in_a_month":1.9123231527472209,"homes_electricity_in_a_week":8.286371273586878,"homes_electricity_in_a_day":58.16223783332778,"homes_with_lowered_thermostat_2_degrees_for_a_winter":5.706528839550974,"homes_with_raised_thermostat_3_degrees_for_a_summer":2.5657092896437987,"replaced_refrigerators":1.09477510791157,"loads_of_cold_laundry":498.5325352871354,"lightbulbs_for_a_year":2.006906503679005,"lightbulbs_for_a_month":24.423160674511834,"lightbulbs_for_a_week":104.67006736793459,"lightbulbs_for_a_day":732.6937330704019,"lightbulbs_for_an_evening":4396.1634855873635,"lightbulbs_to_CFLs_for_a_day":12471.386669121135,"lightbulbs_to_CFLs_for_a_week":1781.626356398747,"lightbulbs_to_CFLs_for_a_month":415.7133963143494,"lightbulbs_to_CFLs_for_a_year":34.16850731534531,"days_with_lightbulbs_to_CFLs":277.14226420956624,"weeks_with_lightbulbs_to_CFLs":39.59128610210093,"months_with_lightbulbs_to_CFLs":9.237640607670912,"years_with_lightbulbs_to_CFLs":0.7588411373607507,"recycled_kgs_of_trash":749.7687458259719,"recycled_bags_of_trash":415.44377940594615},"methodology":"http://impact.brighterplanet.com/flights?timeframe=2012-01-01%2F2013-01-01","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2012-01-01/2013-01-01","characteristics":{},"errors":["API
key \"carbon_test2\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:05:43 GMT
recorded_with: VCR 2.2.0
source :rubygems
gemspec
require 'bundler/setup'
if ::Bundler.definition.specs['debugger'].first
require 'debugger'
end
require 'carbon'
$:.unshift File.expand_path('../support', __FILE__)
module Utilities
def flush_cache!
CacheMethod.config.storage.flush
end
end
require 'vcr'
VCR.configure do |c|
c.cassette_library_dir = 'spec/cassettes'
c.hook_into :fakeweb
end
RSpec.configure do |c|
c.include Utilities
end
---
http_interactions:
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: origin_airport=LAX&destination_airport=SFO&segments_per_trip=1&trips=1&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:05:39 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"158.9 kg","object":{"value":158.88245012544277,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"1160.3
MJ","object":{"value":1160.3377016414531,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"30.838146891474757","object":30.838146891474757,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"2809.4943974548605","object":2809.4943974548605,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"314.11399481652126","object":314.11399481652126,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"314.11399481652126","object":314.11399481652126,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"293.56448113693574","object":293.56448113693574,"methodology":"from
airports"},"route_inefficiency_factor":{"description":"1.07","object":1.07,"methodology":"from
country"},"dogleg_factor":{"description":"1.0","object":1.0,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"Fuel use equation","object":{"m3":1.0348093300372378e-07,"m2":-0.00023017671642226525,"m1":5.385202868809918,"b":1137.430624447256},"methodology":"from
cohort"},"fuel":{"description":"Jet Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"110","object":110,"methodology":"from
seats and load factor"},"seats":{"description":"141.62026378724536","object":141.62026378724536,"methodology":"from
cohort"},"load_factor":{"description":"0.7786548902022515","object":0.7786548902022515,"methodology":"from
cohort"},"freight_share":{"description":"0.01524089564944548","object":0.01524089564944548,"methodology":"from
cohort"},"country":{"description":"US","object":{"country":{"automobile_city_speed":32.0259,"automobile_city_speed_units":"kilometres_per_hour","automobile_fuel_efficiency":9.2669,"automobile_fuel_efficiency_units":"kilometres_per_litre","automobile_highway_speed":91.8935,"automobile_highway_speed_units":"kilometres_per_hour","automobile_trip_distance":16.3348,"automobile_trip_distance_units":"kilometres","automobile_urbanity":0.43,"cooling_degree_days":882.0,"cooling_degree_days_units":"degrees_celsius","electricity_emission_factor":0.589455,"electricity_emission_factor_units":"kilograms_co2e_per_kilowatt_hour","electricity_loss_factor":0.0615633,"flight_route_inefficiency_factor":1.07,"heating_degree_days":2159.0,"heating_degree_days_units":"degrees_celsius","iso_3166_alpha_3_code":"USA","iso_3166_code":"US","iso_3166_numeric_code":840,"lodging_district_heat_intensity":1.7463,"lodging_district_heat_intensity_units":"megajoules_per_occupied_room_night","lodging_electricity_intensity":32.906,"lodging_electricity_intensity_units":"kilowatt_hours_per_occupied_room_night","lodging_fuel_oil_intensity":0.412389,"lodging_fuel_oil_intensity_units":"gallons_per_occupied_room_night","lodging_natural_gas_intensity":1.93316,"lodging_natural_gas_intensity_units":"cubic_metres_per_occupied_room_night","lodging_occupancy_rate":0.601,"name":"United
States","rail_passengers":4467000000.0,"rail_speed":32.4972,"rail_speed_units":"kilometres_per_hour","rail_trip_co2_emission_factor":0.0957617,"rail_trip_co2_emission_factor_units":"kilograms_per_passenger_kilometre","rail_trip_diesel_intensity":0.0194247,"rail_trip_diesel_intensity_units":"litres_per_passenger_kilometre","rail_trip_distance":12.9952,"rail_trip_distance_units":"kilometres","rail_trip_electricity_intensity":0.140512,"rail_trip_electricity_intensity_units":"kilowatt_hours_per_passenger_kilometre"}},"methodology":"from
origin airport and destination airport"},"cohort":{"description":"BrighterPlanet::Flight::ImpactModel::FlightSegmentCohort","object":{"members":157,"sql":"SELECT
* FROM `flight_segments` WHERE (`flight_segments`.`source` = ''BTS T100''
AND `flight_segments`.`year` IN (2011, 2012) AND `flight_segments`.`passengers`
> 0) AND `flight_segments`.`origin_airport_iata_code` = ''LAX'' AND `flight_segments`.`destination_airport_iata_code`
= ''SFO''"},"methodology":"from segments per trip and input"},"date":{"description":"2012-01-01","object":"2012-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.028916605922830584,"cars_off_the_road_for_a_month":0.3466815061737161,"cars_off_the_road_for_a_week":1.5022335659360615,"cars_off_the_road_for_a_day":10.544392685025134,"cars_to_priuses_for_a_year":0.05783321184566117,"cars_to_priuses_for_a_month":0.6933630123474323,"cars_to_priuses_for_a_week":3.004467131872123,"cars_to_priuses_for_a_day":21.088785370050267,"one_way_domestic_flight":0.5163679629076889,"round_trip_domestic_flight":0.25818398145384447,"one_way_cross_country_flight":0.18144375804325566,"round_trip_cross_country_flight":0.09072187902162783,"vegan_meals_instead_of_non_vegan_ones":127.85064214409218,"days_of_veganism":42.61688071469739,"weeks_of_veganism":6.088057723906716,"months_of_veganism":1.4205679865715837,"years_of_veganism":0.11677860084220043,"barrels_of_petroleum":0.36956057899177985,"canisters_of_bbq_propane":6.620155049376825,"railroad_cars_full_of_coal":0.000794412250627214,"homes_energy_in_a_year":0.01541159766216795,"homes_energy_in_a_month":0.18414475969538818,"homes_energy_in_a_week":0.7977487820798482,"homes_energy_in_a_day":5.600129719571481,"homes_electricity_in_a_year":0.023355720168440088,"homes_electricity_in_a_month":0.27947422977065384,"homes_electricity_in_a_week":1.2110020348561248,"homes_electricity_in_a_day":8.500052199261063,"homes_with_lowered_thermostat_2_degrees_for_a_winter":0.8339739807084492,"homes_with_raised_thermostat_3_degrees_for_a_summer":0.37496258229604496,"replaced_refrigerators":0.15999462727632088,"loads_of_cold_laundry":72.85745409442329,"lightbulbs_for_a_year":0.29329700293156735,"lightbulbs_for_a_month":3.5692942420680716,"lightbulbs_for_a_week":15.29688453317738,"lightbulbs_for_a_day":107.07866837959203,"lightbulbs_for_an_evening":642.4721691600023,"lightbulbs_to_CFLs_for_a_day":1822.6162134352137,"lightbulbs_to_CFLs_for_a_week":260.37369938147333,"lightbulbs_to_CFLs_for_a_month":60.75394792631718,"lightbulbs_to_CFLs_for_a_year":4.993516524992541,"days_with_lightbulbs_to_CFLs":40.50263195087812,"weeks_with_lightbulbs_to_CFLs":5.786022186218249,"months_with_lightbulbs_to_CFLs":1.350024178715887,"years_with_lightbulbs_to_CFLs":0.11089995018755906,"recycled_kgs_of_trash":109.57407614126224,"recycled_bags_of_trash":60.71454507868607},"methodology":"http://impact.brighterplanet.com/flights?destination_airport=SFO&origin_airport=LAX&segments_per_trip=1&timeframe=2012-01-01%2F2013-01-01&trips=1","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2012-01-01/2013-01-01","characteristics":{"segments_per_trip":{"description":"1","object":1},"trips":{"description":"1","object":1},"origin_airport":{"description":"LAX","object":{"airport":{"city":"Los
Angeles","country_iso_3166_code":"US","country_name":"United States","iata_code":"LAX","latitude":33.9425,"longitude":-118.408,"name":"Los
Angeles International"}}},"destination_airport":{"description":"SFO","object":{"airport":{"city":"San
Francisco","country_iso_3166_code":"US","country_name":"United States","iata_code":"SFO","latitude":37.619,"longitude":-122.375,"name":"San
Francisco International"}}}},"errors":["API key \"carbon_test\" could not
be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:05:39 GMT
recorded_with: VCR 2.2.0
---
http_interactions:
- request:
method: post
uri: http://impact.brighterplanet.com/monkeys.json
body:
encoding: US-ASCII
string: key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 404
message: Not Found
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:05:40 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 404 Not Found
etag:
- b0dcd496ec3896280a7c636e2d5b9870
body:
encoding: US-ASCII
string: ! '{name: "HTTPError", message: "404 Not found"}
'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:05:40 GMT
recorded_with: VCR 2.2.0

Had this for a while

def self.impacts(enumerable)
  queries = enumerable.map do |instance|
    [ Registry.instance[instance.class.name].emitter, instance.impact_params ]
  end
  multi queries
end

Tested like this

describe :impacts do
  it "works" do
    impacts = Carbon.impacts(MyNissanAltima.all(:order => :year))
    impacts.length.must_equal 5
    impacts.map do |impact|
      impact.decisions.carbon.object.value.round
    end.uniq.length.must_be :>, 3
    impacts.each_with_index do |impact, idx|
      impact.decisions.carbon.object.value.must_be :>, 0
      impact.characteristics.make.description.must_match %r{Nissan}i
      impact.characteristics.year.description.to_i.must_equal(2000+idx)
    end
  end
end
class MyNissan
def name
'Nissan'
end
def to_s
raise "Not fair!"
end
alias :inspect :to_s
end
class MyNissanAltima
class << self
def all(options)
raise unless options == { :order => :year }
[ new(2000), new(2001), new(2002), new(2003), new(2004) ]
end
end
def initialize(model_year)
@model_year = model_year
end
def make; MyNissan.new end
def model; 'Altima' end
def model_year; @model_year end # what BP knows as "year"
def fuel_type; 'R' end # what BP knows as "automobile_fuel" and keys on "code"
def nil_make; nil end
def nil_model; nil end
include Carbon
emit_as 'Automobile' do
provide(:make) { |my_nissan_altima| my_nissan_altima.make.try(:name) }
provide :model
provide :model_year, :as => :year
provide :fuel_type, :as => :automobile_fuel, :key => :code
provide(:nil_make) { |my_nissan_altima| my_nissan_altima.nil_make.try(:blam!) }
provide :nil_model
end
end
require 'uri'
require 'net/http'
require 'multi_json'
require 'hashie/mash'
require 'cache_method'
module Carbon
# @private
class Query
def Query.pool
@pool || Thread.exclusive do
@pool ||= QueryPool.pool(:size => CONCURRENCY)
end
end
def Query.perform(*args)
case method_signature(*args)
when :plain_query, :obj
new(*args).result
when :array
queries = args.first.map do |plain_query_or_obj|
query = new(*plain_query_or_obj)
pool.perform! query
query
end
ticks = 0
begin
sleep(0.1*(2**ticks)) # exponential wait
ticks += 1
end until queries.all? { |query| query.done? }
queries.inject({}) do |memo, query|
memo[query.object] = query.result
memo
end
else
raise ::ArgumentError, "You must pass one plain query, or one object that responds to #as_impact_query, or an array of such objects. Please check the docs!"
end
end
# Determine if a variable is a +[emitter, param]+ style "query"
# @private
def Query.is_plain_query?(query)
return false unless query.is_a?(Array)
return false unless query.first.is_a?(String) or query.first.is_a?(Symbol)
return true if query.length == 1
return true if query.length == 2 and query.last.is_a?(Hash)
false
end
# Determine what method signature/overloading/calling style is being used
# @private
def Query.method_signature(*args)
first_arg = args.first
case args.length
when 1
if is_plain_query?(args)
# query('Flight')
:plain_query
elsif first_arg.respond_to?(:as_impact_query)
# query(my_flight)
:obj
elsif first_arg.is_a?(::Array) and first_arg.all? { |obj| obj.respond_to?(:as_impact_query) or is_plain_query?(obj) }
# query([my_flight, my_flight])
:array
end
when 2
if is_plain_query?(args)
# query('Flight', :origin_airport => 'LAX')
:plain_query
end
end
end
attr_reader :emitter
attr_reader :params
attr_reader :domain
attr_reader :uri
attr_reader :object
def initialize(*args)
case Query.method_signature(*args)
when :plain_query
@object = args
@emitter, @params = *args
when :obj
@object = args.first
@emitter, @params = *object.as_impact_query
else
raise ArgumentError, "Carbon::Query.new must be called with a plain query or an object that responds to #as_impact_query"
end
@params ||= {}
@domain = params.delete(:domain) || Carbon.domain
if Carbon.key and not params.has_key?(:key)
params[:key] = Carbon.key
end
@uri = URI.parse("#{domain}/#{emitter.underscore.pluralize}.json")
end
def done?
not @result.nil? or cache_method_cached?(:result)
end
def result(extra_params = {})
@result ||= get_result(extra_params)
end
cache_method :result, 3_600 # one hour
def as_cache_key
[ @domain, @emitter, @params ]
end
def hash
as_cache_key.hash
end
def eql?(other)
as_cache_key == other.as_cache_key
end
alias :== :eql?
private
def get_result(extra_params = {})
raw = Net::HTTP.post_form uri, params.merge(extra_params)
code = raw.code.to_i
body = raw.body
memo = Hashie::Mash.new
memo.code = code
case code
when (200..299)
memo.success = true
memo.merge! MultiJson.load(body)
else
memo.success = false
memo.errors = [body]
end
memo
end
end
end
require 'celluloid'
module Carbon
class QueryPool
include Celluloid
def perform(query)
query.result
end
end
end
require 'helper'
require 'carbon/query'
require 'my_nissan_altima'
describe Carbon::Query do
let(:query) { Carbon::Query.new 'Flight' }
describe '#as_impact_query' do
it 'sets up an query to be run by Carbon.query' do
a = MyNissanAltima.new(2006)
a.as_impact_query.should == ["Automobile", {:make=>"Nissan", :model=>"Altima", :year=>2006, "automobile_fuel[code]"=>"R", :key=>Carbon.key}]
end
it 'only includes non-nil params' do
a = MyNissanAltima.new(2006)
a.as_impact_query[1].keys.should include(:year)
a.as_impact_query[1].keys.should_not include(:nil_model)
a.as_impact_query[1].keys.should_not include(:nil_make)
end
it 'includes Carbon.key' do
begin
random_key = rand(1e11)
old_carbon_key = Carbon.key
Carbon.key = random_key
a = MyNissanAltima.new(2006)
a.as_impact_query[1][:key].should == random_key
ensure
Carbon.key = old_carbon_key
end
end
it "allows key to be set" do
begin
random_key = rand(1e11)
old_carbon_key = Carbon.key
Carbon.key = random_key
a = MyNissanAltima.new(2006)
a.as_impact_query(:key => 'i want to use this key!')[1][:key].should == 'i want to use this key!'
ensure
Carbon.key = old_carbon_key
end
end
end
describe '.method_signature' do
it 'recognizes emitter_param' do
Carbon::Query.method_signature('Flight').should == :plain_query
Carbon::Query.method_signature('Flight', :origin_airport => 'LAX').should == :plain_query
Carbon::Query.method_signature(:flight).should == :plain_query
Carbon::Query.method_signature(:flight, :origin_airport => 'LAX').should == :plain_query
end
it 'recognizes an object' do
Carbon::Query.method_signature(MyNissanAltima.new(2006)).should == :obj
end
it 'recognizes an array of signatures' do
Carbon::Query.method_signature([MyNissanAltima.new(2001)]).should == :array
Carbon::Query.method_signature([['Flight']]).should == :array
Carbon::Query.method_signature([['Flight', {:origin_airport => 'LAX'}]]).should == :array
Carbon::Query.method_signature([['Flight'], ['Flight']]).should == :array
Carbon::Query.method_signature([['Flight', {:origin_airport => 'LAX'}], ['Flight', {:origin_airport => 'LAX'}]]).should == :array
[MyNissanAltima.new(2006), ['Flight'], ['Flight', {:origin_airport => 'LAX'}]].permutation.each do |p|
Carbon::Query.method_signature(p).should == :array
end
end
it "does not accept splats for concurrent queries" do
Carbon::Query.method_signature(['Flight'], ['Flight']).should be_nil
Carbon::Query.method_signature(MyNissanAltima.new(2001), MyNissanAltima.new(2001)).should be_nil
[MyNissanAltima.new(2006), ['Flight'], ['Flight', {:origin_airport => 'LAX'}]].permutation.each do |p|
Carbon::Query.method_signature(*p).should be_nil
end
end
it "does not like weirdness" do
Carbon::Query.method_signature('Flight', 'Flight').should be_nil
Carbon::Query.method_signature('Flight', ['Flight']).should be_nil
Carbon::Query.method_signature(['Flight'], 'Flight').should be_nil
Carbon::Query.method_signature(['Flight', 'Flight']).should be_nil
Carbon::Query.method_signature(['Flight', ['Flight']]).should be_nil
Carbon::Query.method_signature([['Flight'], 'Flight']).should be_nil
Carbon::Query.method_signature(MyNissanAltima.new(2001), [MyNissanAltima.new(2001)]).should be_nil
Carbon::Query.method_signature([MyNissanAltima.new(2001)], MyNissanAltima.new(2001)).should be_nil
Carbon::Query.method_signature([MyNissanAltima.new(2001)], [MyNissanAltima.new(2001)]).should be_nil
Carbon::Query.method_signature([MyNissanAltima.new(2001), [MyNissanAltima.new(2001)]]).should be_nil
Carbon::Query.method_signature([[MyNissanAltima.new(2001)], MyNissanAltima.new(2001)]).should be_nil
Carbon::Query.method_signature([[MyNissanAltima.new(2001)], [MyNissanAltima.new(2001)]]).should be_nil
end
end
describe '.perform' do
it 'returns a single result for a single query' do
VCR.use_cassette 'Flight', :record => :once do
Carbon::Query.perform('Flight').should be_a(Hashie::Mash)
end
end
it 'returns a hash of queries and results for multiple queries' do
results = nil
VCR.use_cassette 'Flight and Automobile', :record => :once do
results = Carbon::Query.perform([['Flight'], ['Automobile']])
end
results.length.should == 2
results.keys.should == [['Flight'], ['Automobile']]
results.values.each do |val|
val.should be_a(Hashie::Mash)
end
end
end
end
#!/usr/bin/env rake
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
task :test => :spec
require 'cucumber/rake/task'
Cucumber::Rake::Task.new
require 'yard'
YARD::Rake::YardocTask.new do |y|
y.options << '--no-private' << '--title' << "Brighter Planet CM1 client for Ruby"
end
task :default => [:spec, :cucumber]
namespace :avro do
task :setup do
require 'rubygems'
require 'bundler/setup'
require File.expand_path("../developer/avro_helper", __FILE__)
require File.expand_path("../developer/cm1_avro", __FILE__)
@cm1 = Cm1Avro::Impact.new
end
task :api_paths => 'avro:setup' do
ary = []
AvroHelper.api_paths(@cm1.avro_response_schema) { |path| ary << path }
$stdout.write ary.sort.join("\n")
end
task :json => 'avro:setup' do
$stdout.write MultiJson.dump(@cm1.avro_response_schema)
end
task :example => 'avro:setup' do
require 'tempfile'
file = Tempfile.new('com.brighterplanet.Cm1.example.avr')
parsed_schema = Avro::Schema.parse(MultiJson.dump(@cm1.avro_response_schema))
writer = Avro::IO::DatumWriter.new(parsed_schema)
dw = Avro::DataFile::Writer.new(file, writer, parsed_schema)
dw << AvroHelper.recursively_stringify_keys(@cm1.example)
dw.close
file.close
$stdout.write File.read(file.path)
end
end
require 'singleton'
module Carbon
# Used internally to hold the information about how each class that has called `emit_as`.
class Registry < ::Hash
include ::Singleton
# Used internally to record the emitter and parameters (characteristics) provided by a class that has called `emit_as`.
# Can't use my magic sprinkles (::Struct) because of yardoc
# @private
class Registration < Struct.new(:emitter, :characteristics)
end
# Used internally when instance-eval'ing the +emit_as+ DSL.
class Registrar
# @private
def initialize(klass, emitter)
@klass = klass
Registry.instance[klass.name] = Registration.new
Registry.instance[klass.name].emitter = emitter
Registry.instance[klass.name].characteristics = {}
end
# Indicate that you will send in a piece of data about the emitter.
#
# Called inside of {Carbon::ClassMethods#emit_as} blocks.
#
# @param [Symbol] method_id What method to call to get the value in question.
#
# @option translation_options [Symbol] :as (name of the method) If your method name does not match the Brighter Planet characteristic name.
# @option translation_options [Symbol] :key (a number of columns) What you are keying on. By default, we do a fuzzy match against a number of fields, including full names and various codes.
#
# @return [nil]
#
# @note It's suggested that you use {http://api.rubyonrails.org/classes/Object.html#method-i-try Object#try} to cheaply avoid +undefined method `iata_code` for nil:NilClass+. It will be available because this class includes +active_support/core_ext+ anyway.
#
# @yield [] Pass a block for the common use case of calling a method on a object.
#
# Things to note in the MyFlight example:
#
# * Sending +:origin+ to Brighter Planet *as* +:origin_airport+. Otherwise Brighter Planet won't recognize +:origin+.
# * Saying we're *keying* on one code or another. Otherwise Brighter Planet will first try against full names and possibly other columns.
# * Giving *blocks* to pull codes from +MyAircraft+ and +MyAirline+ objects. Otherwise you might get a querystring like +airline[iata_code]=#<MyAirline [...]>+
#
# @example The canonical MyFlight example
# emit_as 'Flight' do
# provide :segments_per_trip
# provide :trips
# provide :origin, :as => :origin_airport, :key => :iata_code
# provide :destination, :as => :destination_airport, :key => :iata_code
# provide(:airline, :key => :iata_code) { |f| f.airline.try(:iata_code) }
# provide(:aircraft, :key => :icao_code) { { |f| f.aircraft.try(:icao_code) }
# end
#
# @example Your method is named one thing but should be sent +:as+ something else.
# provide :my_distance, :as => :distance
#
# @example You are keying on something well-known like {http://en.wikipedia.org/wiki/Airline_codes IATA airline codes}.
# provide(:airline, :key => :iata_code) { |f| f.airline.try(:iata_code) }
#
# @example Better to use a block
# provide(:airline, :key => :iata_code) { |f| f.airline.try(:iata_code) }
# # is equivalent to
# def airline_iata_code
# airline.iata_code
# end
# provide :airline_iata_code, :as => :airline, :key => :iata_code
def provide(method_id, translation_options = {}, &blk)
translation_options = translation_options.dup
if block_given?
translation_options[:blk] = blk
end
Registry.instance[@klass.name].characteristics[method_id] = translation_options
end
end
end
end
Feature: Shell
In order to explore the CM1 API
As a potential client
I want to make simple calculations from an interactive console
Scenario: Running the shell
When I run `carbon` interactively
And I type "exit"
Then the output should contain:
"""
carbon->
"""
Scenario: Setting a key
When I run `carbon` interactively
And I type "key 'abc'"
And I type "exit"
Then the output should contain:
"""
Using key abc
"""
Scenario: Seeing a list of emitters
When I run `carbon` interactively
And I type "help"
And I type "exit"
Then the output should contain:
"""
Computation
"""
Scenario: Getting a calculation
When I run `carbon` interactively
And I type "computation"
And I type "done"
And I type "exit"
Then the output should contain:
"""
kg CO2e
"""
Scenario: Seeing a list of characteristics
When I run `carbon` interactively
And I type "computation"
And I type "help"
And I type "done"
And I type "exit"
Then the output should contain:
"""
duration
"""
Scenario: Setting a characteristic
When I run `carbon` interactively
And I type "computation"
And I type "duration 10"
And I type "done"
And I type "exit"
Then the output should contain:
"""
kg CO2e
"""
Scenario: Retrieving the default timeframe
When I run `carbon` interactively
And I type "computation"
And I type "timeframe"
And I type "done"
And I type "exit"
Then the output should contain:
"""
(defaults to current year)
"""
Scenario: Setting the timeframe
When I run `carbon` interactively
And I type "computation"
And I type "timeframe '2009'"
And I type "timeframe"
And I type "done"
And I type "exit"
Then the output should contain:
"""
=> 2009
"""
Scenario: Getting the current emission
When I run `carbon` interactively
And I type "computation"
And I type "emission"
And I type "done"
And I type "exit"
Then the output should contain:
"""
kg CO2e
"""
Scenario: Using a different unit
When I run `carbon` interactively
And I type "computation"
And I type "lbs"
And I type "done"
And I type "exit"
Then the output should contain:
"""
lbs CO2e
"""
Scenario: Retrieving default characteristics
When I run `carbon` interactively
And I type "computation"
And I type "characteristics"
And I type "done"
And I type "exit"
Then the output should contain:
"""
(none)
"""
Scenario: Retrieving set characteristics
When I run `carbon` interactively
And I type "computation"
And I type "duration 10; characteristics; done"
And I type "exit"
Then the output should contain:
"""
duration: 10
"""
Scenario: Retrieving default methodology
When I run `carbon` interactively
And I type "computation"
And I type "methodology"
And I type "done"
And I type "exit"
Then the output should contain:
"""
duration: default
"""
Scenario: Retrieving customized methodology
When I run `carbon` interactively
And I type "computation"
And I type "duration 10; methodology; done"
And I type "exit"
Then the output should not contain:
"""
duration:
"""
Scenario: Retrieving reports
When I run `carbon` interactively
And I type "computation"
And I type "reports"
And I type "done"
And I type "exit"
Then the output should contain:
"""
power_usage_effectiveness: 1.5
"""
Scenario: Retrieving methodology URL
When I run `carbon` interactively
And I type "computation"
And I type "duration 10"
And I type "url"
And I type "done"
And I type "exit"
Then the output should contain:
"""
http://impact.brighterplanet.com/computations?duration=10
"""
Scenario: Retrieving stored emitter
When I run `carbon` interactively
And I type "computation"
And I type "duration 10; done"
And I type "computation 0; characteristics; done"
And I type "exit"
Then the output should not contain:
"""
duration: 10
"""
require 'carbon'
require 'bombshell'
require 'conversions'
require 'brighter_planet_metadata'
module Carbon
# @private
class Shell < Bombshell::Environment
class << self
# @private
def emitters
::BrighterPlanet.metadata.emitters
end
end
include Bombshell::Shell
before_launch do
$emitters = {}
emitters.map(&:underscore).each do |e|
define_method e.to_sym do |*args|
if args.any? and num = args.first and saved = $emitters[e.to_sym][num]
emitter e.to_sym, saved
else
emitter e.to_sym
end
end
end
end
prompt_with 'carbon-'
# @private
def help
puts " => #{self.class.emitters.join ', '}"
end
# @private
def key(k)
::Carbon.key = k
puts " => Using key #{::Carbon.key}"
end
# @private
def emitter(e, saved = {})
Emitter.launch e, saved
end
end
end
if File.exist?(dotfile = File.join(ENV['HOME'], '.brighter_planet'))
if (key = File.read(dotfile).strip).present?
::Carbon.key = key
end
end
require 'carbon/shell/emitter'
---
http_interactions:
- request:
method: post
uri: http://impact.brighterplanet.com/flights.json
body:
encoding: US-ASCII
string: timeframe=2009-01-01%2F2010-01-01&key=carbon_test
headers:
accept:
- ! '*/*'
user-agent:
- Ruby
content-type:
- application/x-www-form-urlencoded
response:
status:
code: 200
message: OK
headers:
server:
- nginx
date:
- Fri, 08 Jun 2012 21:05:40 GMT
content-type:
- application/json
transfer-encoding:
- chunked
connection:
- keep-alive
status:
- 200 OK
body:
encoding: US-ASCII
string: ! '{"compliance":[],"decisions":{"carbon":{"description":"1087.2 kg","object":{"value":1087.1649532388976,"units":"kilograms"},"methodology":"from
fuel use and greenhouse gas emission factor"},"ghg_emission_factor":{"description":"5.15214","object":5.15214,"methodology":"from
fuel and aviation multiplier"},"aviation_multiplier":{"description":"2.0","object":2.0,"methodology":"default"},"energy":{"description":"7939.7
MJ","object":{"value":7939.69681453416,"units":"megajoules"},"methodology":"from
fuel use and fuel"},"fuel_use":{"description":"211.0123081358227","object":211.0123081358227,"methodology":"from
fuel per segment, segments per trip, trips, freight_share, passengers, seat
class multiplier, fuel, date, and timeframe"},"fuel_per_segment":{"description":"8477.788829453548","object":8477.788829453548,"methodology":"from
adjusted distance per segment and fuel use coefficients"},"seat_class_multiplier":{"description":"1.0","object":1.0,"methodology":"default"},"distance_class":{"description":"short
haul","object":{"flight_distance_class":{"distance":1108.0,"distance_units":"kilometres","max_distance":3700.0,"max_distance_units":"kilometres","min_distance":0.0,"min_distance_units":"kilometres","name":"short
haul"}},"methodology":"from adjusted distance per segment"},"adjusted_distance_per_segment":{"description":"962.1615428278766","object":962.1615428278766,"methodology":"from
adjusted distance and segments per trip"},"adjusted_distance":{"description":"1616.4313919508327","object":1616.4313919508327,"methodology":"from
distance, route inefficiency factor, and dogleg factor"},"distance":{"description":"1262.599964160848","object":1262.599964160848,"methodology":"default"},"route_inefficiency_factor":{"description":"1.100000023841858","object":1.100000023841858,"methodology":"default"},"dogleg_factor":{"description":"1.1638548181950328","object":1.1638548181950328,"methodology":"from
segments per trip"},"fuel_use_coefficients":{"description":"BrighterPlanet::Flight::ImpactModel::FuelUseEquation::Given","object":{"m3":1.0532072472371498e-07,"m2":-0.00015627733290887285,"m1":7.148223019744806,"b":1650.9061605236384},"methodology":"default"},"fuel":{"description":"Jet
Fuel","object":{"fuel":{"biogenic_fraction":0.0,"carbon_content":18.672,"carbon_content_units":"grams_per_megajoule","co2_biogenic_emission_factor":0.0,"co2_biogenic_emission_factor_units":"kilograms_per_litre","co2_emission_factor":2.57607,"co2_emission_factor_units":"kilograms_per_litre","density":0.8156,"density_units":"kilograms_per_litre","energy_content":37.6267,"energy_content_units":"megajoules_per_litre","name":"Jet
Fuel","oxidation_factor":1.0,"physical_units":null}},"methodology":"default"},"passengers":{"description":"131","object":131,"methodology":"from
seats and load factor"},"seats":{"description":"169.27798641328772","object":169.27798641328772,"methodology":"default"},"load_factor":{"description":"0.7731146349652108","object":0.7731146349652108,"methodology":"default"},"freight_share":{"description":"0.06885888622195808","object":0.06885888622195808,"methodology":"default"},"trips":{"description":"1.7","object":1.7,"methodology":"default"},"segments_per_trip":{"description":"1.68","object":1.68,"methodology":"default"},"date":{"description":"2009-01-01","object":"2009-01-01","methodology":"from
timeframe"}},"emitter":"Flight","equivalents":{"cars_off_the_road_for_a_year":0.19786402148947937,"cars_off_the_road_for_a_month":2.3721939279672744,"cars_off_the_road_for_a_week":10.279144632873777,"cars_off_the_road_for_a_day":72.15078928665267,"cars_to_priuses_for_a_year":0.39572804297895875,"cars_to_priuses_for_a_month":4.744387855934549,"cars_to_priuses_for_a_week":20.558289265747554,"cars_to_priuses_for_a_day":144.30157857330533,"one_way_domestic_flight":3.533286098026417,"round_trip_domestic_flight":1.7666430490132086,"one_way_cross_country_flight":1.2415423765988212,"round_trip_cross_country_flight":0.6207711882994106,"vegan_meals_instead_of_non_vegan_ones":874.8275047269489,"days_of_veganism":291.6091682423163,"weeks_of_veganism":41.657986678208076,"months_of_veganism":9.720341846908983,"years_of_veganism":0.7990662406305897,"barrels_of_petroleum":2.528745681233676,"canisters_of_bbq_propane":45.29890210660515,"railroad_cars_full_of_coal":0.005435824766194489,"homes_energy_in_a_year":0.10545500046417307,"homes_energy_in_a_month":1.2600241808038823,"homes_energy_in_a_week":5.458655230212505,"homes_energy_in_a_day":38.319303106811425,"homes_electricity_in_a_year":0.15981324812611794,"homes_electricity_in_a_month":1.9123231527472209,"homes_electricity_in_a_week":8.286371273586878,"homes_electricity_in_a_day":58.16223783332778,"homes_with_lowered_thermostat_2_degrees_for_a_winter":5.706528839550974,"homes_with_raised_thermostat_3_degrees_for_a_summer":2.5657092896437987,"replaced_refrigerators":1.09477510791157,"loads_of_cold_laundry":498.5325352871354,"lightbulbs_for_a_year":2.006906503679005,"lightbulbs_for_a_month":24.423160674511834,"lightbulbs_for_a_week":104.67006736793459,"lightbulbs_for_a_day":732.6937330704019,"lightbulbs_for_an_evening":4396.1634855873635,"lightbulbs_to_CFLs_for_a_day":12471.386669121135,"lightbulbs_to_CFLs_for_a_week":1781.626356398747,"lightbulbs_to_CFLs_for_a_month":415.7133963143494,"lightbulbs_to_CFLs_for_a_year":34.16850731534531,"days_with_lightbulbs_to_CFLs":277.14226420956624,"weeks_with_lightbulbs_to_CFLs":39.59128610210093,"months_with_lightbulbs_to_CFLs":9.237640607670912,"years_with_lightbulbs_to_CFLs":0.7588411373607507,"recycled_kgs_of_trash":749.7687458259719,"recycled_bags_of_trash":415.44377940594615},"methodology":"http://impact.brighterplanet.com/flights?timeframe=2009-01-01%2F2010-01-01","scope":"The
flight greenhouse gas emission is the anthropogenic greenhouse gas emissions
attributed to a single passenger on this flight. It includes CO2 emissions
from combustion of non-biogenic fuel and extra forcing effects of high-altitude
fuel combustion.","timeframe":"2009-01-01/2010-01-01","characteristics":{},"errors":["API
key \"carbon_test\" could not be verified. Please register at http://keys.brighterplanet.com"]}'
http_version: '1.1'
recorded_at: Fri, 08 Jun 2012 21:05:40 GMT
recorded_with: VCR 2.2.0
module Carbon
VERSION = "3.0.0"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment