hydromodpy.data.common.geo_helpers#

Spatial helpers: bbox, haversine, nearest station, mask filtering.

Functions

bbox_contains(outer, inner)

True if outer bbox fully contains inner.

bbox_hash(bbox)

Short deterministic hash of a bounding box for filenames.

expand_bbox(bbox, radius_km)

Expand bbox by radius_km in all directions (approximate, WGS84).

filter_locations_by_bbox(locations, bbox)

Keep locations inside bbox.

filter_locations_by_geometry(locations, ...)

Keep locations that fall inside a shapely geometry (spatial join).

geometry_to_bbox(geometry)

Extract (xmin, ymin, xmax, ymax) from a shapely geometry.

haversine_km(lon1, lat1, lon2, lat2)

Great-circle distance in km (WGS84).

load_mask_geometry(path)

Load a spatial mask from vector (SHP/GPKG/GeoJSON) or raster (TIF).

load_mask_geometry_wgs84(path)

Load a spatial mask and reproject to WGS84 (EPSG:4326).

nearest_location(x, y, locations, *[, ...])

Return closest location to (x, y).