pytuflow.GPKG1D

pytuflow.GPKG1D#

class GPKG1D(fpath)#

Bases: GPKGBase, INFO

Class for handling 1D GeoPackage time series results (.gpkg - typically ending with _1D.gpkg or _swmm_ts.gpkg). The GPKG time series format is a specific format published by TUFLOW built on the GeoPackage standard.

This class can be used to initialise stand-alone GPKG result files (e.g. swmm_ts.gpkg results) however it is not required to be used if loading results via the TPC class which will load all domains automatically (i.e. GPKG1D, GPKG2D, GPKGRL). Note: the swmm_ts.gpkg is not referenced in the TPC file, so will always require to be initialised with this class.

The GPKG1D 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 GPKG1D class very cheap to initialise.

Parameters:

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

Raises:

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

Examples

Load a _swmm_ts.gpkg file:

>>> from pytuflow import GPKG1D
>>> res = GPKG1D('path/to/output_swmm_ts.gpkg')

Querying all the available data types:

>>> res.data_types()
['depth', 'water level', 'storage volume', 'lateral inflow', 'total inflow', 'flood losses', 'net lateral inflow',
'flow', 'channel depth', 'velocity', 'channel volume', 'channel capacity']

Querying all the available channel IDs:

>>> res.ids('channel')
['FC01.1_R', 'FC01.2_R', 'FC04.1_C', 'Pipe1', 'Pipe10', 'Pipe11', 'Pipe13', 'Pipe14', 'Pipe15', 'Pipe16', 'Pipe2',
'Pipe20', 'Pipe3', 'Pipe4', 'Pipe6', 'Pipe7', 'Pipe8', 'Pipe9']

Extracting time series data for a given channel and data type:

>>> res.time_series('Pipe1', 'flow')
time      channel/flow/Pipe1
0.000000            0.000000
0.083333            0.000000
0.166667            0.000000
0.250000            0.000000
0.333333            0.000038
...                      ...
2.666667            0.009748
2.750000            0.008384
2.833333            0.007280
2.916667            0.005999
3.000000            0.004331

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

__init__(fpath)#
Parameters:

fpath (Path | str)

Methods

connect

curtain

Not supported for GPKG1D results.

data_types

Returns all the available data types (result types) for the given 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 GPKG1D 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

format_version

the format version

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