pytuflow.DAT.profile#
- DAT.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 points, or a dictionary of points where the key will be used in the column name in the resulting DataFrame.The
locations
argument can also be a single GIS file path e.g. Shapefile or GPKG (but any format supported by GDAL is also supported). GPKG’s should follow the TUFLOW convention if specifying the layer name within the databasedatabase.gpkg >> layer
. If the GIS layer has a field calledname
,label
, orID
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:
>>> mesh = ... # Assume mesh is a loaded Mesh result >>> mesh.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