some visuals ๐Ÿ“Š

some visuals for โ€˜mainโ€™ model

WIP

Do not use.

Code
viewof emissions_rate_in = Inputs.range([0,20], {value: 10.5, step:0.1, label: 'emissions rate Gt Carbon'})
viewof drawdown_factor_in = Inputs.range([0,0.01], {value: 0.001, step:0.0005, label: 'drawdown factor'})

viewof ppm_to_GtC_in = Inputs.select([2.3,2.13], {value: 2.3, step:0.1, label: 'ppmv to GtC'})

climate_formulae = ['drawdown','temperature','CO2_concentration','concentration_factor','temperature_delta']

embed(
  calcuvizspec({
    models: [main],
    input_cursors: [{emissions_rate_in, ppm_to_GtC_in, drawdown_factor_in}],
    mark: 'text',
    encodings: {
      x: {name: 'year_in', type:'nominal', domain: [2015,2016,2017,2020,2030,2060,2090,2100]},
      y: {name: 'climate_sensitivity_in', type: 'nominal', domain: [2,3,4]},
      text: {name: 'value', type: 'quantitative', format:',.2f'},
      row: {name: 'formula', type:'nominal', domain: climate_formulae},
      color: {name: 'formula', type:'nominal', domain: climate_formulae, legend: false},
    },
    width: 500, height:50
}))
Code
embed(
  calcuvizspec({
    models: [main],
    input_cursors: [{emissions_rate_in, ppm_to_GtC_in, drawdown_factor_in}],
    mark: 'line',
    encodings: {
      x: {name: 'year_in', type:'quantitative', domain: _.range(2015,2100,3)},
      color: {name: 'climate_sensitivity_in', type: 'nominal', domain: [2,3,4], independent:true}, //
      y: {name: 'value', type: 'quantitative', zero: false, independent:true},
      row: {name: 'formula', type:'nominal', domain: ['temperature','temperature_delta']},
      //color: {name: 'formula', type:'nominal', domain: climate_formulae, legend: true},
    },
    width: 400, height:40
}))

Diff emissions rates:

Code
viewof f = Inputs.select(['temperature_delta','CO2_concentration'])

embed(
  calcuvizspec({
    models: [main],
    input_cursors: [{emissions_rate_in, ppm_to_GtC_in, drawdown_factor_in}],
    mark: 'line',
    encodings: {
      x: {name: 'year_in', type:'quantitative', domain: _.range(2015,2100,3), grid:false},
      column: {name: 'climate_sensitivity_in', type: 'nominal', domain: [2,3,4], independent:'shared'}, //
      y: {name: f, type: 'quantitative', zero: false, independent:false, grid:false},
      color: {name: 'emissions_rate_in', type:'quantitative', domain: _.range(10,3-0.1,-1), scale:{'scheme':'reds'}},
      //color: {name: 'formula', type:'nominal', domain: climate_formulae, legend: true},
    },
    spec_post_process: s => {
      s.encoding.color.title = 'emissions_rate_in (GtC)';
      s.encoding.column.title = 'climate_sensitivity_in (ฮ”T per ppmv doubling)';
      s.encoding.x.axis = {"grid": false, "tickCount":1, "format": "k"};
      return s },
    width: 90, height:140
}))

Appendix

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

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

entrypoint_no_cul_js = entrypoint.slice(0,-7)

main = 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)
|