PyTuflow: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 130:
|''list'' Node IDs
|-
|rowspan='1'|<b>[[#nodeUpstream|nodeUpstream]] (</b> ''str'' Channel ID <b>)</b>
|rowspan='1'|Returns the name of the upstream node of a given channel
|''str'' Node ID
Line 1,182:
for node in nodes:
print(node)
else:
# did not load correctly, print error message to console
print(message)
</pre>
 
==nodeUpstream==
<b>nodeUpstream (</b> Channel ID <b>)</b><br>
Returns the name of the upstream node of a given channel<br>
;Parameters:
: '''Channel ID:''' ''str''
:: Name or ID of channel
;Returns:
: '''Node ID:''' ''str''
:: Name or ID of upstream node
'''Example'''<br>
<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'
ups_node = res.nodeUpstream(channel)
# print to console
print('Upstream node of channel {0} is {1}'.format(channel, ups_node))
else:
# did not load correctly, print error message to console