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
configFileName
and a HEC-DSS databasedssFilePath
to operate on. IfdssFilePath
is not set, the active DSS-file in the HEC-DSSVue window will be used. IfconfigFileName
is not set, a file selection dialogue is displayed prompting for a configuration file.The attribute
config
will be set containing the parsed yaml config file.-
schema
= None¶ Configuaration validation schema (uses
voluptuous
library)
-
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
refreshCatalogue
is 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
folder
relative todssFilePath
.If the path
folder
is already absolute, it will simply return the path.createFolder
is 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
valueStr
starts 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.