[BREAKING] Raise GMTTypeError exception for unsupported image dtypes#4673
Merged
seisman merged 1 commit intoJun 12, 2026
Merged
Conversation
weiji14
approved these changes
Jun 12, 2026
weiji14
left a comment
Member
There was a problem hiding this comment.
The error only shows up for the GMT dev version right? Not the current stable GMT 6.6.0 release? Ok with raising an error for GMT 6.5 and 6.6 users, since they should really rescale to 0-255 anyway.
Member
Author
The error also shows up for GMT 6.6.0 but GMT can still read it: |
Member
|
OK. If image is incorrect, then error is good. |
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.
GMT only supports images with the
uint8data type. Previously, GMT would emit the following errors for unsupported image data types but would not stop execution:As a result, unsupported images were still read and plotted, although the output was likely incorrect. PyGMT would then issue a warning about the unsupported data type.
It is unclear when this behavior changed, but the GMT dev version now produces the following error instead (xref: https://github.com/GenericMappingTools/pygmt/actions/runs/27249793607/job/80471539938):
Apparently, GMT now fails to read images with unsupported data types altogether, causing our tests to fail. I can't find the exact changes that lead to the behavior changes, but I feel it's likely some changes in GDAL.
This PR addresses the issue by raising a GMTTypeError whenever an unsupported image data type is encountered.