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.
return_indices (bool) – Whether to return the extracted indices only.
random_state (int | Generator | None) – Random state or seed number.
- Return type:
ndarray[tuple[Any, ...], dtype[Union[floating[Any], integer[Any]]]] | tuple[ndarray[tuple[Any, ...], dtype[Union[floating[Any], integer[Any]]]], ...]
- Returns:
Array of sampled valid values, or array of sampled indices.