Skip to content

Commit

Permalink
Linter updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Jan 4, 2025
1 parent ad3c095 commit eb4220d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions maps4fs/generator/dtm/srtm.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,15 @@ def get_numpy(self) -> np.ndarray:

data = self.extract_roi(decompressed_tile_path)

if self.user_settings.normalize_data and self.user_settings.expected_maximum_height:
if (
self.user_settings.normalize_data # type: ignore
and self.user_settings.expected_maximum_height # type: ignore
):
try:
data = self.normalize_dem(data, self.user_settings.expected_maximum_height)
except Exception as e:
data = self.normalize_dem(
data, self.user_settings.expected_maximum_height # type: ignore
)
except Exception as e: # pylint: disable=W0718
self.logger.error(
"Failed to normalize DEM data. Error: %s. Using original data.", e
)
Expand All @@ -122,7 +127,7 @@ def normalize_dem(self, data: np.ndarray, max_height: int) -> np.ndarray:
scaling_factor = max_dev / max_height if max_dev < max_height else 1
adjusted_max_height = int(65535 * scaling_factor)
self.logger.debug(
"Maximum deviation: %s. Scaling factor: %s. " "Adjusted max height: %s.",
"Maximum deviation: %s. Scaling factor: %s. Adjusted max height: %s.",
max_dev,
scaling_factor,
adjusted_max_height,
Expand Down

0 comments on commit eb4220d

Please sign in to comment.