Desktop Model API / Python Example
Here is some information regarding our model command-line tool (MDL), and attached an example Python file (just inside the .zip file) which utilises this to export data from model databases.
The desktop model has a command line tool called MDL (Model and Data Automation tool), which acts like an API to the model database. This allows users to import/export data and solve scenarios from the command-line, which means it can quite easily be integrated into platforms such as R and Python. MDL does get installed with the Global Model Workstation (GMW) already, but you can also find the link to download below if it is not already installed:
Since you wouldn’t necessarily need to have the full model installed, you would need to have the two files ‘sectors’ and the ‘OEFHelp_Kit.mdb’ from a model installation as a ‘model directory’ (or same location as the .bat/.py depending on how you produce the MDL script). These can be found from the ‘Data Files’ download from the main GEM page, (which also includes the baseline database).
It is worth nothing that these two files do change over time – particularly the help kit which holds the metadata for each variable, and controls the way that MDL will aggregate quarterly data to annual (e.g. sum/avg/eop) when the ‘rollup’ (-r) command is used to pull out annual data. The ‘sectors’ file controls the identification of variables against locations, this does not change very often but using the wrong sectors file can lead to missing or incorrect data.