Skip to content

spatially_stratified_sampling

Spatially stratified sampling partitions the data into a grid and randomly samples each partition independently.

spatially_stratified_sample(dataframe, fraction, partition_count, geometry=None, seed=42)

Spatially stratified sampling of a DataFrame containing spatial data.

Parameters:

Name Type Description Default
dataframe DataFrame

DataFrame containing spatial data to be sampled. Must contain a geometry column.

required
fraction float

Sampling rate between 0 and 1

required
partition_count int

Number of partitions to divide the data into. If not a perfect square, the number of partitions in each dimension will be rounded to the nearest integer.

required
geometry Optional[str]

Column containing the geometry data. Default is "geometry"

None
seed int

Seed for sampling the data

42

Returns:

Type Description

the input DataFrame sampled down to the specified rate