geoutils.PointCloud.subsample#
- PointCloud.subsample(subsample, return_indices=False, random_state=None, *, mask=None)#
Randomly sample finite point cloud values allowed by mask, without replacement.
- Overloads:
self, subsample (int | float), return_indices (Literal[False]), random_state (int | np.random.Generator | None), mask (RasterLike | PointCloudLike | VectorLike | ArrayLike | None) → NDArrayNum
self, subsample (int | float), return_indices (Literal[True]), random_state (int | np.random.Generator | None), mask (RasterLike | PointCloudLike | VectorLike | ArrayLike | None) → tuple[NDArrayNum, …]
self, subsample (float | int), return_indices (bool), random_state (int | np.random.Generator | None), mask (RasterLike | PointCloudLike | VectorLike | ArrayLike | None) → NDArrayNum | tuple[NDArrayNum, …]
- Parameters:
subsample (float | int) – Fraction of eligible finite values to sample when at most 1, otherwise the maximum number of values. The mask is applied before calculating this size.
return_indices (bool) – Whether to return sampled row positions instead of values.
random_state (int | np.random.Generator | None) – Random generator or seed used to make sampling reproducible.
mask (RasterLike | PointCloudLike | VectorLike | ArrayLike | None) – Eligible points: True in a boolean array or spatial mask, or inside vector geometries. Arrays must have one entry per point. Point masks must follow the same ordered coordinates; raster masks use nearest interpolation. Point and raster masks must share this point cloud’s CRS. Missing mask entries are excluded (e.g. mask=points.data > 0).
- Returns:
One-dimensional NumPy values with the source dtype, or a one-element tuple of indices into the original row order. These indices are positions, independent of any dataframe index labels.