-
Notifications
You must be signed in to change notification settings - Fork 229
GMT_IMAGE: Implement the GMT_IMAGE.to_dataarray method for 3-band images #3128
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
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
bcf43f0
Wrap GMT's standard data type GMT_IMAGE for images
seisman a052a1a
Initial implementation of to_dataarray method for _GMT_IMAGE class
weiji14 56a6d65
Merge branch 'main' into datatypes/gmtimage
seisman f71e79c
Merge branch 'main' into datatypes/gmtimage
weiji14 4cce4a2
Small typo fixes and add output type-hint for to_dataarray
weiji14 e02b650
Fix mypy error using np.array([0, 1, 2]) instead of np.arange
weiji14 f3d4b1f
Parse name and data_attrs from grid/image header
weiji14 4390136
Transpose array to (band, y, x) order and add doctest for to_dataarray
weiji14 5f25669
Set registration and gtype from header
weiji14 a3c6c14
Print basic shape and padding info in _GMT_IMAGE doctest
weiji14 5888e10
Only set Conventions = CF-1.7 attribute for NetCDF grid type
weiji14 798e658
Merge branch 'main' into datatypes/gmtimage
weiji14 3dbf2f2
Remove rioxarray import
weiji14 6b860bf
Merge branch 'main' into datatypes/gmtimage
seisman 0bf9368
Merge branch 'main' into datatypes/gmtimage
seisman 7d437be
Use enum for grid ids
seisman 268e34e
Fix the band. Starting from 1
seisman 86765e1
Refactor the tests for images
seisman 86f3ffa
In np.reshape, a is a position-only parameter
seisman cc28247
Improve tests
seisman 1e2c973
Fix one failing doctest due to xarray changes
seisman 734dc28
The np.reshape's newshape parameter is deprecated
seisman 919dc00
Define grid IDs using IntEnum instead of Enum
seisman b1eacf1
Pass the new shape as a positional parameter
seisman aa4fdc9
Fix failing tests
seisman c87a3ec
One more fix
seisman a20d8a2
One more fix
seisman 926427b
Simplify a doctest
seisman c73328e
Improve the tests
seisman fb97daa
Convert ctypes array to numpy array using np.ctypeslib.as_array
seisman 15b8d53
Fix the incorrect value due to floating number conversion in sphinter…
seisman 8433e78
Merge branch 'ctypesarray' into datatypes/gmtimage
seisman 3e3a6f3
Update the to_dataarray method to match the codes in GMT_GRID
seisman 12ef40a
image data should has uint8 dtype
seisman f64fbb8
Further improve the tests
seisman 4f2ae48
Merge branch 'main' into datatypes/gmtimage
seisman d49afed
Add a note that currently only 3-band images are supported
seisman f70bec0
Merge branch 'main' into datatypes/gmtimage
seisman 2fd13fb
Remove the old GMTGridID enums from pygmt/datatypes/header.py
seisman 9972ba1
A minor fix
seisman 62f0ce0
Set CF-1.7-specific attributes for netCDF formats only
seisman f715aee
Improve the logic for determine grid/image gtype based on upstream GM…
seisman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The image
name
is currently hardcoded toz
, is that ok for an RGB image?pygmt/pygmt/datatypes/header.py
Lines 193 to 198 in ac44706
The
attrs
fields might need some work. I'm getting'actual_range': array([ 1.79769313e+308, -1.79769313e+308])}
when loading the@earth_day_01d
image.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree they make no sense, but they're consistent with the behavior in GMT.
The GMT's image support was likely added by Joaquim so that you may ping him for more information.