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.