I used the following code to access the full name of the random variable:
simdef = MimiFUND.getmcs()
filter(x->startswith(String(x),"climatesensitivity"), collect(keys(simdef.rvdict)))
The reason the number isn’t just 28 for climatesensitivity is that some of the previous lines in the defmcs.jl file are actually defining more than one random variable, because some of them are defining different distributions for different regions of the model, so Mimi has to store multiple random variables for the different regions (hence the unique number appended to the name). If you check this out for the “agcbm” random variable, you’ll see that there are 16 of them, one for each region:
filter(x->startswith(String(x),"agcbm"), collect(keys(simdef.rvdict)))
For this reason, I would probably just recommend you copy the whole simulation definition and change the distributions you want to modify directly. However, you could still modify the ones you want with replaceRV!
if you find the correct full name.
For calculating the SC-CO2:
you don’t actually call replaceRV!
on the two models, you just call it on the SimulationDefinition object obtained by MimiFUND.getmcs()
which stores all of the information about the random variables to use in the monte carlo simulation. The simulation is then run for two models (one with a pulse of emissions) to calculate the SCC. What I’m recommending is that you copy the MimiFUND code for the compute_scco2
function, and just replace the part in that code where it calls simdef = MimiFUND.getmcs()
and replace that with your modified SimulationDefinition. Everything else about that function (setting up the two models, using a post-trial function for calcualting the scc, etc.) should remain the same.