This tool can be used to create a random sample of grid cells. The user specifies the base raster file, which is used to determine the grid dimensions and georeference information for the output raster, and the number of sample random samples (n). The output grid will contain n non-zero grid cells, randomly distributed throughout the raster grid, and a background value of zero. This tool is useful when performing statistical analyses on raster images when you wish to obtain a random sample of data.
Only valid, non-nodata, cells in the base raster will be sampled.
def random_sample(self, base_raster: Raster = None, num_samples: int = 1000) -> Raster: ...