wradlib.georef.raster.snap_resolution

Contents

wradlib.georef.raster.snap_resolution#

wradlib.georef.raster.snap_resolution(extent, target)[source]#

Snap an integer resolution so it evenly divides the extent, staying close to the target.

This function finds the closest integer resolution that divides the given extent exactly, while minimizing the difference from the desired target resolution.

Parameters:
  • extent (int) – Total extent along one axis (e.g., width or height in arcseconds or pixels).

  • target (int) – Desired resolution (size of each cell), must be a positive integer.

Returns:

int – Snapped resolution that evenly divides the extent and is closest to the target.