The current code for DEM clamping in general does not work. For example, running example_local.py with x- and y-radii of 200 m for the grid (which places many stations outside DEM extent) does not raise as many "no DEM data found" warnings as expected. The current approach finds the nearest neighboring DEM point to the station, even if that's really far away.
This implementation lets xarray do the work. The method=nearest means nearest neighbor. tolerance=dem.spacing prevents the selection of a grid point that's more than a grid node away, i.e. outside of the DEM extent.
I've tested this on the local example with lots of grid sizes and it seems to work as expected. @davidfee5 can you test as well please?
The current code for DEM clamping in general does not work. For example, running
example_local.py
with x- and y-radii of 200 m for the grid (which places many stations outside DEM extent) does not raise as many "no DEM data found" warnings as expected. The current approach finds the nearest neighboring DEM point to the station, even if that's really far away.This implementation lets xarray do the work. The
method=nearest
means nearest neighbor.tolerance=dem.spacing
prevents the selection of a grid point that's more than a grid node away, i.e. outside of the DEM extent.I've tested this on the local example with lots of grid sizes and it seems to work as expected. @davidfee5 can you test as well please?