Subsampling

Return to Homepage

gval.subsampling.subsampling.get_subsample_percent(sampling_df: GeoDataFrame, og_data: DataArray | Dataset) float

Get percent of original map subsampled by geometry

Parameters:
  • sampling_df (gpd.GeoDataFrame) – Dataframe with subsample geometries and options

  • og_data (Union[xr.DataArray, xr.Dataset]) – Original nodata count

Returns:

Percentage of original data the sample covers

Return type:

float

gval.subsampling.subsampling.subsample(candidate: DataArray | Dataset, benchmark: DataArray | Dataset, subsampling_df: GeoDataFrame | None = None) List[Tuple[DataArray, DataArray] | Tuple[Dataset, Dataset]]

Method to subsample a candidate and benchmark map

Parameters:
  • candidate (Union[xr.DataArray, xr.Dataset]) – Candidate map for evaluating

  • benchmark (Union[xr.DataArray, xr.Dataset]) – Benchmark map for

  • subsampling_df (Optional[gpd.GeoDataFrame], default = None) – Dataframe with columns regarding the geometry and method to subsample

Raises:

ValueError – Sampling_df crs cannot be none

Returns:

Subsampled candidate and benchmark maps or a list of subsampled candidate and benchmark maps

Return type:

Union[List[Union[Tuple[xr.DataArray, xr.DataArray], Tuple[xr.Dataset, xr.Dataset]]]]