geoutils.Raster.subsample#
- Raster.subsample(subsample, return_indices=False, band=1, random_state=None, strategy='sequential', mp_config=None)#
- Overloads:
self, subsample (int | float), return_indices (Literal[False]), band (int), random_state (int | np.random.Generator | None), strategy (Literal[‘sequential’, ‘topk’]), mp_config (MultiprocConfig | None) → NDArrayNum
self, subsample (int | float), return_indices (Literal[True]), band (int), random_state (int | np.random.Generator | None), strategy (Literal[‘sequential’, ‘topk’]), mp_config (MultiprocConfig | None) → tuple[NDArrayNum, …]
self, subsample (float | int), return_indices (bool), band (int), random_state (int | np.random.Generator | None), strategy (Literal[‘sequential’, ‘topk’]), mp_config (MultiprocConfig | None) → NDArrayNum | tuple[NDArrayNum, …]
Randomly sample the raster. Only valid values are considered.
- Parameters:
subsample (
float|int) – Subsample size. If <= 1, a fraction of the total pixels to extract. If > 1, the number of pixels.band (
int) – Band to subsample. Use return_indices=True and indexing to subsample the same points over several bands.return_indices (
bool) – Whether to return the extracted indices only.random_state (
int|Generator|None) – Random state or seed number.
- Returns:
Array of sampled valid values, or array of sampled indices.