Fix Argus imagery coordinate system detection for proper satellite overlay alignment#48
Fix Argus imagery coordinate system detection for proper satellite overlay alignment#48
Conversation
Add automatic detection of coordinate system (State Plane vs lon/lat) for Argus GeoTIFF files. The script now checks if extent values are in State Plane range (>800000 for Easting, >200000 for Northing) and only converts to lon/lat if needed. If the GeoTIFF is already in lon/lat, it uses the extent directly without conversion. Co-authored-by: SBFRF <8375832+SBFRF@users.noreply.github.com>
- Add comprehensive documentation explaining the issue and fix - Add validation script demonstrating correct behavior - Document detection logic and testing approach Co-authored-by: SBFRF <8375832+SBFRF@users.noreply.github.com>
Address code review feedback by: - Extract coordinate detection logic into detect_argus_coordinate_system() utility function - Add comprehensive documentation with thresholds explanation - Update example script to use the new utility function - Update tests to use the new utility function (no duplication) - Update validation script to use the new utility function - Export the new function from getdata module Co-authored-by: SBFRF <8375832+SBFRF@users.noreply.github.com>
- Update documentation to show utility function usage (not inline logic) - Add comprehensive edge case test for inverse mixed coordinates - Clarify that BOTH conditions must be met for State Plane detection - All 124 tests passing Co-authored-by: SBFRF <8375832+SBFRF@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes misalignment between Argus orthophotos and satellite imagery by detecting whether Argus GeoTIFF extents are in NC State Plane or geographic lon/lat before converting. The change centralizes the detection logic, updates the example workflow to use it, and adds tests and docs around the behavior.
Changes:
- Added
detect_argus_coordinate_system(extent)inmurgtools.getdata.getDataFRFand exported it from themurgtools.getdatapackage. - Updated
examples/test_wave_and_imagery.pyto detect the Argus GeoTIFF coordinate system and only apply State Plane → lon/lat conversion when needed. - Added unit tests, a validation script, and documentation (
ARGUS_COORDINATE_FIX.md,QUICK_REFERENCE.md) to cover and explain the coordinate detection behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
murgtools/getdata/getDataFRF.py |
Adds detect_argus_coordinate_system utility used to distinguish State Plane vs lon/lat Argus GeoTIFF extents. |
murgtools/getdata/__init__.py |
Re-exports detect_argus_coordinate_system and includes it in __all__ for public use. |
examples/test_wave_and_imagery.py |
Switches Argus extent handling to use the new detection function, fixing overlay alignment with satellite imagery. |
tests/test_argus_coordinate_detection.py |
Introduces 5 pytest tests that exercise detection logic, conversion sanity via FRFcoord, and edge cases. |
examples/validate_coordinate_fix.py |
Provides a runnable script that demonstrates and sanity-checks detection and conversion behavior for typical and edge-case extents. |
QUICK_REFERENCE.md |
Documents the coordinate-system issue, the detection approach, and provides quick usage examples (one example currently references a non-existent helper). |
ARGUS_COORDINATE_FIX.md |
Gives deeper technical context, rationale for thresholds, and outlines the solution and testing strategy for the Argus coordinate fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
murgtools/getdata/getDataFRF.py
Outdated
| return [left, right, bottom, top] | ||
|
|
||
|
|
||
| def detect_argus_coordinate_system(extent): |
There was a problem hiding this comment.
this function isn't really getting data, this is more of a helper function. Lets take it out of getDataFRF and make a new module frf_data_helper
There was a problem hiding this comment.
Moved to new murgtools/getdata/frf_data_helper.py module as requested. The function is still exported from murgtools.getdata for backwards compatibility. All 124 tests pass. (commit 9ad3ce2)
As requested by @SBFRF, moved the detect_argus_coordinate_system helper function from getDataFRF.py to a new frf_data_helper.py module since it's not directly involved in data retrieval. The function is still exported from murgtools.getdata for backwards compatibility. All 124 tests pass. Co-authored-by: SBFRF <8375832+SBFRF@users.noreply.github.com>
Fix satellite imagery alignment with Argus imagery ✅ COMPLETE
Summary
Fixed imagery misalignment issue in
examples/test_wave_and_imagery.pywhere Argus imagery wasn't aligning with satellite imagery. The pier and shoreline features now align correctly between both imagery sources.Root Cause
The Argus coastal imaging server changed their GeoTIFF coordinate system from NC State Plane NAD83 to geographic lon/lat, but the example script was hardcoded to always convert from State Plane to lon/lat. When the GeoTIFF was already in lon/lat, this conversion produced incorrect results causing severe misalignment.
Solution
Created
detect_argus_coordinate_system()utility function that automatically detects the coordinate system:Changes
murgtools/getdata/frf_data_helper.py- New helper module withdetect_argus_coordinate_system()functionmurgtools/getdata/__init__.py- Import from new module and export for backwards compatibilitymurgtools/getdata/getDataFRF.py- Removed helper function (moved to dedicated module)examples/test_wave_and_imagery.py- Use utility function for coordinate detectiontests/test_argus_coordinate_detection.py- 5 comprehensive unit tests covering all scenariosexamples/validate_coordinate_fix.py- Validation script demonstrating correct behaviorARGUS_COORDINATE_FIX.md- Complete documentation of issue and solutionQUICK_REFERENCE.md- Quick reference guide for developersTesting & Validation
Impact
The fix ensures that the example script works correctly regardless of which coordinate system the Argus coastal imaging server uses, providing proper alignment between satellite imagery, Argus imagery, and wave gauge locations.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.