diff --git a/CHANGELOG.md b/CHANGELOG.md index 07c497e74357af082d0142c43a2d37e2c039c8ea..8f7f78b07e86793ad4e952f14adf321be0bff3c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,5 +36,7 @@ release. ## Unreleased ### Changed -- Removed all `pyproj` calls from csm.py, abstracting them into the reprojection and pyproj.Transformer code inside utils.py. Updated the transformations to use the new pipeline style syntax to avoid deprecation warnings about old syntax.p +- Removed all `pyproj` calls from csm.py, abstracting them into the reprojection and pyproj.Transformer code inside utils.py. Updated the transformations to use the new pipeline style syntax to avoid deprecation warnings about old syntax. +### Fixed +- Added a check to `generate_ground_point` when a GeoDataset is used to raise a `ValueError` if the algorithm intersects a no data value in the passed DEM. This ensures that valid heights are used in the intersection computation. diff --git a/knoten/csm.py b/knoten/csm.py index ee703142c56d4cb9eb3260429c0c932f7a8b83e6..d951b1fa270511b5fdee051be0c01c30ad1218b6 100644 --- a/knoten/csm.py +++ b/knoten/csm.py @@ -170,7 +170,9 @@ def _(dem, image_pt, camera, max_its = 20, tolerance = 0.001): px, py = dem.latlon_to_pixel(lat, lon) height = dem.read_array(1, [px, py, 1, 1])[0][0] - + if height == dem.no_data_value: + raise ValueError(f'No DEM height at {lat}, {lon}') + next_intersection = camera.imageToGround(image_pt, float(height)) dist = max(abs(intersection.x - next_intersection.x), abs(intersection.y - next_intersection.y),