pytuflow.TPC.maximum

Contents

pytuflow.TPC.maximum#

TPC.maximum(locations, data_types, time_fmt='relative')#

Returns a dataframe containing the maximum values for the given data types. The returned dataframe will include time of maximum results as well.

It’s possible to pass in a well known shorthand for the data type e.g. ‘q’ for flow.

The location can be an ID or filter string, e.g. channel to extract the maximum values for all channels. An ID can be used alongside a filter string since there can be duplicate IDs across domains e.g. ‘test/channel’ - where ‘test’ is the name and ‘channel’ is an additional filter. Note, the order does not matter, but it doesn’t work very well if your ID has a ‘/’ or has the same name as a filter string (e.g. calling a po line ‘line’). For the TPC result class, the following filters are available:

Domain filters:

  • 1d

  • 2d (or po)

  • rl (or 0d)

Geometry filters:

  • node

  • channel

  • point - (for 2d and rl domains only - use node for 1d domain)

  • line - (for 2d and rl domains only - use channel for 1d domain)

  • polygon (or region)

Combine filters:

  • [filter1]/[filter2]/...: (use / to delim).

The returned DataFrame will have an index column corresponding to the location ids, and the columns will be in the format obj/data_type/[max|tmax], e.g. channel/flow/max, channel/flow/tmax.

Parameters:
  • locations (str | list[str]) – The location to extract the maximum values for.

  • data_types (str | list[str]) – The data types to extract the maximum values for.

  • time_fmt (str, optional) – The format for the time of max result. Options are relative or absolute

Returns:

The maximum, and time of maximum values

Return type:

pd.DataFrame

Examples

Extracting the maximum flow for a given channel:

>>> res = TPC('/path/to/result.tpc')
>>> res.maximum('ds1', 'flow')
     channel/flow/max  channel/flow/tmax
ds1            59.423           1.383333

Extracting all the maximum results for a given channel:

>>> res.maximum(['ds1'], None)
     channel/Flow/max  ...  channel/Velocity/tmax
ds1            59.423  ...               0.716667

Extracting the maximum flow for all channels:

>>> res.maximum(None, 'flow')
         channel/flow/max  channel/flow/tmax
ds1                 59.423           1.383333
ds2                 88.177           1.400000
...                  ...              ...
FC04.1_C             9.530           1.316667
FC_weir1            67.995           0.966667