Python Library TUFLOW Results: Difference between revisions

Content deleted Content added
Line 154:
 
=Examples=
These examples canwork bewith downloadedthe inTutorial Model module 4 results.py format alongThe withtutorial themodel examplecan resultsbe downloaded fromon the [https://www.tuflow.com/Tuflow%20Tutorial%20Models.aspx TUFLOW website (link required)].
==Plot Flow in Channel==
<pre>
Line 161:
import matplotlib.pyplot as plt
import TUFLOW_results
 
input_res = r'C:\TUFLOW\Models\Tutorials\QGIS\Complete_Model\TUFLOW\results\M04\2d\plot\M04_5m_001.tpc'
 
# initialise the results class
Line 178 ⟶ 180:
#Get flow data
chan_id = 'ds3' # this is the channel ID to use
found, results, message = res.getTSgetTSData(chan_id,'1D','Q','L')
if found:
print ('found requested data')
# plot data
ax1.plot(res.times,results,color='b',label='Flow - '+chan_id)
else:
print (message)
sys.exit()
 
Line 214 ⟶ 216:
#Get water level data
for node_id in node_ids: #for each node in the list above
found, results, message = res.getTSgetTSData(node_id,'1D','H','P')
if found:
print ('found requested data')
# plot data
ax1.plot(res.times,results,label='Level - '+node_id)
else:
print (message)
sys.exit()
 
Line 248 ⟶ 250:
 
#Get flow data
found, results, message = res.getTSgetTSData(chan_id,'1D','Q','L')
if found:
print ('found requested data')
ax1.plot(res.times,results,color='b',label='Flow - '+chan_id)
else:
print (message)
sys.exit()
 
#Get velocity data
found, results, message = res.getTSgetTSData(chan_id,'1D','V','L')
if found:
print ('found requested data')
ax2.plot(res.times,results,color='r',label='Velocity - '+chan_id)
else:
print (message)
sys.exit()
 
Line 289 ⟶ 291:
error, message = res.LP_getConnectivity(us_chan,ds_chan)
if error:
print (message)
sys.exit()
else:
print ('LP connectivity determined.')
 
print ('Get LP static data')
error, message = res.LP_getStaticData()
if error:
print (message)
sys.exit()
else:
print ('LP static data retrieved')
 
#create plot