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

When given multiple tables, report line number of bad records in the offending file #8259

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

PaulWessel
Copy link
Member

@PaulWessel PaulWessel commented Jan 5, 2024

See this post on the Forum. The problem was that the Warning statement used the total internal record counter (the only option if you cat may files into a table reader) but if you give individual files on the command line we have a secondary counter that gets reset to 0 for each new file. Pretty sure we just forgot. Here is what it looks like now:

cat<<eof > file1
2 4
6 7
2 8
eof
cat<<eof > file2
2 4
trash
6 7
2 8
eof
gmt info file1 file2
gmtinfo [WARNING]: Mismatch between actual (1) and expected (2) fields near line 2 in file file2

Of course, the cat file1 file2 | gmt info example cannot change since it just see a combined stdin stream. The gmt info module reads record by record, while many others (e.g., gmt convert) reads file by file. That also works now, e.g.

gmt convert file1 file2
gmtconvert [WARNING]: Mismatch between actual (1) and expected (2) fields near line 2 in file file2

…offending file

See this post on the Forum.  The problem was that the report statement used the total internal record counter (the only option if you cat may files in to a table reader) but if you give individual files on the command line we have a secondary counter that gets reset to 0 for each new file. Pretty sure we just forgot.
@PaulWessel PaulWessel added the bug Something isn't working label Jan 5, 2024
@PaulWessel PaulWessel added this to the Future release milestone Jan 5, 2024
@PaulWessel PaulWessel requested a review from anbj January 5, 2024 14:13
@PaulWessel PaulWessel self-assigned this Jan 5, 2024
Copy link
Contributor

@anbj anbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. Reports as expected. Thanks Paul!

@PaulWessel PaulWessel merged commit 241db2c into master Jan 5, 2024
6 checks passed
@PaulWessel PaulWessel deleted the report-file branch January 5, 2024 14:27
@seisman seisman removed this from the Future release milestone Jan 7, 2024
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.

None yet

3 participants