⚠️ 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! 🙂

geoutils.Raster.subsample

geoutils.Raster.subsample#

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

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 (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]]]], ...]

Returns:

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