PyTuflow: Difference between revisions

Content deleted Content added
No edit summary
Line 44:
|''list'' Channel IDs
|-
|rowspan='1'|<b>[[#channelsUpstream|channelsUpstream]] (</b> ''str'' Node ID <b>)</b>
|rowspan='1'|Returns a list of all the channels upstream of a given node
|''list'' Channel IDs
Line 373:
print('Channels downstream of {0}:'.format(node))
for chan in dns_chans:
print(chan)
else:
# did not load correctly, print error message to console
print(message)
</pre>
 
==channelsUpstream==
<b>channelsUpstream (</b> Node ID <b>)</b><br>
Returns a list of all the channels upstream of a given node<br>
;Parameters:
: '''Node ID:''' ''str''
:: Name or ID of node e.g. 'Chan_A.1'
;Returns:
: '''Out:''' ''list''
:: List of channels e.g. ['Chan_A']
'''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'
ups_chans = res.channelsUpstream(node)
# print to console
print('Channels downstream of {0}:'.format(node))
for chan in ups_chans:
print(chan)
else: