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 theTPC
class which will load all domains automatically (i.e.GPKG1D
,GPKG2D
,GPKGRL
). Note: theswmm_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 theGPKG1D
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 aGPKG1D
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
Not supported for
GPKG1D
results.Returns all the available data types (result types) for the given filter.
Returns all the available IDs for the given filter.
Returns a DataFrame containing the maximum values for the given data types.
Not supported for
GPKG1D
results.Returns a long plot for the given location and data types at the given time.
Returns a time-series DataFrame for the given location(s) and data type(s).
Returns all the available times for the given filter.
Attributes
the format version
The path to the source output file.
The unit system used in the output file.
Information on all 1D output objects.
Number of nodes
Number of channels
The result name
The reference time for the output