Replace hardcoded Alaska Albers with dynamic UTM lookup#84
Open
arpitjain099 wants to merge 2 commits into
Open
Replace hardcoded Alaska Albers with dynamic UTM lookup#84arpitjain099 wants to merge 2 commits into
arpitjain099 wants to merge 2 commits into
Conversation
The query_tracks(), query_adsb(), and query_ais_mxak() helpers all project the spatial mask into EPSG:3338 (Alaska Albers) for buffering. This only gives correct results for parks in Alaska. Use coords_to_utm() (already in the codebase) to derive the appropriate UTM zone from the mask centroid so the buffer works for any location in the US. In study_duration_stability, reuse the utm_zone variable that NMSIM_bbox_utm() already computed for the study area. Fixes dbetchkal#51 Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Contributor
Author
|
Sure thing. I'll add tests covering different regions (Alaska, somewhere in CONUS, southern hemisphere) to verify the zone detection handles various coordinate inputs correctly. Will push a follow-up commit. |
Cover Alaska, CONUS, southern hemisphere, zone boundaries, prime meridian, and far-east/west edge cases. All tests are self-contained with no external data dependencies. Signed-off-by: arpitjain099 <arpitjain099@gmail.com>
elliott-ruebush
approved these changes
Jul 7, 2026
elliott-ruebush
left a comment
Collaborator
There was a problem hiding this comment.
Nice! Thanks for adding the tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #51.
The mask-buffering step in
query_tracks(),query_adsb(), andquery_ais_mxak()hardcodesEPSG:3338 (Alaska Albers) as the equal-area projection. That gives wrong buffer distances for
parks outside Alaska. The same issue affects the area calculation in
study_duration_stability.fit_varying_n_tracks().This patch replaces every
epsg:3338reference with a dynamic UTM zone derived from thegeometry's centroid, using
coords_to_utm()which already exists in the codebase. For thestability module the fix is even simpler:
NMSIM_bbox_utm()already computes the correctUTM zone earlier in the function, so we reuse that variable.
With this change the toolkit works correctly for any park in the US (for example Great Smoky
Mountains, which is already in active use per Gurung et al. 2026).
Files changed
nps_active_space/utils/helpers.py-query_tracks()andquery_adsb()buffer projectionsnps_active_space/utils/ais/query.py-query_ais_mxak()buffer projectionnps_active_space/validation/study_duration_stability.py- area calculation projection