pygcam.mcs.XMLResultFile¶
API¶
-
class
pygcam.mcs.XMLResultFile.QueryResult(filename)¶ Holds the results of an XPath batch query
-
static
parseScenarioString(scenStr)¶ Parse a GCAM scenario string into a name and a time stamp
Parameters: scenStr – (str) a scenario name string of the form “Reference,date=2014-29-11T08:10:45-08:00” Returns: (str, datetime) the scenario name and a datetime instance
-
readCSV()¶ Read a CSV file produced by a batch query. The first line is the name of the query; the second line provides the column headings; all subsequent lines are data. Data are comma-delimited, and strings with spaces are double-quoted. Assume units are the same as in the first row of data.
-
static
-
class
pygcam.mcs.XMLResultFile.XMLColumn(element)¶
-
class
pygcam.mcs.XMLResultFile.XMLConstraint(element)¶
-
class
pygcam.mcs.XMLResultFile.XMLResult(element)¶ Represents a single Result (model output) from the results.xml file.
-
csvPathname(scenario, baseline=None, outputDir='.', type='scenario')¶ Compute the pathname of a .csv file from an outputDir, scenario name, and optional baseline name.
-
stringMatch(df)¶ Handle any string matching constraints since these can’t be handled in a df.query()
-
-
class
pygcam.mcs.XMLResultFile.XMLResultFile(filename)¶ XMLResultFile manipulation class.
-
getResultDefs(type=None)¶ Get results of type ‘diff’ or ‘scenario’
-
saveOutputDefs()¶ Save the defined outputs in the SQL database
-
-
pygcam.mcs.XMLResultFile.collectResults(context, type)¶ Called by worker to process results, return a list of dicts with data the master process can quickly write to the database. Returns a list of dicts with results for this trial.
-
pygcam.mcs.XMLResultFile.saveResults(context, resultList)¶ Called on the master to save results to the database that were prepared by the worker.