2. API Reference¶
2.1. toolbox — Toolboxes in HEC-DSSVue¶
2.1.1. Tool — A tool base class¶
-
class
toolbox.Tool(configFileName=None, dssFilePath=None)¶ A tool for undertaking tasks in HEC-DSSVue.
A tool is defined by providing a yaml configuration file
configFileNameand a HEC-DSS databasedssFilePathto operate on. IfdssFilePathis not set, the active DSS-file in the HEC-DSSVue window will be used. IfconfigFileNameis not set, a file selection dialogue is displayed prompting for a configuration file.The attribute
configwill be set containing the parsed yaml config file.-
schema= None¶ Configuaration validation schema (uses
voluptuouslibrary)
-
refreshCatalogue= 0¶ Whether to refresh the HEC-DSSVue catalogue after completing the task.
-
message= None¶ Message to be displayed in HEC-DSSVue after running the tool. This attribute is typically set in the
main().
-
run()¶ Main tool execution method.
This method should be called after instantiating the tool to run it. The method executes
main()followed bypostRun().
-
main()¶ Run core tool tasks.
Must be implemented in sub-class.
-
postRun()¶ Run additional tasks at the end of the core run.
By default this method refreshes the HEC-DSSVue catalogue (if
refreshCatalogueis true) and displays any string inmessage.
-
2.2. toolbox.util — Common utility functions¶
-
toolbox.util.relativeFolder(folder, dssFilePath, createFolder='ifrelative')¶ Return an absolute path to
folderrelative todssFilePath.If the path
folderis already absolute, it will simply return the path.createFolderis one of ‘ifrelative’, ‘ifabsolute’ or ‘allways’.
-
class
toolbox.util.ValidationError¶ An error while validating data.
-
class
toolbox.util.CancelledError¶ Operation cancellation/interruption by the user.
-
toolbox.util.parseMeasurement(valueStr)¶ Return numeric value of measurement string and quality flag as tuple.
If
valueStrstarts with<(i.e. below limit of detection), the returned value is 50% of the value after the<.
-
toolbox.util.parseDateTime(dateStr, timeStr, dateFmt='%Y/%m/%d')¶ Return HecTime from date and time strings.
Time format is always %H:%M:%S.