-
Notifications
You must be signed in to change notification settings - Fork 219
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
Support passing data in numpy int8, int16, uint8 and uint16 dtypes to GMT #1963
Conversation
Awesome @seisman! Didn't realize GMT even supported these other dtypes! Just need to update some tests, e.g. these lines: pygmt/pygmt/tests/test_clib_put_matrix.py Line 18 in 1067fa3
pygmt/pygmt/tests/test_clib_put_matrix.py Line 64 in 1067fa3
pygmt/pygmt/tests/test_clib_put_vector.py Line 19 in 1067fa3
pygmt/pygmt/tests/test_clib_put_vector.py Line 59 in 1067fa3
Also 6 more lines in test_clib.py. Maybe a good idea to make the Use |
Was working on it. Now pushed to this branch. |
pygmt/clib/session.py
Outdated
Not at all numpy dtypes are supported, only: int8, int16, int32, int64, | ||
uint8, uint16, uint32, uint64, float32, float64, str\_ and datetime64. |
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 just realized that passing str_
type matrix to GMT is allowed in the PyGMT put_matrix
function, but was not documented here. But I'm wondering what happens if passing a str
matrix to GMT.
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.
Not at all numpy dtypes are supported, only: int8, int16, int32, int64, | |
uint8, uint16, uint32, uint64, float32, float64, str\_ and datetime64. | |
Not all numpy dtypes are supported, only: int8, int16, int32, int64, | |
uint8, uint16, uint32, uint64, float32, float64, str\_ and datetime64. |
I just realized that passing
str_
type matrix to GMT is allowed in the PyGMTput_matrix
function, but was not documented here. But I'm wondering what happens if passing astr
matrix to GMT.
Maybe try and see?
pygmt/clib/session.py
Outdated
Not at all numpy dtypes are supported, only: int8, int16, int32, int64, | ||
uint8, uint16, uint32, uint64, float32, float64, str\_ and datetime64. |
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.
Not at all numpy dtypes are supported, only: int8, int16, int32, int64, | |
uint8, uint16, uint32, uint64, float32, float64, str\_ and datetime64. | |
Not all numpy dtypes are supported, only: int8, int16, int32, int64, | |
uint8, uint16, uint32, uint64, float32, float64, str\_ and datetime64. |
I just realized that passing
str_
type matrix to GMT is allowed in the PyGMTput_matrix
function, but was not documented here. But I'm wondering what happens if passing astr
matrix to GMT.
Maybe try and see?
Just as an aside, is there any chance of GMT supporting half precision floats? I.e. https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.float16, or 2-byte floats. Not sure if it's possible in C, but supporting float16 will be useful for some machine learning workloads that use float16. |
Looking at the source code of the |
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 have no idea about float16. Better to open a feature request in the GMT repository. |
… GMT (GenericMappingTools#1963) Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Description of proposed changes
Support numpy data types
np.int8
,np.int16
,np.uint8
, andnp.uint16
.References:
Fixes #1960.
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version