Skip to content

Commit

Permalink
CO2 checks ref #139
Browse files Browse the repository at this point in the history
  • Loading branch information
corradio committed Nov 20, 2016
1 parent 86711f8 commit fdda751
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/co2eq.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ function Co2eqCalculator() {

this.compute = function(countries) {
var validCountries = d3.values(countries)
.filter(function (d) { return d.countryCode && d.production; });
.filter(function (d) { return d.countryCode && d.production; })
.filter(function (d) {
// Double check that total production + import >= export
return (d.totalProduction + d.totalImport) >= d.totalExport;
});
var validCountryKeys = validCountries.map(function (d) { return d.countryCode });
// x_i: unknown co2 (consumption) footprint of i-th country
// f_ij: known co2 footprint of j-th system of i-th country
Expand Down

0 comments on commit fdda751

Please sign in to comment.