⚠️ Our 0.1 release refactored several early-development functions for long-term stability, to update your code see here. ⚠️
Future changes will come with deprecation warnings! 🙂



Raster.subsample(subsample, return_indices=False, random_state=None)[source]#

Randomly sample the raster. Only valid values are considered.

  • 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 (RandomState | int | None) – Random state or seed number.

Return type:

ndarray[Any, dtype[Union[floating[Any], integer[Any]]]] | tuple[ndarray[Any, dtype[Union[floating[Any], integer[Any]]]], ...]


Array of sampled valid values, or array of sampled indices.