KAYA model - multiple views

some visuals for KAYA model

KAYA identity

The KAYA identity breaks carbon emissions into drivers:

  • population
  • GDP per capita
  • energy intensity (energy needed to generate GDP)
  • carbon intensity of energy sources (carbon needed to generate energy)

Below you can project carbon emissions based on assumptions about the the changes to each driver.

Another KAYA identity projector on which this is loosely based is here (David Archer, University of Chicago).

More information on Wikipedia and Emissions Drivers page by Our World in Data.

I have more plans with this model, including plugging actual data, tracking/reconciliations to plan (common/normal useful modelling exercises).

visuals

Visual Spec
embed(
  calcuvizspec({
    models: [kaya],
    input_cursors: [{population_2023_in,population_2050_in,population_2100_in,per_capita_gdp_2023_in,energy_intensity_2023_in,carbon_intensity_2023_in,per_capita_gdp_rate_in,energy_intensity_rate_in,carbon_intensity_rate_in}],
    mark: 'text',
    encodings: {
      y: {name: 'year_in', grid:false, type:'quantitative', domain: [2023,2024,..._.range(2030,2101,20), 2100], zero:false, sort:'descending'},
      text: {name: 'value', type: 'quantitative', format: '.4k'},
      x: {name: 'formula', type:'nominal', domain: ["carbon_emissions", "population_factor", "per_capita_gdp_factor", "energy_intensity_factor", "carbon_intensity_factor", "year"]},
      color: {name: 'formula', type:'nominal', legend:false},
    },
    width: 400, height:400
}))
Visual Spec
embed(
  calcuvizspec({
    models: [kaya],
    input_cursors: [{population_2023_in,population_2050_in,population_2100_in,per_capita_gdp_2023_in,energy_intensity_2023_in,carbon_intensity_2023_in,per_capita_gdp_rate_in,energy_intensity_rate_in,carbon_intensity_rate_in}],
    mark: 'bar',
    encodings: {
      x: {name: 'year_in', grid:false, type:'quantitative', domain: _.range(2023,2100), zero:false},
      y: {name: 'value', type: 'quantitative', independent:true, grid:false},
      row: {name: 'formula', type:'nominal', domain: ["carbon_emissions", "population_factor", "per_capita_gdp_factor", "energy_intensity_factor", "carbon_intensity_factor"]},
      color: {name: 'formula', type:'nominal', legend:false},
    },
    width: 400, height:50
}))

Appendix

Tip

You can find the calculang model source code by opening Developer Tools (Ctrl+Shift+I) and navigating to the .cul.js file (Ctrl+P and search .cul.js).

Code
import { calcuvizspec } from "@declann/little-calcu-helpers"
embed = require('vega-embed');

viewof entrypoint = Inputs.select(['models/kaya/kaya.cul.js'], {label:'entrypoint'})

entrypoint_no_cul_js = entrypoint.slice(0,-7)

kaya = require(`../../${entrypoint_no_cul_js}.js`);

introspection_fetch = await fetch(`../../${entrypoint_no_cul_js}.introspection.json`)

introspection = introspection_fetch.json({typed:true})

inputs = Object.values(introspection.cul_functions).filter(d => d.reason == 'input definition').map(d => d.name).sort()

formulae = Object.values(introspection.cul_functions).filter(d => d.reason == 'definition').map(d => d.name)

// formulae excluding pure inputs
formulae_not_inputs = Object.values(introspection.cul_functions).filter(d => d.reason == 'definition' && inputs.indexOf(d.name+'_in') == -1).map(d => d.name)
Tip

For calculang devtools adjust entrypoint in devtools.

|