pygcam.mcs.XMLConfigFile

API

class pygcam.mcs.XMLConfigFile.XMLConfigFile(context, useCopy=False, useRefConfig=False)

Stores information about a GCAM config.xml file

addConfigElement(name, group, value)

Append a new element with the given name and value to the given group.

copyOriginal()

Copy config file to xxx/config-original.xml if config.xml is newer, so runsim can use the original to generate XML files.

deleteConfigElement(name, group)

Remove the Value element with the given name from the given group

getConfigElement(name, group)

Find the config file component with the specified tag and return the corresponding Element.

classmethod getConfigForScenario(context, useCopy=False)

Return the path to the run-tree version of the config file for the given scenario.

updateConfigElement(name, group, newName=None, newValue=None)

Update the name attribute, the value (element text), or both for the named config element.

write(path=None)

Write out the modified configuration file tree to the same path that it was read from, or to the given path.

Parameters:path – (str) pathname to write to
Returns:none
classmethod writeAll(context)

Write all configuration files to disk. :return:

pygcam.mcs.XMLConfigFile.getSimConfigFile(context)

Returns the path to sim’s copy of the config.xml file for the given scenario.