support --lalo-label for UTM-geocoded products in view.py - #1511
Open
huchangyang wants to merge 3 commits into
Open
support --lalo-label for UTM-geocoded products in view.py#1511huchangyang wants to merge 3 commits into
huchangyang wants to merge 3 commits into
Conversation
Keep the UTM image on regular axes and label ticks as lat/lon. Fix ccrs.UTM zone parsing for --coastline-only UTM plots (zone number, not '14N').
Only change behavior for UTM + --lalo-label; keep original ccrs.UTM(utm_zone) for coastline.
Contributor
Reviewer's GuideAdds support for --lalo-label on UTM-geocoded products by drawing lat/lon tick labels on regular matplotlib axes without using a Cartopy UTM projection, while keeping existing behavior for lat/lon-projected data unchanged. Flow diagram for --lalo-label handling with UTM and latlon projectionsflowchart TD
A[extent2meshgrid] --> B{inps.lalo_label}
B -->|False| C[ax.tick_params default UTM or latlon]
B -->|True| D{inps.coord_unit startswith meter AND UTM_ZONE in metadata}
D -->|True| E[draw_utm_lalo_label ax metadata inps.geo_box]
D -->|False| F[draw_lalo_label ax inps.geo_box inps.map_proj_obj]
subgraph UTM_lalo_label_path
E --> G[utm2latlon metadata geo_box]
G --> H[auto_lalo_sequence lalo_box]
H --> I[latlon2utm metadata mid_lat lons_t]
H --> J[latlon2utm metadata lats_t mid_lon]
I --> K[ax.set_xticks xticks]
J --> L[ax.set_yticks yticks]
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider refactoring the lat/lon label formatting (degree + N/S/E/W, decimal digits logic) into a shared helper used by both
draw_lalo_labelanddraw_utm_lalo_labelto avoid duplication and keep labeling behavior consistent across projections. - In
check_map_projection, when--lalo-labelis used with UTM you now leavemap_proj_objunset; double-check other code paths that assume a non-Noneprojection and guard or document this UTM + lalo-label behavior to avoid subtle regressions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider refactoring the lat/lon label formatting (degree + N/S/E/W, decimal digits logic) into a shared helper used by both `draw_lalo_label` and `draw_utm_lalo_label` to avoid duplication and keep labeling behavior consistent across projections.
- In `check_map_projection`, when `--lalo-label` is used with UTM you now leave `map_proj_obj` unset; double-check other code paths that assume a non-`None` projection and guard or document this UTM + lalo-label behavior to avoid subtle regressions.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Summary
view.py --lalo-labelfor UTM-geocoded files (e.g. NISAR GUNW).Approach
Previously UTM +
--lalo-labelraised:ValueError: --lalo-label is NOT supported for projection: UTMNow:
--lalo-labeldraw_utm_lalo_label()to place ticks at UTM coords of lat/lon lines and label them as101°W/19°NTest plan
view.py velocity.h5 velocity --lalo-label→ lat/lon tick labels--lalo-labelunchanged--lalo-labelunchangedSummary by Sourcery
Support lat/lon tick labeling on UTM-geocoded maps without reprojecting raster data.
New Features:
Enhancements: