pytuflow.CATCHJson.profile

pytuflow.CATCHJson.profile#

CATCHJson.profile(locations, data_types, time, interpolation='stepped')#

Extracts vertical profile data for the given locations and data types.

The locations can be a single point in the form of a tuple (x, y) or in the Well Known Text (WKT) format. It can also be a list of point or a dictionary of points where the key will be used in the column name in the resulting DataFrame.

The location can also be a GIS point file e.g. Shapefile or GPKG. GPKG’s should follow the TUFLOW convention if specifying the layer name within the database database.gpkg >> layer. If the GIS layer has a field called name or label then this will be used as the column name in the resulting DataFrame.

The returned DataFrame will use multi-index columns as the data is not guaranteed to have the same index. The level 1 index will be the label, and the level 2 index will be the data type. The elevation will always be the first column within the level 2 index.

Parameters:
  • locations (Point | list[Point] | dict[str, Point] | PathLike) – The location to extract the time series data for.

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

  • time (TimeLike) – The time to extract the time series data for.

  • interpolation (str, optional) – The interpolation method to use. Options are ‘stepped’ or ‘linear’. Linear interpolation should not be used for 2D results.

Returns:

The time series data.

Return type:

pd.DataFrame

Examples

Get The profile for a given point defined in a shapefile:

>>> res = ... # Assume res is a loaded CATCHJson object
>>> res.profile('path/to/shapefile.shp', 'velocity', 1.5)
               pnt1
  elevation  velocity
0       0.0  0.282843
1       0.5  0.282843
2       0.5  0.424264
3       1.0  0.424264