Posted by Andy on Sunday, October 03, 2010.

Our carbon gem is now also a command-line carbon calculator

Version 0.3.0 of the carbon gem—our Ruby wrapper for the emission estimates service API—includes “command-line access” to the web service:

# `carbon`
carbon-> key '123ABC'
  => Using key 123ABC
carbon-> flight
  => 1210.66889895298 kg CO2e
flight*> origin_airport 'lax'
  => 1461.63846640404 kg CO2e
flight*> destination_airport 'jfk'
  => 1733.79410872608 kg CO2e
flight*> url
  => http://carbon.brighterplanet.com/flights.json?origin_airport=lax&destination_airport=jfk&key=123ABC
flight*> done
  => Saved as flight #0
carbon-> exit

(Notice that you’ll need a developer key to use this or any other Carbon Middleware-powered library.)

We think this feature might be especially useful to researchers and scientists who want to make “quick” calculations but still want to rely on our rigorous, transparent carbon models.

For complete documentation see the README.

Go ahead and give it a try!

$ gem install carbon
$ carbon
carbon->

What blog is this?

Safety in Numbers is Brighter Planet's blog about climate science, Ruby, Rails, data, transparency, and, well, us.

Who's behind this?

We're Brighter Planet, the world's leading computational sustainability platform.

Who's blogging here?

  1. Patti Prairie CEO