some visuals ๐Ÿ“Š ramp

some visuals for โ€˜mainโ€™ model

WIP

Do not use.

Code
viewof drawdown_factor_in = Inputs.range([0,0.01], {value: 0.001, step:0.0005, label: 'drawdown factor'})

viewof emissions_rate_in = Inputs.range([0,20], {value: 10.5, step:0.1, label: 'emissions rate Gt Carbon'})
viewof zero_year_in = Inputs.range([2021,2060], {value: 2050, step:1, label: 'zero year'})

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','temperature_delta','emissions_rate']

embed(
  calcuvizspec({
    models: [main],
    input_cursors: [{emissions_rate_in, ppm_to_GtC_in, zero_year_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, climate_sensitivity_in:3}],
    mark: 'line',
    encodings: {
      color: {name: 'zero_year_in', type: 'ordinal', domain:[2030,2050,2040]},
      x: {grid: false, name: 'year_in', type:'quantitative', domain: _.range(2015,2100,3)},
      column: {name: 'drawdown_factor_in', type: 'nominal', domain: [0.001,0], sort:'descending',independent:true}, //
      y: {grid:false,name: 'value', type: 'quantitative', zero: false, independent:true},
      row: {name: 'formula', type:'nominal', domain: ['CO2_concentration','temperature_delta', 'emissions_rate']},
      //color: {name: 'formula', type:'nominal', domain: climate_formulae, legend: true},
    },
    width: 300, height:80
}))
Code
embed(
  calcuvizspec({
    models: [main],
    input_cursors: [{emissions_rate_in, ppm_to_GtC_in, climate_sensitivity_in:3}],
    mark: 'line',
    encodings: {
      //color: {name: 'zero_year_in', type: 'ordinal', domain:[2030,2050,2040]},
      color: { name: 'zero_year_in', type:'quantitative', domain: _.range(2015,2100,3)},

      x: {grid: false, name: 'year_in', type:'quantitative', domain: _.range(2015,2100,3)},
      column: {name: 'drawdown_factor_in', type: 'nominal', domain: [0.001,0], sort:'descending',independent:true}, //
      y: {grid:false,name: 'value', type: 'quantitative', zero: false, independent:true},
      row: {name: 'formula', type:'nominal', domain: ['CO2_concentration','temperature_delta', 'emissions_rate']},
      //color: {name: 'formula', type:'nominal', domain: climate_formulae, legend: true},
    },
    width: 300, height:80
}))
Code
embed(
  calcuvizspec({
    models: [main],
    input_cursors: [{emissions_rate_in, ppm_to_GtC_in, climate_sensitivity_in:3}],
    mark: 'line',
    encodings: {
      color: {name: 'zero_year_in', type: 'ordinal', domain:[2030,2050,2040]},
      x: {grid: false, name: 'year_in', type:'quantitative', domain: _.range(2015,2100,3)},
      column: {name: 'drawdown_factor_in', type: 'nominal', domain: [0.001,0], sort:'descending',independent:true}, //
      y: {grid:false,name: 'value', type: 'quantitative', zero: false, independent:false},
      row: {name: 'formula', type:'nominal', domain: ['temperature_delta']},
      //color: {name: 'formula', type:'nominal', domain: climate_formulae, legend: true},
    },
    width: 300, height:80
}))

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_esm/ramp.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)
|