From ebe6e2c81fdf507bf8051764aee72fe810125231 Mon Sep 17 00:00:00 2001 From: erblanm Date: Tue, 25 Jun 2024 15:21:53 +0200 Subject: [PATCH] Handle negative value of radius (#15) --- src/eolab/rastertools/hillshade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/eolab/rastertools/hillshade.py b/src/eolab/rastertools/hillshade.py index 10dc146..2e287a6 100644 --- a/src/eolab/rastertools/hillshade.py +++ b/src/eolab/rastertools/hillshade.py @@ -123,7 +123,7 @@ def process_file(self, inputfile: str) -> List[str]: wmax = np.maximum(wmax, np.nanmax(data)) if wmax is not None else np.nanmax(data) wmin = np.minimum(wmin, np.nanmin(data)) if wmin is not None else np.nanmin(data) delta = int((wmax - wmin) / self.resolution) - optimal_radius = int(delta / np.tan(np.radians(self.elevation))) + optimal_radius = abs(int(delta / np.tan(np.radians(self.elevation)))) if self.radius is None or optimal_radius <= self.radius: self._radius = optimal_radius