Last active
May 3, 2023 23:30
-
-
Save brews/cb0fa9a81d5388b590de3aa441105dad to your computer and use it in GitHub Desktop.
Convert 0 - 360 longitude to -180 - 180 longitude or -180 - 180 to 0 - 360 longitude in Python
This file contains 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
def lon360to180(lon): | |
return (lon + 180.0) % 360.0 - 180.0 | |
# The inverse going from -180 - 180 to 0 - 360 is | |
def lon180to360(lon): | |
return lon % 360.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment