Skip to content

Instantly share code, notes, and snippets.

View ihough's full-sized avatar

Ian Hough ihough

  • Université Grenoble Alpes
  • Grenoble, France
View GitHub Profile
@ihough
ihough / keybase.md
Last active October 12, 2017 21:27
Keybase identify verification

Keybase proof

I hereby claim:

  • I am ihough on github.
  • I am ihough (https://keybase.io/ihough) on keybase.
  • I have a public key whose fingerprint is A211 9A50 D014 6681 BEC5 ECBD A14F FF0F EC89 48C6

To claim this, I am signing this object:

@ihough
ihough / gist:3017218
Created June 29, 2012 10:36
Better organization of electricity / fuel data in Earth?

I'm finding it frustrating to have to use an individual committee to look up each gas-specific electricity emission factor in an emitter model. For example:

committee :electricity_co2_emission_factor do
  quorum 'from eGRID subregion' do
    egrid_subregion.co2_emission_factor
  end
  quorum 'from state' do
    state.electricity_co2_emission_factor
  end

quorum 'from country' do

# Country Codes to Country Names
# Created by OpenGeoCode.Org, Submitted into the Public Domain October 3rd, 2011 (version 8)
#
# Abbreviations:
# ISO : International Standards Organization
# BGN : U.S. Board on Geographic Names
# UNGEGN : United Nations Group of Experts on Geographic Names
# PCGN : UK Permanent Committee on Geographic Names
# FAO : Food and Agriculture Organization of the United Nations
#
@ihough
ihough / gist:1277988
Created October 11, 2011 12:49
How much should we trust our reference data?
When working on emitter gems I often find myself wondering what assumptions I can make about the quality of our reference data, and how I should deal with any quality issues.
For example, in the AutomobileTrip emitter:
committee :fuel_efficiency
:quorum 'from make year and hybridity multipler',
:needs => [:make_year, :hybridity_multiplier] do |characteristics|
# This will fail or give an improper value unless both are numbers > 0
characteristics[:make_year].fuel_efficiency * characteristics[:hybridity_multiplier]
end
@ihough
ihough / gist:1267796
Created October 6, 2011 16:04
Why does this break method_missing?
class NationalTransitDatabaseCompany < ActiveRecord::Base
# This returns an array of all NTD companies that provide rail service
def self.rail_companies
NationalTransitDatabaseRecord.rail_records.map(&:ntd_company).uniq
end
# This lets you calculate things from the NTD records associated with the company
def method_missing
...
end
@ihough
ihough / gist:1215578
Created September 14, 2011 00:44
Rail trip calculations - part 2
Follow-up to https://gist.github.com/1215053
committee :emission
from co2 emission, ch4 emission, and n2o emission
from distance and rail company rail traction rail class
from distance and rail company rail traction
from distance and rail company
@ihough
ihough / gist:1215053
Created September 13, 2011 20:27
Rail trip calculations
In US we have:
Country
US
rail_trip_diesel_intensity
rail_trip_electricity_intensity
electricity_co2_emission_factor
electricity_co2_biogenic_emission_factor
electricity_ch4_emission_factor
electricity_n2o_emission_factor