pytuflow.TPC

Contents

pytuflow.TPC#

class TPC(fpath)#

Bases: INFO, ITimeSeries2D

Class to handle the standard TUFLOW Time Series result file (.tpc).

Supports:

  • 1D, 2D, and Reporting Location (RL) results.

  • Supports varying time indexes between results e.g. 1D results can have a different output interval than 2D results. It also supports varying time indexes within a single domain e.g. 2d_po results where one location has a different temporal resolution than another location. This is not something that TUFLOW Classic/HPC supports, however it is something that can occur in TUFLOW FV.

  • Supports duplicate IDs across domains e.g. a 1D node called test, a PO point called test, and an RL point called test - these can all have the same ID with a Water Level result attached.

The TPC class will only load basic properties on initialisation. These are typically properties that are easy to obtain from the file without having to load any of the time-series results. Once a method requiring more detailed information is called, the full results will be loaded. This makes the TPC class very cheap to initialise.

Parameters:

fpath (PathLike) – The path to the output (.tpc) file.

Raises:

ResultTypeError – Raises pytuflow.results.ResultTypeError if the file does not look like a TPC file.

Examples

Loading a .tpc file:

>>> from pytuflow import TPC
>>> res = TPC('path/to/file.tpc')

Querying all the available 2d_po data types:

>>> res.data_types('po')
['flow into region', 'volume', 'average water level', 'water level', 'velocity']

Querying all the available 1D channel IDs

>>> res.ids('channel')
['FC01.1_R', 'FC01.2_R', 'FC04.1_C']

Extracting the time-series information for a given channel and data type:

>>> res.time_series('FC01.1_R', 'flow')
time      channel/flow/FC01.1_R
0.000000                  0.000
0.016667                  0.000
0.033333                  0.000
0.050000                  0.000
0.066667                  0.000
...                         ...
2.933333                  3.806
2.950000                  3.600
2.966667                  3.400
2.983334                  3.214
3.000000                  3.038

For more examples, see the documentation for the individual methods.

__init__(fpath)#
Parameters:

fpath (Path | str)

Methods

curtain

Not supported for TPC results.

data_types

Returns all the available data types (result types) for the output given the filter.

ids

Returns all the available IDs for the output.

maximum

Returns a dataframe containing the maximum values for the given data types.

profile

Not supported for TPC results.

section

Returns a long plot for the given location and data types at the given time.

time_series

Returns a time series dataframe for the given location(s) and data type(s).

times

Returns all the available times for the output.

Attributes

ATTRIBUTE_TYPES

DOMAIN_TYPES

GEOMETRY_TYPES

ID_COLUMNS

po_line_count

po_point_count

po_poly_count

format

format of the results - options are 'CSV' or 'NC'.

fpath

The path to the source output file.

units

The unit system used in the output file.

oned_objs

Information on all 1D output objects.

node_count

Number of nodes

channel_count

Number of channels

name

The result name

reference_time

The reference time for the output

po_objs

PO/2D output objects.

rl_objs

RL output objects.

rl_point_count

Number of reporting location points

rl_line_count

Number of reporting location lines

rl_poly_count

Number of reporting location polys