Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging update #161

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions maps4fs/generator/component/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def generate_obj_files(self) -> None:
If at least one DEM file is missing, the generation will be stopped at all.
"""
if not os.path.isfile(self.dem.dem_path):
self.logger.warning(
self.logger.error(
"DEM file not found, generation will be stopped: %s", self.dem.dem_path
)
return
Expand Down Expand Up @@ -436,7 +436,7 @@ def generate_water_resources_obj(self) -> None:

# Check if the image contains non-zero values.
if not np.any(plane_water):
self.logger.warning("Water resources image is empty, skipping water generation.")
self.logger.debug("Water resources image is empty, skipping water generation.")
return

dilated_plane_water = cv2.dilate(
Expand Down
6 changes: 3 additions & 3 deletions maps4fs/generator/component/grle.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ def overlay_fields(self, farmlands_np: np.ndarray) -> np.ndarray | None:
"""
fields_layer = self.map.get_texture_layer(by_usage="field")
if not fields_layer:
self.logger.warning("Fields layer not found in the texture component.")
self.logger.debug("Fields layer not found in the texture component.")
return None

fields_layer_path = fields_layer.get_preview_or_path(
self.game.weights_dir_path(self.map_directory)
)
if not fields_layer_path or not os.path.isfile(fields_layer_path):
self.logger.warning("Fields layer not found in the texture component.")
self.logger.debug("Fields layer not found in the texture component.")
return None
fields_np = cv2.imread(fields_layer_path)
# Resize fields_np to the same size as farmlands_np.
Expand All @@ -182,7 +182,7 @@ def _add_farmlands(self) -> None:

fields = self.get_infolayer_data(Parameters.TEXTURES, Parameters.FIELDS)
if not fields:
self.logger.warning("Fields data not found in textures info layer.")
self.logger.debug("Fields data not found in textures info layer.")
return
farmlands.extend(fields)

Expand Down
1 change: 0 additions & 1 deletion maps4fs/generator/dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ def _save_empty_dem(self, dem_output_resolution: tuple[int, int]) -> None:
"""Saves empty DEM file filled with zeros."""
dem_data = np.zeros(dem_output_resolution, dtype="uint16")
cv2.imwrite(self._dem_path, dem_data)
self.logger.warning("DEM data filled with zeros and saved to %s.", self._dem_path)

def info_sequence(self) -> dict[Any, Any] | None: # type: ignore
"""Returns the information sequence for the component. Must be implemented in the child
Expand Down
4 changes: 2 additions & 2 deletions maps4fs/generator/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,9 @@ def polygons_generator(
)

if not isinstance(padded_polygon, shapely.geometry.polygon.Polygon):
self.logger.warning("The padding value is too high, field will not padded.")
self.logger.debug("The padding value is too high, field will not padded.")
elif not list(padded_polygon.exterior.coords):
self.logger.warning("The padding value is too high, field will not padded.")
self.logger.debug("The padding value is too high, field will not padded.")
else:
polygon = padded_polygon

Expand Down
Loading