Skip to content

Fix meca and coupe -A/-D and -I carrying over from the previous event - #9282

Merged
Esteban82 merged 2 commits into
masterfrom
meca-fix-A-I
Oct 30, 2026
Merged

Esteban82 merged 2 commits into
masterfrom
meca-fix-A-I

Conversation

@Esteban82

@Esteban82 Esteban82 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Description of proposed changes
Two settings that are read per event in meca (and coupe) leaked into the events that follow:

  • -A (coupe -D): if an event gives an alternate location (newX newY), or offsets dx dy with +o, the next events that give none are moved to that same place (or by the same offset). In the image the second event is drawn on top of the first one.
  • -I with intensities read from the file (without -C): each intensity was applied on top of the fill already shaded for the previous event, so events with the same intensity get darker and darker.

Both values are now reset for each event.

Reproduction

#!/usr/bin/env bash
# meca -A and -I carry over from one event to the next.
# Left:  only event 1 gives an alternate location (3,3), but event 2 is also moved there.
# Right: all four events have intensity -0.5, but each one is darker than the previous.
# Blue crosses mark the true event locations.
gmt begin meca_per_event png
	gmt set FONT_TITLE 13p
	gmt basemap -R-1/7/-1/7 -JX6c -Bafg -B+t"-A: newX newY only for event 1"
	gmt meca -Sa1.2c+f9p -Gred -A+p1p,red << EOF
0 0 10 0 45 90 5 3 3 Event-1
5 5 10 0 45 -90 5 Event-2
EOF
	gmt plot -Sx0.4c -W1.5p,blue << EOF
0 0
5 5
EOF
	gmt basemap -R0/8/0/2 -JX9c/3c -Baf -B+t"-I: intensity -0.5 for all events" -X7.5c -Y1.5c
	gmt meca -Sa1c -Gred -I << EOF
1 1 10 0 45 90 5 -0.5
3 1 10 0 45 90 5 -0.5
5 1 10 0 45 90 5 -0.5
7 1 10 0 45 90 5 -0.5
EOF
gmt end show

Before this PR:

meca_per_event_bug

After this PR:

meca_per_event_fix

Bugs found and fixed by Claude Opus 5.5.

Esteban82 and others added 2 commits October 29, 2026 12:51
- -A: an event without newX newY (or without dx dy for -A+o) after one
  that had them was drawn at the previous event's alternate location or
  offset. Reset both for each record.
- -I: intensities read from the file (without -C) were applied on top of
  the fill already illuminated for the previous event, so each event got
  darker or brighter. Start each event from the -G fill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same two bugs as in meca: -D (with newX newY or +o offsets) and -I with
intensities from the file (without -C) were applied to the next event
too. Extend the meca tests to coupe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Esteban82
Esteban82 requested review from joa-quim and seisman October 29, 2026 19:36
@Esteban82 Esteban82 added bug Something isn't working add-changelog Add PR to the changelog labels Oct 29, 2026
@Esteban82
Esteban82 merged commit 66cf4ee into master Oct 30, 2026
17 of 19 checks passed
@Esteban82
Esteban82 deleted the meca-fix-A-I branch October 30, 2026 01:38
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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants