Conversation
…actional timezone offsets
seisman
commented
Sep 24, 2026
Comment on lines
+120
to
+122
| # Convert a timezone-aware datetime to UTC, before passing to GMT. | ||
| if _datetime.tzinfo is not None: | ||
| _datetime = _datetime.tz_convert("UTC") |
Member
Author
There was a problem hiding this comment.
With this workaround, we don't need the +z modifier (line 143), so this workaround can simplify the code and is not temporary. So I don't add a # TODO comment to remove it in future versions.
This branch has not been deployed
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.
Description of proposed changes
As reported in #4112 amd GenericMappingTools/gmt#9220, GMT's
solarmodule doesn't accept fractional timezone offsets like08:30. GMT always casts it to8.GMT already has a fix at GenericMappingTools/gmt#9221. This PR adds a workaround on the PyGMT side, by always converting timezone-aware datetime to UTC datetime before passing to GMT. With this workaround, PyGMT works well for any GMT versions.
This bug can be confirmed by the script below:
Note the position of the yellow dashed line for a timezone offset
+00:30.Patches #4112.