Skip to content

Commit

Permalink
Logging update.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Nov 22, 2024
1 parent d2e9080 commit 0027fad
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
26 changes: 24 additions & 2 deletions maps4fs/generator/dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ def process(self) -> None:
"Gaussion blur applied to DEM data with kernel size %s.",
self.blur_radius,
)
self.logger.debug(
"DEM data was blurred. Shape: %s, dtype: %s. Min: %s, max: %s.",
resampled_data.shape,
resampled_data.dtype,
resampled_data.min(),
resampled_data.max(),
)

cv2.imwrite(self._dem_path, resampled_data)
self.logger.debug("DEM data was saved to %s.", self._dem_path)
Expand Down Expand Up @@ -244,13 +251,28 @@ def colored_preview(self) -> str:

self.logger.debug("Creating colored preview of DEM data in %s.", colored_dem_path)

dem_data = cv2.imread(self._dem_path, cv2.IMREAD_GRAYSCALE)
dem_data = cv2.imread(self._dem_path, cv2.IMREAD_UNCHANGED)

self.logger.debug(
"DEM data before normalization. Shape: %s, dtype: %s. Min: %s, max: %s.",
dem_data.shape,
dem_data.dtype,
dem_data.min(),
dem_data.max(),
)

# Create an empty array with the same shape and type as dem_data
# Create an empty array with the same shape and type as dem_data.
dem_data_normalized = np.empty_like(dem_data)

# Normalize the DEM data to the range [0, 255]
cv2.normalize(dem_data, dem_data_normalized, 0, 255, cv2.NORM_MINMAX)
self.logger.debug(
"DEM data after normalization. Shape: %s, dtype: %s. Min: %s, max: %s.",
dem_data_normalized.shape,
dem_data_normalized.dtype,
dem_data_normalized.min(),
dem_data_normalized.max(),
)
dem_data_colored = cv2.applyColorMap(dem_data_normalized, cv2.COLORMAP_JET)

cv2.imwrite(colored_dem_path, dem_data_colored)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "maps4fs"
version = "0.7.6"
version = "0.7.7"
description = "Generate map templates for Farming Simulator from real places."
authors = [{name = "iwatkot", email = "iwatkot@gmail.com"}]
license = {text = "MIT License"}
Expand Down
2 changes: 1 addition & 1 deletion webui/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def add_widgets(self) -> None:
st.write("Enter latitude and longitude of the center point of the map:")
self.lat_lon_input = st.text_input(
"Latitude and Longitude",
"45.26, 19.80",
"45.28571409289627, 20.237433441210115",
key="lat_lon",
label_visibility="collapsed",
)
Expand Down

0 comments on commit 0027fad

Please sign in to comment.