Calling Smart Tools and Procedures
Calling Smart Tools and
Procedures
Arguments
callSmartTool
callProcedure
Calling Smart Tools and Procedures Arguments
## editArea : ReferenceData
or None
## (See
getEditArea)
## If
you specify None, the system will supply
## the
active edit area from the GFE or from
## the
editArea argument for runProcedure.
## timeRange: TimeRange
or None
## (See
getTimeRange and createTimeRange)
## If
you specify None, the system will supply
## the
selected Time Range from the GFE or from
## the
timeRange argument for runProcedure.
## varDict : If you supply a varDict
in this call, the
##
variable
list dialog will not be displayed
## when
the tool is run.
## If
you supply a varDict from a Procedure,
## make
sure that the variables
## for
all the tools called by the procedure are
##
supplied
in your varDict.
## missingDataMode: Can be "Stop",
"Skip",
or "Create". If not
##
included,
will be set to the current GFE default.
## modal: If 0, VariableList dialogs
will appear with the
##
non-modal
"Run" and "Run/Dismiss" buttons.
##
Otherwise,
they will appear with the "Ok" button.
##
## These commands all return an error
which will be None if no
## errors
occurred. Otherwise, the errorType and errorInfo
## can
be accessed e.g. error.errorType() and error.errorInfo()
## If "noData" has been called, the
errorType will be "NoData" and
## can
be tested by the calling tool or script.
callSmartTool
def callSmartTool(self, toolName, elementName, editArea=None,
timeRange=None,
varDict=None, editValues=1, calcArea=0, calcGrid=0, passErrors=[],
missingDataMode="", modal=1):
# passErrors: a list of errors
to ignore and pass back to the
# calling program. Some errors
that can be ignored are:
# NoData
#
NoElementToEdit
#
ExecuteOrClassError
#
LockedGridError
#
# For example:
# In the Procedure:
# error
= self.callSmartTool(
#
"MyTool", "MixHgt", editArea, timeRange, varDict,
#
passErrors= ["NoData"])
# if error
is not None:
#
print "No Data available to run tool"
#
# In the Smart Tool:
# mixHgt
= self.getGrids(model, "MixHgt", "SFC", timeRange)
# if
mixHgt
is None:
#
self.noData()
callProcedure
def callProcedure(self, name, editArea=None, timeRange=None,
varDict=None,
missingDataMode="Stop", modal=1):