PyTuflow: Difference between revisions
Content deleted Content added
Ellis Symons (talk | contribs) No edit summary |
Ellis Symons (talk | contribs) No edit summary |
||
Line 94:
|''list'' Result Types
|-
|rowspan='3'|<b>[[#maximum|maximum]] (</b> ''str'' Element, ''str'' Result Type, [optional] ''str'' Domain <b>)</b>
|rowspan='3'|Returns the maximum result value 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 786:
for rt in lp_rt:
print(rt)
else:
# did not load correctly, print error message to console
print(message)
</pre>
==maximum==
<b>maximum (</b> ''str'' Element, ''str'' Result Type, [optional] ''str'' Domain <b>)</b><br>
Returns the maximum result value 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 result 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''
:: Maximum result
'''Examples'''
<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:
channel = 'Chan_A'
maximum = res.maximum(channel, 'Q')
# print to console
print('Max flow at {0} is {1} m3/s'.format(channel, maximum)
else:
# did not load correctly, print error message to console
print(message)
</pre>
<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'
maximum = res.maximum(channel, 'H')
# print to console
print('Max water level at {0} is {1} mRL'.format(node, maximum)
else:
# did not load correctly, print error message to console
| |||