Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTM support for view --show-gps + dual-coord input for lalo2yx/yx2lalo() #1153

Merged
merged 19 commits into from
Mar 12, 2024

Conversation

forrestfwilliams
Copy link
Collaborator

@forrestfwilliams forrestfwilliams commented Mar 5, 2024

Description of proposed changes

HyP3 (and I believe NISAR as well) both output their InSAR products in UTM coordinates. While MintPy was originally designed to use lat/lon coordinates, has limited support for UTM datasets as well. Users have noted (i.e., issue #1145) that it would be nice to better support UTM datasets.

This PR adds some additional support for UTM datasets, in plotting and GPS comparison contexts by:

  1. Ensuring UTM coordinate plot axes do not use scientific notation (see issue metadata inconsistency for UTM coordinates #1145)
  2. Ensuring coords.coordinate.latlon2yx works with UTM coordinates
  3. Ensuring coords.coordinate.geo2rdr works with UTM coordinates
  4. Adding compatibility for UTM coordinates to GPS plotting functionality

To accomplish this, checks for the use of UTM coordinates were added to latlon2yx and geo2rdr. Also, the inputs for latlon2yx was changed from a coordinate and a coordinate type (lat or lon) to a pair of lat/lon or northing/easting coordinates. All uses of latlon2yx were changed to use this new input format.

Reminders

  • Fixes metadata inconsistency for UTM coordinates #1145
  • Pass Pre-commit check (green)
  • Pass Codacy code review (green)
  • Pass Circle CI test (green)
  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • If modifying functionality, describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

@forrestfwilliams
Copy link
Collaborator Author

Also related to discussion #1010

@forrestfwilliams
Copy link
Collaborator Author

Hey @yunjunz, I would appreciate your thoughts on this whenever you have time.

Copy link
Member

@yunjunz yunjunz left a comment

Choose a reason for hiding this comment

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

Thank you @forrestfwilliams for the PR! After some minor changes mentioned below, testing the GPS plotting based on the Ridgecrest example dataset via view.py worked for me.

As for the input arg changes for lalo2yx(), either the "single coordinate type" or the "pair style" is fine with me. Actually, the pair style looks cleaner. Could you do a similar change to yx2lalo() as well, for consistency?

src/mintpy/utils/plot.py Outdated Show resolved Hide resolved
src/mintpy/objects/coord.py Outdated Show resolved Hide resolved
src/mintpy/objects/coord.py Outdated Show resolved Hide resolved
src/mintpy/objects/coord.py Outdated Show resolved Hide resolved
@forrestfwilliams
Copy link
Collaborator Author

Thanks for the review @yunjunz! I've made the suggested changes, modified yx2lalo to match the structure of lalo2yx, and updated its uses. This is ready for you to look at again!

@forrestfwilliams
Copy link
Collaborator Author

Not sure why the pre-commit check is failing.

@yunjunz
Copy link
Member

yunjunz commented Mar 12, 2024

Not sure why the pre-commit check is failing.

Have you set up the pre-commit for your MintPy local repo, following the instructions here? All the checks and/or modifications will be done automatically when you do the git commit.

@yunjunz yunjunz changed the title Improve UTM support UTM support for view GPS related options Mar 12, 2024
+ open(): ensure empty UTM_ZONE attribute is removed in the metadata dict

+ _clean_coord(): add more integer types for completeness

+ geo2radar(): attemps to convert lat/lon to UTM coordinates, instead of the opposite.
@yunjunz yunjunz changed the title UTM support for view GPS related options UTM support for view --show-gps + pair-wise input for lalo2yx/yx2lalo() Mar 12, 2024
Copy link
Member

@yunjunz yunjunz left a comment

Choose a reason for hiding this comment

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

Looks all good to me now. Thank you @forrestfwilliams!

Although lalo2yx() and yx2lalo() have breaking changes, they are usually not heavily used by most developers I believe, as geo2radar() and radar2geo() are more generic and convenient, I think there will be only very limited impact on developers and advanced users.

@yunjunz yunjunz changed the title UTM support for view --show-gps + pair-wise input for lalo2yx/yx2lalo() UTM support for view --show-gps + dual-coord input for lalo2yx/yx2lalo() Mar 12, 2024
@yunjunz yunjunz merged commit 5683092 into main Mar 12, 2024
8 checks passed
@forrestfwilliams
Copy link
Collaborator Author

Awesome, thanks @yunjunz! Do you think we could create a new release of MintPy soon with these changes? I ended up pursuing this work to support some tutorials ASF's OpenSARLab team runs and it would be great to get them a new release with these changes.

@yunjunz yunjunz deleted the utm branch March 13, 2024 02:02
@yunjunz
Copy link
Member

yunjunz commented Mar 13, 2024

Sure thing, let's cut for a new release for it. There are a few recently open PRs from the JPL folks, it will be nice to merge those before the new release, likely this week.

@yunjunz
Copy link
Member

yunjunz commented Mar 23, 2024

Hi @forrestfwilliams, I think the code is ready for a new release. As for the proposed changes in #1162, doing them either before or after the release is fine with me, let me know please.

@forrestfwilliams
Copy link
Collaborator Author

Hey @yunjunz sorry for the slow response. I'll open a PR for the changes discussed in #1162 next week, then we can release!

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.

metadata inconsistency for UTM coordinates
2 participants