geopfa.extrapolation.prepare_slice

prepare_slice(gdf, *, value_col, z_value=None, z_tol=1e-06)[source]

Prepare a tidy slice of (x, y, value) for an optional z-level filter.

Parameters:
  • gdf (geopandas.GeoDataFrame) – Input GeoDataFrame containing either explicit x/y columns or a geometry column with Point coordinates. May also contain a z column if filtering by height is required.

  • value_col (str) – Name of the column whose values will be extracted and renamed to value.

  • z_value (float or None, optional) – If provided, only rows satisfying |z - z_value| <= z_tol are kept.

  • z_tol (float, optional) – Absolute tolerance for matching z-values.

Returns:

pandas.DataFrame – A tidy DataFrame with columns ['x', 'y', 'value'].

Raises:

ValueError – If z filtering is requested but the GeoDataFrame lacks a z column. If neither explicit x/y nor geometry is present.