Replace hardcoded Alaska Albers with dynamic UTM lookup - #84
Replace hardcoded Alaska Albers with dynamic UTM lookup#84arpitjain099 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>
|
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
left a comment
There was a problem hiding this comment.
Nice! Thanks for adding the tests
|
I raised a comment around the correctness outside of the NAD83 region for our Waiting to discuss with Halyn on this one before we merge tests for coords_to_utm in |
|
Sounds good, happy to hold until you and Halyn settle the datum question. I'll consolidate the coords_to_utm tests into one place too. Do you want them in test_computation.py with the other pure-logic tests, or in test_coords_to_utm.py here? I'll move them and drop the duplicate. |
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