Skip to content

Get review from Copilot#33

Open
meeqn wants to merge 113 commits intopr_review_testfrom
main
Open

Get review from Copilot#33
meeqn wants to merge 113 commits intopr_review_testfrom
main

Conversation

@meeqn
Copy link
Copy Markdown
Owner

@meeqn meeqn commented Nov 3, 2025

No description provided.

meeqn and others added 30 commits February 23, 2024 18:34
S-57 base functionality implementation
updated configuration for different utm zones, display should now han…
meeqn and others added 25 commits September 30, 2024 15:23
shallow waters are not underlapping whole map now
* Update README.md - features

* Update README.md

* Update README.md - usage

* Update README.md - image

* image added

* image

* image

* Update README.md

* Update README.md

---------

Co-authored-by: miqn <109998643+meeqn@users.noreply.github.com>
* added some description for users running SC for the first time

* upgraded test file and parametrized coastline display
* added some description for users running SC for the first time

* upgraded test file and parametrized coastline display

* seacharts 4 setup tips added
* added some description for users running SC for the first time

* upgraded test file and parametrized coastline display

* seacharts 4 setup tips added

* Generated descriptions for most of the code and few refactors
* add weather utility function

* Update config.yaml

* Update config.yaml

* Update config.yaml
* minor fixes regarding setup and documentation

* simplified testing files
* Refactor configuration schema and core classes for improved clarity and functionality.
Use CoordTuple for XY paired data in Extent class - it notably improves readability and thus maintainability. In the future these types of coordinates and bounding boxes could be replaced with similar, more readable containers.

Changelog:
- Updated comments in config_schema.yaml for better understanding of parameters.
- Enhanced Config class to support optional config_path parameter.
- Introduced CoordTuple class in extent.py for better handling of 2D coordinates.
- Modified methods in extent.py to utilize CoordTuple for size, origin, and center.
- Adjusted ENC class to return coordinates as tuples from extent.
- Cleaned up imports and removed unused code in various files.
- Improved type hints across multiple classes for better code readability.

* Enhance directory structure creation and improve error handling for layer retrieval

* Remove unused autosize option from config schema
@meeqn meeqn requested a review from Copilot November 3, 2025 21:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces SeaCharts version 4.0 with significant enhancements including S-57 maritime map format support, weather data visualization, and improved API functionality. The changes add support for parsing and displaying S-57 Electronic Navigational Charts alongside existing FGDB support, integrate weather data overlays with time-based controls, and provide new coordinate query methods.

Key Changes

  • S-57 Format Support: New parser (S57Parser) for IHO S-57 maritime chart format with layer extraction capabilities
  • Weather Visualization: Integration with PyThor weather service for displaying wind, waves, currents, and tides with interactive time slider controls
  • Enhanced API: Added methods for querying depth at coordinates, checking layer membership, and retrieving layer parameters

Reviewed Changes

Copilot reviewed 38 out of 42 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
user_doc/seacharts_user_doc.md Comprehensive user documentation for v4.0 features
tests/test_seacharts_4_0.py Test file demonstrating new S-57 and coordinate query functionality
tests/config_sc4.yaml Configuration for S-57 map testing
seacharts/core/parserS57.py New S-57 format parser implementation
seacharts/environment/weather.py Weather data fetching and parsing logic
seacharts/display/display.py Added weather visualization and control panel features
seacharts/core/extent.py Enhanced coordinate transformation with WGS84 and UTM support
seacharts/layers/layer.py Added parameter extraction at coordinates
seacharts/enc.py New coordinate query methods for depth and layer membership

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import sys, os
from shapely.geometry import MultiPolygon, Polygon
# file made to showcase functionalities added in seacharts 4.0 integrated within old seacharts functionalities
# for
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete comment on line 4 - appears to be a fragment that should be completed or removed.

Copilot uses AI. Check for mistakes.
if (bbox[i] != environment.scope.extent.bbox[i]):
changed.append(i)
if len(changed)>0:
print(Fore.RED + f"WARNING: Bouding box for display has exceeded the limit of CRS axes and therefore been scaled down. Watch out for potentially cropped chart display!" + Fore.RESET)
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'Bouding' to 'Bounding'.

Suggested change
print(Fore.RED + f"WARNING: Bouding box for display has exceeded the limit of CRS axes and therefore been scaled down. Watch out for potentially cropped chart display!" + Fore.RESET)
print(Fore.RED + f"WARNING: Bounding box for display has exceeded the limit of CRS axes and therefore been scaled down. Watch out for potentially cropped chart display!" + Fore.RESET)

Copilot uses AI. Check for mistakes.
"""
Sets bounding box for the display taking projection's (crs's) x and y limits for display into account.
Making sure that bbox doesn't exceed limits prevents crashes. When such limit is exceeded, an appropriate message is displayed
to inform user about possibility of unexpeced display bound crop
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'unexpeced' to 'unexpected'.

Suggested change
to inform user about possibility of unexpeced display bound crop
to inform user about possibility of unexpected display bound crop

Copilot uses AI. Check for mistakes.

def start(self) -> None:
"""
self.started__ = """
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 88 contains a syntax error: the docstring is incorrectly assigned to a variable self.started__ instead of being a proper docstring. This should be formatted as a standard docstring immediately after the function definition.

Suggested change
self.started__ = """
"""

Copilot uses AI. Check for mistakes.
Comment on lines +746 to +750
if "wind_speed" and "wind_direction" in radio_labels:
radio_labels.append("wind")
if "wave_height" and "wave_direction" in radio_labels:
radio_labels.append("wave")
if "sea_current_speed" and "sea_current_direction" in radio_labels:
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The boolean logic is incorrect. The expression if \"wind_speed\" and \"wind_direction\" in radio_labels will always evaluate the first string as truthy and only check if the second is in the list. It should be if \"wind_speed\" in radio_labels and \"wind_direction\" in radio_labels. The same issue exists on lines 748 and 750.

Suggested change
if "wind_speed" and "wind_direction" in radio_labels:
radio_labels.append("wind")
if "wave_height" and "wave_direction" in radio_labels:
radio_labels.append("wave")
if "sea_current_speed" and "sea_current_direction" in radio_labels:
if "wind_speed" in radio_labels and "wind_direction" in radio_labels:
radio_labels.append("wind")
if "wave_height" in radio_labels and "wave_direction" in radio_labels:
radio_labels.append("wave")
if "sea_current_speed" in radio_labels and "sea_current_direction" in radio_labels:

Copilot uses AI. Check for mistakes.
Comment on lines +253 to +260
Adds an overlay geometry to the display.

:param geometry: The geometry to overlay.
:param color_name: The name of the color for the overlay.
:param fill: Whether the overlay should be filled.
:param linewidth: The width of the overlay line.
:param linestyle: The style of the overlay line.
:param alpha: The transparency level of the overlay.
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring parameters don't match the function signature. The function add_polygon has parameters shape, color, interiors, fill, linewidth, linestyle, and alpha, but the docstring references geometry and color_name instead.

Suggested change
Adds an overlay geometry to the display.
:param geometry: The geometry to overlay.
:param color_name: The name of the color for the overlay.
:param fill: Whether the overlay should be filled.
:param linewidth: The width of the overlay line.
:param linestyle: The style of the overlay line.
:param alpha: The transparency level of the overlay.
Adds a polygon overlay to the display.
:param shape: The exterior coordinates of the polygon, or a collection of polygons.
:param color: The color to use for the polygon.
:param interiors: A list of interior coordinates (holes) for the polygon.
:param fill: Whether the polygon should be filled.
:param linewidth: The width of the polygon outline.
:param linestyle: The style of the polygon outline.
:param alpha: The transparency level of the polygon.

Copilot uses AI. Check for mistakes.
draw_default = data is None
for i in range(len(direction_data)):
for j in range(len(direction_data[i])):
x = direction_data[i][j]
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable x is not used.

Suggested change
x = direction_data[i][j]

Copilot uses AI. Check for mistakes.
super().__init__(bounding_box, path_strings)
self.epsg = epsg

def get_source_root_name(self) -> str:
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixing implicit and explicit returns may indicate an error, as implicit returns always return None.

Copilot uses AI. Check for mistakes.
seacharts/enc.py Outdated
import _warnings
from pathlib import Path

from shapely.geometry import Point, Polygon
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'Polygon' is not used.

Suggested change
from shapely.geometry import Point, Polygon
from shapely.geometry import Point

Copilot uses AI. Check for mistakes.

import fiona

from seacharts.core import DataParser, paths
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'paths' is not used.

Suggested change
from seacharts.core import DataParser, paths
from seacharts.core import DataParser

Copilot uses AI. Check for mistakes.
* Fixed some issues based on Copilot-generated review.

- Added a check in `build_directory_structure` to raise a ValueError if the source root name is None.
- Updated `get_source_root_name` method signatures in `DataParser`, `FGDBParser`, and `S57Parser` to indicate they can return None.
- Modified return values in `FGDBParser` and `S57Parser` to return None when no valid data is found.
- Improved docstrings for clarity on return types and conditions.

* Fix the false positive scenarios in control panel creation
* Remove unused 'override' method

* Change config to default to darkmode

* Remove redundant markdown, update main README file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants