pytuflow.FMTS

pytuflow.FMTS#

class FMTS(fpath, dat=None, gxy=None)#

Bases: INFO

Class for handling 1D Flood Modeller time series outputs.

The accepted result formats are:

  • .zzn (requires the accompanying .zzl file)

  • .csv exported from the Flood Modeller GUI.

  • .csv exported using the Flood Modeller API Python library

Optional DAT and GXY files can be provided to add connectivity and spatial information. The DAT file is preferenced over GXY for connectivity information as channel direction around JUNCTION units can be ambiguous in the GXY. Spatial information contained in the DAT file is never used and a GXY file is required for spatial information.

Parameters:
  • fpath (PathLike) – The path to the flood modeller result file(s). Multiple files can be passed if not using the .zzn result format. Multiple files are required to be for different result types for the same event, and not for multiple events.

  • dat (PathLike, optional) – Path to the DAT file. Required for connectivity information (i.e. required for section() plotting).

  • gxy (PathLike, optional) – Path to the GXY file. Required for spatial coordinates.

Raises:

ResultTypeError – Raises pytuflow.results.ResultTypeError if the file does not look like a time series FMTS file, or if the result file(s) do not contain the expected data e.g. if multiple files are provided, but they belong to different models or different events.

Examples

Load results without any reference to the DAT or GXY files - this will not support section plotting and won’t contain spatial information:

>>> from pytuflow import FMTS
>>> res = FMTS('path/to/result.zzn')

Load results with a DAT file so that connectivity information is available for section plotting:

>>> res = FMTS('path/to/result.zzn', dat='path/to/result.dat')

Load results with a GXY so spatial information is available - a GXY can also be used for connectivity without a DAT file, however less contextual information is contained in the GXY and channel directions around JUNCTION nodes can be ambiguous. The DAT file is recommended, and is required for plotting pipes in the section plot:

>>> res = FMTS('path/to/result.zzn', dat='path/to/result.dat', gxy='path/to/result.gxy')

Return all node IDs - Only nodes that contain results will be return by default and will be returned with just the node name. To return all nodes with unique IDs (TYPE_SUBTYPE_NAME), use the filter_by parameter:

>>> res.ids()
['FC01.36', 'FC01.35', 'FC01.351cu',... 'FC02', 'ds2_S', 'FC01']
>>> res.ids('node')
['QTBDY__FC01', 'JUNCTION_OPEN_FC01', 'RIVER_SECTION_FC01.40',... 'JUNCTION_OPEN_ds2', 'SPILL__ds2_S']

Return available result types:

>>> res.data_types()
['flow', 'water level', 'froude', 'velocity', 'mode', 'state']

Return the water level time series for FC04368:

>>> res.time_series('FC01.35', 'stage')
time      node/stage/FC01.35
0.000000           44.803001
0.083333           45.329525
0.166667           45.717449
0.250000           45.766171
0.333333           45.776295
...                      ...
2.666667           45.778118
2.750000           45.778111
2.833333           45.778091
2.916667           45.778099
3.000000           45.778137

Return th maximum water level along a section between FC01.31 and FC01.25:

>>> res.section(['FC01.31', 'FC01.25'], 'max stage', 0)
    branch_id channel      node   offset   max stage
0           0      36   FC01.31    0.000   43.308998
7           0      36   FC01.30   30.758   43.060001
1           0      37   FC01.30   30.758   43.060001
8           0      37   FC01.29   62.745   42.870998
2           0      38   FC01.29   62.745   42.870998
9           0      38  FC01.28B  112.141   42.409000
3           0      39  FC01.28B  112.141   42.409000
10          0      39   FC01.28  146.031   42.105000
4           0      40   FC01.28  146.031   42.105000
11          0      40   FC01.27  187.033   41.692001
5           0      41   FC01.27  187.033   41.692001
12          0      41   FC01.26  200.826   41.493999
6           0      42   FC01.26  200.826   41.493999
13          0      42   FC01.25  233.658   41.021000
__init__(fpath, dat=None, gxy=None)#
Parameters:
  • fpath (Path | str | list[Path | str])

  • dat (Path | str)

  • gxy (Path | str)

Methods

curtain

Not supported for FMTS 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 given filter.

maximum

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

profile

Not supported for FMTS 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 given filter.

Attributes

ATTRIBUTE_TYPES

DOMAIN_TYPES

GEOMETRY_TYPES

ID_COLUMNS

dat_fpath

Path to the DAT file if one was provided

gxy_fpath

Path to the GXY file if one was provided

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