Support passing data in numpy int8, int16, uint8 and uint16 dtypes to GMT#1963
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.
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.
| 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_matrixfunction, but was not documented here. But I'm wondering what happens if passing astrmatrix 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.
| 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_matrixfunction, but was not documented here. But I'm wondering what happens if passing astrmatrix 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 |
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 formatandmake checkto 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