PyTuflow: Difference between revisions
Content deleted Content added
Ellis Symons (talk | contribs) No edit summary |
Ellis Symons (talk | contribs) No edit summary |
||
Line 170:
|''str'' Path
|-
|rowspan='3'|<b>[[#timeOfMaximum|timeOfMaximum]] (</b> ''str'' Element, ''str'' Result Type, [optional] ''str'' Domain <b>)</b>
|rowspan='3'|Returns the time of maximum for the given element (1D node, 1D channel, 2D PO, RL) for the given result type. If there are duplicate names between 1D, PO, or RL elements it will give priority return to 1D elements first, PO elements second, and lastly RL elements unless 'domain' variable is explicitly specified (domain options: '1D', '2D', 'RL')
|''bool'' Error
Line 1,482:
# print to console
print('Successfully loaded result from {0}.format(source))
else:
# did not load correctly, print error message to console
print(message)
</pre>
==timeOfMaximum==
<b>timeOfMaximum (</b> Element, Result Type, [optional] Domain <b>)</b><br>
Returns the time of maximum for the given element (1D node, 1D channel, 2D PO, RL) for the given result type. If there are duplicate names between 1D, PO, or RL elements it will give priority return to 1D elements first, PO elements second, and lastly RL elements unless 'domain' variable is explicitly specified (domain options: '1D', '2D', 'RL')<br>
;Parameters:
: '''Element:''' ''str''
:: Channel, Node, or RL element to get maximum result for. PO results do not currently support getting maximum value.
: '''Result Type:''' ''str''
:: Result type e.g. 'H'
: '''Domain:''' ''str''
:: Optional input to specify which domain the Element belongs in. If left as default (None) and there are duplicate names between 1D, PO, or RL elements it will give priority return to 1D elements first, PO elements second, and lastly RL elements.
;Returns:
: '''Error:''' ''bool''
:: Returns False on success, True when an error occurred
: '''Message:''' ''str''
:: Accompanying error message if an error occurred
: '''Maximum''' ''float''
:: Time of maximum
'''Example'''
<pre>
import pytuflow as tu
# Initialise result class
res = tu.ResData()
# load .tpc result file
path = r'C:\TUFLOW\results\M04_5m_001.tpc'
err, message = res.load(path)
# check results were loaded successfully before calling function
if not err:
node = 'Chan_A.1'
tom = res.timeOfMaximum(channel, 'H')
# print to console
print('Time of max water level at {0} is {1} hrs'.format(channel, tom)
else:
# did not load correctly, print error message to console
| |||