-
Notifications
You must be signed in to change notification settings - Fork 224
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 string type numbers, geographic coordinates and datetimes #975
Conversation
cb910a1
to
416cf8f
Compare
/test-gmt-dev |
Can you add a doc API line at https://github.com/GenericMappingTools/pygmt/blame/v0.3.0/doc/api/index.rst#L214 for |
Done in 24ad0af |
See https://github.com/GenericMappingTools/pygmt/actions/runs/609196993 for the tests with GMT dev versions. All the tests (including the new one) pass. Tests with GMT 6.1.1 fails, because in the old codes, datetime strings can processed by |
pygmt/tests/test_clib_put_vector.py
Outdated
for i, j in itertools.combinations_with_replacement(range(3), r=2): | ||
# TODO: Change range(3) to range(4) |
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 idea of the test is to pass different combinations of strings to GMT, let GMT write it to a temporary file, and check if the output is the same as expected (i.e., if vector=expected_vetcor
.
Still has trouble testing datetime strings, when the text file contains strings,
dtype=[("x", np.str_), ("y", np.str_)],
doesn't works as I expect.
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.
Fixed in bf7587c, but could still be improved.
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.
Great to finally see this come through!
…imes (GenericMappingTools#975) Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Description of proposed changes
This PR adds support for passing string type data to GMT via
GMT_Put_Vectors
. Supported string type data include:"0.5"
)"3:30W"
,"3:30N"
)2010-01-01T00:00
)This PR should address the bug/feature request in #647 and #633.
To test this branch, you need GMT dev versions (i.e., GMT>=6.2.0). You can install the latest GMT dev versions using:
Example script for testing:
Expected and actual output:
Fixes #647.
Fixes #633.
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