PyTuflow: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
Ellis Symons (talk | contribs) No edit summary |
|||
| (122 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
=Introduction= |
|||
=Class: ResData= |
|||
PyTUFLOW is a library that acts as an API for your TUFLOW model. It allows easy interaction with the model results, contains a number of useful utilities for building TUFLOW models, and contains some useful parsers for files within the TUFLOW eco-system. |
|||
==Latest Documentation== |
|||
Class for TUFLOW time series results. |
|||
The PyTUFLOW documentation has moved to a new location: <u>[https://docs.tuflow.com/pytuflow/ PyTUFLOW Documentation]</u>. |
|||
The previous PyTUFLOW API has been deprecated and the wiki documentation has been archived. However, if needed, the archived documentation can still be accessed via the link in the section below. |
|||
Initialised as an empty object, or with results with a *.tpc in TUFLOW 2016 release and later or *.info in TUFLOW 2013 release. |
|||
==Archive Documentation== |
|||
<pre> |
|||
Guidance for earlier version of PyTuflow can be accessed via the following link: <u>[[PyTuflow_Archive| PyTuflow_Archive]]</u>. |
|||
import pytuflow as tu |
|||
<br> |
|||
{{Tips Navigation |
|||
res = tu.ResData() # initialising as an empty object |
|||
|uplink=[[Main_Page| Back to Wiki Main Page]] |
|||
}} |
|||
# or |
|||
res = tu.ResData('M01_5m_001.tpc') # initialising with results |
|||
</pre> |
|||
'''Methods''' |
|||
{|class="wikitable" style="text-align: left;" |
|||
|! style="background-color:#005581; font-weight:bold; color:white" width=20%| Method |
|||
|! style="background-color:#005581; font-weight:bold; color:white;" width=30%|Description |
|||
|! style="background-color:#005581; font-weight:bold; color:white;" width=25%|Returns |
|||
|- |
|||
|rowspan='1' style='text-align: left'|<b>channelConnectionCount (</b> ''str'' Node ID <b>)</b> |
|||
|rowspan='1'|Returns the number of channels connected to a given node |
|||
|''int'' Count |
|||
|- |
|||
|rowspan='1'|<b>channelConnections (</b> ''str'' Node ID <b>)</b> |
|||
|rowspan='1'|Returns a list of the channels connected to a given node |
|||
|''list'' Channel IDs |
|||
|- |
|||
|rowspan='1'|<b>channelCount (</b> ''str'' Node ID <b>)</b> |
|||
|rowspan='1'|Returns the total number of channels in results |
|||
|''int'' Count |
|||
|- |
|||
|rowspan='1'|<b>channelResultTypes ()</b> |
|||
|rowspan='1'|Returns a list of all the available result types for channels |
|||
|list of Result Types |
|||
|- |
|||
|rowspan='1'|<b>channels ()</b> |
|||
|rowspan='1'|Returns a list of all the channels in the results |
|||
|''list'' Channel IDs |
|||
|- |
|||
|rowspan='1'|<b>channelsDownstream (</b> ''str'' Node ID <b>)</b> |
|||
|rowspan='1'|Returns a list of all the channels downstream of a given node |
|||
|''list'' Channel IDs |
|||
|- |
|||
|rowspan='1'|<b>channelsUpstream (</b> ''str'' Node ID <b>)</b> |
|||
|rowspan='1'|Returns a list of all the channels upstream of a given node |
|||
|''list'' Channel IDs |
|||
|- |
|||
|rowspan='1'|<b>format ()</b> |
|||
|rowspan='1'|Returns the result format i.e. '2013' or '2016' |
|||
|''str'' Format |
|||
|- |
|||
|rowspan='2'|<b>getAdverseGradients ()</b> |
|||
|rowspan='2'|Returns locations of any adverse water level or energy level (if result type available) gradients in long profile. Note getLongProfileData method must be called prior to calling this method |
|||
|''tuple'' Adverse Water Level Gradient Locations ( ''list'' x data, ''list'' y data ) |
|||
|- |
|||
|''tuple'' Adverse Energy Level Gradient Locations ( ''list'' x data, ''list'' y data ) |
|||
|- |
|||
|rowspan='3'|<b>getLongProfileData (</b> ''float'' Timestep, ''str'' Result Type, ''str'' Channel ID, '[optional] ''str'' 2nd Channel ID <b>)</b> |
|||
|rowspan='3'|Returns long profile data from a given channel to another channel. If no second channel is specified will continue until no further channels downstream |
|||
|''bool'' Error |
|||
|- |
|||
|''str'' Message |
|||
|- |
|||
|''tuple'' Profile Data ( ''list'' x values, ''list'' y values ) |
|||
|- |
|||
|rowspan='2'|<b>getLongProfileTimeOfMax ()</b> |
|||
|rowspan='2'|Returns the time of maximum water level along the current profile. Note getLongProfileData method must be called prior to calling this method |
|||
|''list'' x values |
|||
|- |
|||
|''list'' y values |
|||
|- |
|||
|rowspan='1'|<b>getPipes ()</b> |
|||
|rowspan='1'|Returns any pipe or culvert data in the current profile. Note getLongProfileData method must be called prior to calling this method |
|||
|''list'' pipes [ ''list'' pipe vertexes [ ''tuple'' vertex ( x point, y point ) ] ] |
|||
|- |
|||
|rowspan='3'|<b>getTimeSeriesData (</b> ''str'' Element, ''str'' Result Type, [optional] ''str'' domain <b>)</b> |
|||
|rowspan='3'|Returns time series data for the given element (1D node, 1D channel, 2D PO, RL) for a 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 |
|||
|- |
|||
|''str'' Message |
|||
|- |
|||
|''tuple'' time series data ( ''list'' x data, ''list'' y data ) |
|||
|- |
|||
|rowspan='2'|<b>load (</b> ''str'' filepath <b>)</b> |
|||
|rowspan='2'|Loads result file. File formats are *.tpc for TUFLOW release 2016 and later, or *.info for TUFLOW release 2013 |
|||
|''bool'' Error |
|||
|- |
|||
|''str'' Message |
|||
|- |
|||
|rowspan='1'|<b>longProfileResultTypes ()</b> |
|||
|rowspan='1'|Returns list of available long profile result types |
|||
|''list'' Result Types |
|||
|- |
|||
|rowspan='3'|<b>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 |
|||
|- |
|||
|''str'' Message |
|||
|- |
|||
|''float'' Maximum Value |
|||
|- |
|||
|rowspan='3'|<b>maximumTimestepChange (</b> ''str'' Element, ''str'' Result Type, [optional] ''str'' Domain <b>)</b> |
|||
|rowspan='3'|Returns the maximum change in result value in one timestep for the given element (RL types supported only) 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 |
|||
|- |
|||
|''str'' Message |
|||
|- |
|||
|''float'' Maximum Value |
|||
|- |
|||
|rowspan='3'|<b>name ()</b> |
|||
|rowspan='3'|Returns the name of the result |
|||
|''str'' Name |
|||
|- |
|||
|} |
|||
Latest revision as of 12:55, 19 December 2025
Introduction
PyTUFLOW is a library that acts as an API for your TUFLOW model. It allows easy interaction with the model results, contains a number of useful utilities for building TUFLOW models, and contains some useful parsers for files within the TUFLOW eco-system.
Latest Documentation
The PyTUFLOW documentation has moved to a new location: PyTUFLOW Documentation.
The previous PyTUFLOW API has been deprecated and the wiki documentation has been archived. However, if needed, the archived documentation can still be accessed via the link in the section below.
Archive Documentation
Guidance for earlier version of PyTuflow can be accessed via the following link: PyTuflow_Archive.
| Up |
|---|