Skip to content

utils0: add epsg_code2utm_zone()#1159

Merged
yunjunz merged 5 commits intoinsarlab:mainfrom
yunjunz:utm
Mar 14, 2024
Merged

utils0: add epsg_code2utm_zone()#1159
yunjunz merged 5 commits intoinsarlab:mainfrom
yunjunz:utm

Conversation

@yunjunz
Copy link
Member

@yunjunz yunjunz commented Mar 13, 2024

Description of proposed changes

  • utils.utils0.py: add epsg_code2utm_zone() to convert the EPSG code to the UTM zone string.

Reminders

  • 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 adding new functionality, add a detailed description to the documentation and/or an example.

+ utils.utils0.py: add `epsg_code2utm_zone()` to convert the EPSG code to the UTM zone string.
@yunjunz yunjunz requested review from mirzaees and scottstanie March 13, 2024 13:48
Comment on lines +312 to +319
# epsg_code = str(epsg_code)
# if epsg_code.startswith('326'):
# utm_zone = epsg_code[3:] + 'N'
# elif epsg_code.startswith('327'):
# utm_zone = epsg_code[3:] + 'S'
# else:
# utm_zone = None
# print(f'WARNING: input EPSG code ({epsg_code}) is NOT a UTM zone, return None and continue.')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# epsg_code = str(epsg_code)
# if epsg_code.startswith('326'):
# utm_zone = epsg_code[3:] + 'N'
# elif epsg_code.startswith('327'):
# utm_zone = epsg_code[3:] + 'S'
# else:
# utm_zone = None
# print(f'WARNING: input EPSG code ({epsg_code}) is NOT a UTM zone, return None and continue.')

delete?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure about how the conversion between ESPG code and UTM Zone is done mathematically, then saw the code from Sara's PR, and thought this is helpful for understanding. Is it correct?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you @mirzaees, this is very helpful! I added the link to the inline comment. Now the EPSG code feels more generic and simple. It looks like we could use EPSG code for all kinds of calculations and checking very easily, without UTM_ZONE at all. Maybe we could remove this metadata completely, what do you think? @mirzaees @scottstanie @hfattahi

@yunjunz yunjunz merged commit 97c7004 into insarlab:main Mar 14, 2024
@yunjunz yunjunz deleted the utm branch March 14, 2024 03:00
ehavazli pushed a commit to ehavazli/MintPy that referenced this pull request Mar 19, 2024
+ utils.utils0.py: add `epsg_code2utm_zone()` to convert the EPSG code to the UTM zone string.

---------

Co-authored-by: Scott Staniewicz <scott.stanie@gmail.com>
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.

3 participants