pytuflow.INFO.time_series#
- INFO.time_series(locations, data_types, time_fmt='relative', *args, **kwargs)#
Returns a time-series DataFrame for the given location(s) and data type(s).
It’s possible to pass in a well known shorthand for the data type e.g.
q
forflow
.The location can also be a filter string, e.g.
channel
to extract the time-series values for all channels. The following filters are available for theINFO
class:None
: returns all locations1d
: returns all locations (same as passing in None for locations)node
channel
The returned column names will be in the format
obj/data_type/location
e.g.channel/flow/FC01.1_R
. Thedata_type
name in the column heading will be identical to the data type name passed into the function e.g. ifh
is used instead ofwater level
, then the return will benode/h/FC01.1_R.1
.- Parameters:
locations (str | list[str]) – The location to extract the time series data for. If
None
is passed in, all locations will be returned for the given data_types.data_types (str | list[str]) – The data type to extract the time series data for. If
None
is passed in, all data types will be returned for the given locations.time_fmt (str, optional) – The format for the time column. Options are
relative
orabsolute
.
- Returns:
The time series data.
- Return type:
pd.DataFrame
Examples
Extracting flow for a given channel.
>>> res = ... # Assume res is loaded result class >>> res.time_series('ds1', 'q') Time (h) channel/q/ds1 0.000000 0.000 0.016667 0.000 ... ... 2.983334 8.670 3.000000 8.391
Extracting all data types for a given location
>>> res.time_series('ds1', None) Time (h) channel/Flow/ds1 channel/Velocity/ds1 0.000000 0.000 0.000 0.016667 0.000 0.000 ... ... ... 2.983334 8.670 1.348 3.000000 8.391 1.333
Extracting all flow results
>>> res.time_series(None, 'flow') Time (h) channel/flow/ds1 ... channel/flow/FC_weir1 0.000000 0.000 ... 0.0 0.016667 0.000 ... 0.0 ... ... ... ... 2.983334 8.670 ... 0.0 3.000000 8.391 ... 0.0