Python 2.7 library and scripts for interfacing with GCAM
pygcam is a Python package that provides classes, functions, and scripts for working with GCAM.
Added label to identify default scenario group in listing groups via “gt run -G”
Added function to carbonTax.py to create linked land-use change CO2 to carbon tax or cap policies:
genLinkedBioCarbonPolicyFile(filename, market='global', regions=None, forTax=True, forCap=False)
Also added function (bioCarbonTax) callable from XML setup file to access this feature.
Added initial support to integrate pygcam-mcs (coming soon!)
Made the <scenariosFile> element optional in project.xml, using the value of GCAM.ScenarioSetupFile by default.
Added function callable from setup XML, <protectionScenario name=”xxx”/>, which indicates a protection scenario to use from the file defined by config variable GCAM.ProtectionXmlFile.
Reversed previous modification to handling of “gt config -e” (edit config file) which had placed quotes around the value of GCAM.TextEditor. This breaks commands like “emacs -nw” since this is now seen as the command name. Solution is for users with spaces within a command name to add the quotes in the config file, e.g.,
GCAM.TextEditor = "c:/Programs/Some Path With Spaces/someEditor.exe"
Added check to prevent deletion of files within reference workspace, which could happen under specific circumstances with symbolic links.
Added new “srcGroupDir” attribute to <scenario> element to identify a directory holding static XML files for a scenario, allowing related scenarios to share these files without requiring copying or symlinks.
If you were stymied by the installation process, you can try the new zipped all-in-one directory that bundles everything needed to run gcamtool (the “gt” command) without any additional downloads or installation steps other than setting your PATH variable. This works only for Mac and Windows. See http://pygcam.readthedocs.io/en/latest/install.html for details.
A new feature of the “run” sub-command lets your run a scenario group on a cluster with one command. The baseline is queued and all policy scenarios are queued with a dependency on completion of the baseline job. Just specify the -D option to the run sub-command.
You can run all scenarios for all scenario groups of a project this way by specifying the -D (or –distribute) and -a (or –allGroups) flags together. All baselines will start immediately with all policy scenarios queued as dependent on the corresponding baseline.
The requirement to install xmlstarlet has been eliminated: all XML manipulation is now coded in Python, but it’s still fast since it uses the same libxml2 library that xmlstartlet is based on.
All configuration variables have been updated with defaults appropriate for GCAM 4.3.
The “group” attribute of project <step> elements now is treated as a regular expression of an exact match is not found. So if you have, say, groups FuelShock-0.9 and FuelShock-1.0, you can declare a step like the following that applies to both groups:
<step name="plotCI" runFor="policy" group="FuelShock"> ... some command ... </step>
Updated carbon tax generator. This can be called from a scenarios.xml file as follows (default values are shown):
<function name="taxCarbon">initialValue, startYear=2020, endYear=2100, timestep=5, rate=0.05, regions=GCAM_32_REGIONS, market='global'</function>