awips2/cave/com.raytheon.viz.gfe/help/SmartScriptClassCalls.html
2022-05-05 12:34:50 -05:00

172 lines
No EOL
5.3 KiB
HTML

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