gdf.pc.subsample() or PointCloud.subsample()#
- PointCloudBase.subsample(subsample, *, mask=None, random_state=None, as_array=False, return_indices=False, strategy='topk', force_output_to_memory=False, mp_config=None)[source]#
Randomly sample point rows allowed by mask, without replacement.
- Overloads:
subsample (
int|float), *, mask (RasterBase |DataArray|PointCloudBase|GeoDataFrame| VectorBase |ArrayLike|None) =None, random_state (int|Generator|None) =None, as_array (Literal[False]) =False, return_indices (Literal[False]) =False, strategy (Literal['sequential','topk']) ='topk', force_output_to_memory (bool) =False, mp_config (MultiprocConfig|None) =None→PointCloudBase|GeoDataFrame|DataArraysubsample (
int|float), *, mask (RasterBase |DataArray|PointCloudBase|GeoDataFrame| VectorBase |ArrayLike|None) =None, random_state (int|Generator|None) =None, as_array (Literal[True]), return_indices (Literal[False]) =False, strategy (Literal['sequential','topk']) ='topk', force_output_to_memory (bool) =False, mp_config (MultiprocConfig|None) =None→NDArray[floating[Any] |integer[Any]]subsample (
int|float), *, mask (RasterBase |DataArray|PointCloudBase|GeoDataFrame| VectorBase |ArrayLike|None) =None, random_state (int|Generator|None) =None, as_array (Literal[True]), return_indices (Literal[True]), strategy (Literal['sequential','topk']) ='topk', force_output_to_memory (bool) =False, mp_config (MultiprocConfig|None) =None→tuple[NDArray[floating[Any] |integer[Any]],...]subsample (
float|int), *, mask (RasterBase |DataArray|PointCloudBase|GeoDataFrame| VectorBase |ArrayLike|None) =None, random_state (int|Generator|None) =None, as_array (bool) =False, return_indices (bool) =False, strategy (Literal['sequential','topk']) ='topk', force_output_to_memory (bool) =False, mp_config (MultiprocConfig|None) =None→PointCloudBase|GeoDataFrame|DataArray|NDArray[floating[Any] |integer[Any]] |tuple[NDArray[floating[Any] |integer[Any]],...]
- Parameters:
subsample (
float|int) – Fraction (e.g. 0.1 for 10%) or maximum count (e.g. 10000) of eligible locations to use. A value of 1 keeps all locations.mask (geoutils.raster.base.RasterBase |
DataArray|PointCloudBase|GeoDataFrame| geoutils.vector.base.VectorBase |ArrayLike|None) – Mask of inlier points to consider: True in a boolean array or spatial mask, or inside vector geometries. Arrays must have the same length as the point cloud, point cloud masks must have the same ordered coordinates, and raster masks use nearest interpolation.random_state (
int|Generator|None) – Random generator or seed used to make sampling reproducible.as_array (
bool) – Whether to return an array with only sampled values or row indices, instead of a point cloud.return_indices (
bool) – Withas_array=True, whether to return sampled row indices instead of values.strategy (
Literal['sequential','topk']) – Random sampling strategy. “topk” keeps the same seeded sample across partitions and therefore gives a deterministic result whether chunked or in-memory; “sequential” draws in row order.force_output_to_memory (
bool) – Bypass automatic cutoff selection and return the complete output in memory.mp_config (
MultiprocConfig|None) – Point partition size and output file used by multiprocessing. Point output uses GeoPackage, LAS or LAZ; LAS/LAZ stores the main point value as elevation. Array output uses NumPy format when a sample exceeds one partition. Cannot be combined with Dask input.
- Returns:
A point cloud containing every selected row by default. With
as_array=True, returns one-dimensional values or a one-element tuple of positions into the original row order.