Skip to content

Fix double filtering in psevents when using -q option#9086

Merged
Esteban82 merged 4 commits into
masterfrom
fix-8460
Jul 5, 2026
Merged

Fix double filtering in psevents when using -q option#9086
Esteban82 merged 4 commits into
masterfrom
fix-8460

Conversation

@Esteban82

Copy link
Copy Markdown
Member

Assisted by Qwen 3.7 Plus

Bug:

psevents applies the -q filter, and writes the selected data to temporary files. Afterwards, it calls internal modules to plot the symbols/labels from these temporary files. Because the -q option remained active, the internal modules applied the exact same filter a second time on the already-filtered temporary files.

Solution:

Implemented a local patch to temporarily suspend the -q option before calling the internal modules, and restore it immediately after.

Alternative solution:

I also considered modifying the global gmt_disable_bghio_opts() and gmt_reenable_bghio_opts() functions in gmt_io.c to include -q. However, this will affect dozens of other modules, and I'm not sure if the -q option should also be disabled for them. But maybe it should.

Test with:

I use -qi0:30: to plot a data point every 30.

gmt math -T0/360/1 T SIND = sin_curve.txt
cat << 'EOF' > main.sh
gmt begin
	gmt basemap -R0/360/-1.2/1.6 -JX22c/11.5c -X1c -Y1c -Bxa30g30f -By
	gmt events sin_curve.txt -i0,1,0 -T${MOVIE_FRAME} -Sc0.2c -Gblack -qi0:30:
gmt end
EOF
gmt movie main.sh -Chd -Tsin_curve.txt -Ntest -Ml,png -Zs

test

Closes #8460.

@Esteban82 Esteban82 requested review from a team, joa-quim and seisman July 3, 2026 00:44
@Esteban82 Esteban82 self-assigned this Jul 3, 2026
@Esteban82 Esteban82 added add-changelog Add PR to the changelog AI-assisted All (or most) of the code was written by Artificial Intelligence. labels Jul 3, 2026

@joa-quim joa-quim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll be very extra cautious in using other models than Anthropic's (even Sonnet, though Sonnet 5 is a good surprise but previous one was moderately bad). GLM, for example, is ver acclaimed but my experience with it was bad. Have no experience with OpenAI top models though.
This fix seams simple so it should not harm.

@Esteban82

Copy link
Copy Markdown
Member Author

I agree. I will ask Sonnet to review the patch before merging, just to get an additional set of eyes on it.

@Esteban82

Esteban82 commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

Based on Claude's suggestion:

  • I initialized the values to false or 0.
  • I added the {} when the settings are recovered so the if applies to all three statements instead of only the first one.

@Esteban82 Esteban82 merged commit ab6f2f3 into master Jul 5, 2026
9 of 13 checks passed
@Esteban82 Esteban82 deleted the fix-8460 branch July 5, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog AI-assisted All (or most) of the code was written by Artificial Intelligence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug. Data get filter twice with psevents -q0:inc:

2 participants