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.GeoDataFrameorgeopandas.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 ofpoint_cloudconvex hull. Required whenpc_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 isFalse.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) – IfTrue, the interpolated values will be returned as a GeoDataFrame with the grid points as geometries. Default isFalse.parallel (
bool, optional) – Whether to use parallel processing, defaults toFalse. For parallel processing,joblibpackage must be installed.
- Returns:
geopandas.GeoSeriesorgeopandas.GeoDataFrame– Ifgrid_points=Falsea GeoSeries of 3D line where the Z-coordinate is the interpolated value. Ifgrid_points=Truea GeoDataFrame of 2D points with a column calledvalue_colcontaining 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 ofpoint_cloudconvex hull. Required whenpc_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 isFalse.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 toFalse. For parallel processing,joblibpackage must be installed.
- Returns:
numpy.ndarray– Grid points with a third column containing the interpolated values.- Return type:
FloatArray