Skip to content
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

Handle commas in meca if -A and CSV #7599

Merged
merged 4 commits into from
Jul 3, 2023
Merged

Handle commas in meca if -A and CSV #7599

merged 4 commits into from
Jul 3, 2023

Conversation

PaulWessel
Copy link
Member

See pyGMT issue.

With -A we examine the trailing text, but if those items are comma-separated then the scanning will fail since the format assumes white-space. This PR counts commas in trailing text and if 2 we change the scanning.

@seisman:

Please see if it works as is.

  1. If not, please add a fprintf (stderr, trailing = %s\n", S->text[row]); so we can see the trailing text and manually check commas (not sure if there might be a leading one).
  2. Once working, perhaps same is needed in other seis modules?

WIth -A we examine the trailing text, but if those items are comma-separated then the scanning will fail since the format assumes white-space.  This PR counts commas in trailing text and if 2 we change the scanning.
@PaulWessel PaulWessel added the bug Something isn't working label Jul 3, 2023
@PaulWessel PaulWessel added this to the 6.5.0 milestone Jul 3, 2023
@PaulWessel PaulWessel requested a review from seisman July 3, 2023 09:01
@PaulWessel PaulWessel self-assigned this Jul 3, 2023
@PaulWessel
Copy link
Member Author

Sorry, did not notice at first this was a CLI example. My fix seems to work.

@seisman
Copy link
Member

seisman commented Jul 3, 2023

It fixes the original issue, but what if the columns are space-separated and the trailing text contains commas, e.g.,

gmt meca -R-5/5/-5/5 -JX10c -Sa2c -Baf -A -png map << EOF
0 0 10 0 90 0 5.0 2,2,eventname
EOF

In the above case, users expect to see 2,2,eventname as the beachball title, but only eventname is shown.

@PaulWessel
Copy link
Member Author

Hm, have no way of knowing if the entire file was CSV since that reading was done earlier via GMT_Read_Data. ?

@seisman
Copy link
Member

seisman commented Jul 3, 2023

Hm, have no way of knowing if the entire file was CSV since that reading was done earlier via GMT_Read_Data. ?

I believe so.

2. Once working, perhaps same is needed in other seis modules?

I think coupe also needs update.

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.

2 participants