curviriver.interpolation#

Interpolating point cloud values to a grid using Inverse Distance Weighting (IDW).

Module Contents#

curviriver.interpolation.idw_line_interpolation(point_cloud: geopandas.GeoDataFrame, xs_lines: geopandas.GeoDataFrame | geopandas.GeoSeries, value_col: str, centerline: shapely.LineString | None = None, pc_xsection: bool = False, search_radius_coeff: float = 3.0, grid_points: Literal[False] = False, parallel: bool = False) geopandas.GeoSeries[source]#
curviriver.interpolation.idw_line_interpolation(point_cloud: geopandas.GeoDataFrame, xs_lines: geopandas.GeoDataFrame | geopandas.GeoSeries, value_col: str, centerline: shapely.LineString | None = None, pc_xsection: bool = False, search_radius_coeff: float = 3.0, grid_points: Literal[True] = True, parallel: bool = False) geopandas.GeoDataFrame

Interpolate point cloud values to a grid using Inverse Distance Weighting (IDW).

Parameters:
  • point_cloud (geopandas.GeoDataFrame) – Point cloud with values to be interpolated. Using a projected CRS is highly recommended.

  • xs_lines (geopandas.GeoDataFrame or geopandas.GeoSeries) – Cross-section lines to which values will be interpolated. Using a projected CRS is highly recommended.

  • value_col (str) – Name of the column in point_cloud containing values to be interpolated.

  • centerline (shapely.LineString, optional) – Centerline of point_cloud convex hull. Required when pc_xsection=True.

  • pc_xsection (bool, optional) – Whether the point cloud is from surveys done perpendicular to the centerline, instead of many points along the centerline. Default is False.

  • search_radius_coeff (float, optional) – Coefficient to multiply the average distance between the closest and second closest points to estimate the search radius. Default is 3.

  • grid_points (bool, optional) – If True, the interpolated values will be returned as a GeoDataFrame with the grid points as geometries. Default is False.

  • parallel (bool, optional) – Whether to use parallel processing, defaults to False. For parallel processing, joblib package must be installed.

Returns:

geopandas.GeoSeries or geopandas.GeoDataFrame – If grid_points=False a GeoSeries of 3D line where the Z-coordinate is the interpolated value. If grid_points=True a GeoDataFrame of 2D points with a column called value_col containing the interpolated value.

curviriver.interpolation.idw_point_interpolation(point_cloud, grid_points, centerline=None, pc_xsection=False, search_radius_coeff=3.0, parallel=False)[source]#

Interpolate point cloud values to a grid using Inverse Distance Weighting (IDW).

Parameters:
  • point_cloud (numpy.ndarray) – Point cloud with values to be interpolated. The array must have 3 columns with the X, Y coordinates of the points as the first two columns and the values to be interpolated as the third column.

  • grid_points (numpy.ndarray) – Grid points to which values will be interpolated. The array must have 2 columns with the X, Y coordinates of the points. The coordinates must be in the same CRS as point_cloud.

  • centerline (shapely.LineString, optional) – Centerline of point_cloud convex hull. Required when pc_xsection=True.

  • pc_xsection (bool, optional) – Whether the point cloud is from surveys done perpendicular to the centerline, instead of many points along the centerline. Default is False.

  • search_radius_coeff (float, optional) – Coefficient to multiply the average distance between the closest and second closest points to estimate the search radius. Default is 3.

  • parallel (bool, optional) – Whether to use parallel processing, defaults to False. For parallel processing, joblib package must be installed.

Returns:

numpy.ndarray – Grid points with a third column containing the interpolated values.

Return type:

FloatArray

curviriver.interpolation.xs_hydraulics(line)[source]#

Compute cross-section hydraulics properties.

Parameters:

line (shapely.LineString) – Cross-section line with Z-coordinate.

Returns:

  • area (float) – Cross-sectional area.

  • preimeter (float) – Cross-sectional perimeter.

Return type:

tuple[float, float]