Running MIMOSA
Base run
A basic run of MIMOSA requires 4 steps: loading the parameters, building the model instance, solving the model and finally saving the output. With this code, the default parameter values are used (see Parameter reference).
from mimosa import MIMOSA, load_params
params = load_params() # (1)!
model1 = MIMOSA(params) # (2)!
model1.solve() # (3)!
model1.save("run1") # (4)!
- Read the default parameters
- Build the model using the parameters
- Once the model is built, send the model to the solver.
Note that if you use the NEOS solver, use the syntaxmodel1.solve(use_neos=True, neos_email="your.email@email.com")
- Export the output to the file output/run1.csv
Reading the output
Once the script above has finished running, it has produced two output files in the folder output
: run1.csv
and run1.csv.params.json
. The latter is simply a JSON file with all the input parameter used for this particular run (for reproducibility). The former is a CSV file that contains all the output data. Every variable in MIMOSA is saved in this value in a format similar to IAMC data format:
output/run1.csv
Variable | Region | Unit | 2020 | 2025 | 2030 | 2035 | 2040 | 2045 | 2050 | 2055 | 2060 | 2065 | 2070 | 2075 | 2080 | 2085 | 2090 | 2095 | 2100 | 2105 | 2110 | 2115 | 2120 | 2125 | 2130 | 2135 | 2140 | 2145 | 2150 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
regional_emissions | CAN | GtCO2/yr | 0.511577 | 0.383683 | 0.255789 | 0.155544 | 0.136527 | 0.113384 | 0.0944834 | 0.0845257 | 0.077836 | 0.0694752 | 0.0588413 | 0.0469933 | 0.0359533 | 0.0269266 | 0.0199594 | 0.014565 | 0.0104499 | 0.0517489 | 0.0517486 | 0.0517485 | 0.0517484 | 0.0517483 | 0.0517482 | 0.0517481 | 0.051748 | 0.0517478 | 0.0517476 |
regional_emissions | USA | GtCO2/yr | 5.39382 | 4.04537 | 2.69691 | 1.34846 | 0.789513 | 0.649695 | 0.531854 | 0.430432 | 0.341586 | 0.262853 | 0.195861 | 0.142273 | 0.101621 | 0.072636 | 0.0549502 | 0.0495887 | 0.0582421 | 0.534749 | 0.534749 | 0.534749 | 0.534749 | 0.534749 | 0.534749 | 0.534749 | 0.534749 | 0.534748 | 0.534748 |
regional_emissions | MEX | GtCO2/yr | 0.572878 | 0.429658 | 0.286439 | 0.250682 | 0.235195 | 0.210891 | 0.184067 | 0.159748 | 0.137097 | 0.114491 | 0.0904155 | 0.0650686 | 0.0402638 | 0.0171455 | -0.00403092 | -0.0236268 | -0.0413935 | 6.53385e-05 | 6.49712e-05 | 6.47857e-05 | 6.46547e-05 | 6.45457e-05 | 6.4444e-05 | 6.4339e-05 | 6.42181e-05 | 6.40555e-05 | 6.37559e-05 |
... | ... |
These output files can be easily imported for plotting software (like using Plotly in Python). An easier way, however, to quickly visualise and compare MIMOSA outputs, is by using the MIMOSA Dashboard. After opening the online Dashboard, simply drag and drop all output files to the drag-and-drop input to visualise one or multiple MIMOSA output files. Also include the parameter files to directly see the difference in input parameters.