Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Oct 15, 2024

Here is the PyGMT script to reproduce the issue. The expected output is [-25.5, -12.5], but the actual output is [334.5, 347.5].

In [1]: import pygmt

In [2]: pygmt.info([["12:30S"], ["25:30S"]], per_column=True)
Out[2]: array([334.5, 347.5])

The bug exists in the GMT_Put_Vector function. In this function, GMT checks if the last character of a text string is one of E, N, S, W, to determine if the strings should be parsed as longitude/latitudes.

Here, L is the length of the first string so text[L-1] should be the last character of the string, but GMT incorrectly checks text[L]. This PR fixes the bug, and after the fix it's correct:

In [1]: import pygmt

In [2]: pygmt.info([["12:30S"], ["25:30S"]], per_column=True)
Out[2]: array([-25.5, -12.5])

@seisman seisman merged commit 1173862 into master Oct 15, 2024
@seisman seisman deleted the fix/put-vector branch October 15, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants