Published
Edited
Jun 25, 2021
Insert cell
Insert cell
md`*A final version of this notebook can be viewed on my blog [here](https://www.robinlinacre.com/flight_distance/).*`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
total_flight_miles = d3.sum(selected_airports_with_distances, d => d.distance)
Insert cell
total_energy_usage = eu.flying.flying_miles_to_kwh(total_flight_miles)
Insert cell
kwh_to_kg_co2 = function(kwh) {
return kwh * eu.convert.per("kg_co2_from_jet_fuel/kwh");
}
Insert cell
tonnes_co2 = kwh_to_kg_co2(eu.flying.flying_miles_to_kwh(total_flight_miles)) /
1000
Insert cell
fmt_num = d3.format(",.0f")
Insert cell
fmt_num_round = d3.format(",.2r")
Insert cell
Insert cell
Insert cell
eu = require("@robinl/energy_usage@0.1.6")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more