pytuflow.NCGrid.surface

Contents

pytuflow.NCGrid.surface#

NCGrid.surface(data_type=None, time=0, to_vertex=False, coord_scope='global', direction_to_vector=False, direction_convention='arithmetic')#

Returns the value for every cell/vertex at the specified time.

Parameters:
  • data_type (str, optional) – The data type to extract the surface data for.

  • time (TimeLike, optional) – The time to extract the surface data for.

  • to_vertex (bool, optional) – Whether to interpolate the cell data to vertex data. Values are interpolated using a bilnear approach.

  • coord_scope (str, optional) –

    The coordinate scope for the output coordinates. Options are:

    • "global" (default) - coordinates are unchanged from the input data (i.e. easting/northing or lon/lat)

    • "local" - coordinates are transformed to a local Cartesian coordinate system and the origin is moved to the centre of the grid extent. This can be useful for visualisation purposes, especially when converting into 3D formats for viewing in programs like Blender, Unreal Engine, etc

  • direction_to_vector (bool, optional) – Whether to convert direction data to vector data. Only applicable if the data type is a direction type, e.g. "velocity direction".

  • direction_convention (str, optional) –

    The convention used for direction data. Only required converting direction to vector or interpolating direction to vertices. Options are:

    • "arithmetic" (default) - direction is measured anticlockwise from the positive x-axis (east)

    • "nautical" - direction is measured clockwise from the positive y-axis (north)

Returns:

The surface data as a DataFrame with columns for the coordinates, value(s), and active mask.

Return type:

pd.DataFrame

Examples

>>> grid = ... # Assume grid is a loaded Grid result
>>> df = mesh.surface('water level', 1.5)
               x            y      value  active
0     292946.050  6177594.102  53.490948   False
1     292943.773  6177584.365  53.665874   False
2     292934.036  6177586.643  53.753918   False
3     292936.313  6177596.380  53.582664   False
4     292948.328  6177603.839  53.198586   False
...          ...          ...        ...     ...
5356  293571.392  6178423.468  43.893784   False
5357  293581.129  6178421.190  44.085411   False
5358  293590.866  6178418.913  44.279270   False
5359  293600.603  6178416.635  44.473816   False
5360  293610.340  6178414.357  44.671116   False