Pscoupe not outputting text files for projected focal mechanisms in GMT 6.2 or 6.3

Hi GMT crew,

I am having trouble getting pscoupe to output the text files (Aa* and Aa*_map) containing the projected focal mechanisms in GMT 6.2 and 6.3. It works fine in 6.1.1. I can see in pscoupe.c that some of the code printing to the output files changed between 6.1.1 and 6.2, but I can’t tell why the files aren’t writing.

I have replicated the problem below using 6.1.1, 6.2 and 6.3. Note that I send the output to /dev/null as I don’t need the plot, only the output files. Any help is greatly appreciated as always!

> gmt --version
6.1.1
> gmt pscoupe profiles/cmt_thrust_pscoupe.txt -R0/967.950524857/-100/6500 -JX5i/-2i -Aa154.8/-11.2500022497/161.2/-5.25003374578/90/50k/0/6500 -Sm0.05i -Xc -Yc > /dev/null
> ls -l Aa*
-rw-r–r-- 1 kylebradley staff 5502 Jan 18 10:11 Aa154.8_-11.3_161.2_-5.3_90_50_0_0
-rw-r–r-- 1 kylebradley staff 1918 Jan 18 10:11 Aa154.8_-11.3_161.2_-5.3_90_50_0_0_map

> gmt --version
6.2.0
> gmt pscoupe profiles/cmt_thrust_pscoupe.txt -R0/967.950524857/-100/6500 -JX5i/-2i -Aa154.8/-11.2500022497/161.2/-5.25003374578/90/50k/0/6500 -Sm0.05i -Xc -Yc > /dev/null
> ls -l Aa*
ls: Aa*: No such file or directory

> gmt --version
6.3.0
> gmt pscoupe profiles/cmt_thrust_pscoupe.txt -R0/967.950524857/-100/6500 -JX5i/-2i -Aa154.8/-11.2500022497/161.2/-5.25003374578/90/50k/0/6500 -Sm0.05i -Xc -Yc > /dev/null
> ls -l Aa*
ls: Aa*: No such file or directory

As far as I can tell, as long as -Q is not used and -S is, it works, e.g.

echo "112 32 25 30 90 0 4 Strike-slip" | gmt coupe -Sa1c -Aa111/33/119/33+d90+w500+z0/50+r -JX15c/-8c -Bxaf+l"Distance (km)" -Byaf+l"Depth (km)" -BWSen -pdf map

Does that command produce A* files for you?

Here’s the debug output during a call to pscoupe in 6.1.1 and 6.4. Can’t say I understand what’s going on but 6.4 seems to be crashing.

6.1.1
pscoupe [DEBUG]: History: Process -R0/967.950524857/-100/6500
pscoupe [DEBUG]: History: Process -JX5i/-2i
pscoupe [DEBUG]: History: Process -Xc
pscoupe [DEBUG]: History: Process -Yc
pscoupe [DEBUG]: gmt_get_filename: In: 0/967.950524857/-100/6500 Out: 0/967.950524857/-100/6500
pscoupe [DEBUG]: Look for file 0/967.950524857/-100/6500 in /Users/kylebradley/.gmt
pscoupe [DEBUG]: Look for file 0/967.950524857/-100/6500 in /Users/kylebradley/.gmt/cache
pscoupe [DEBUG]: Look for file 0/967.950524857/-100/6500 in /Users/kylebradley/.gmt/server
pscoupe [DEBUG]: Got regular w/e/s/n for region (0/967.950524857/-100/6500)
pscoupe [DEBUG]: gmt_get_filename: In: profiles/cmt_thrust_pscoupe.txt Out: profiles/cmt_thrust_pscoupe.txt
pscoupe [DEBUG]: Found readable file profiles/cmt_thrust_pscoupe.txt
pscoupe [DEBUG]: Replace file profiles/cmt_thrust_pscoupe.txt with path profiles/cmt_thrust_pscoupe.txt
pscoupe [DEBUG]: Replace file profiles/cmt_thrust_pscoupe.txt with profiles/cmt_thrust_pscoupe.txt
pscoupe [DEBUG]: Projected values in meters: 0 967.951 6500 -100
pscoupe [INFORMATION]: Map scale is 0.0762166 km per cm or 1:7621.66.
pscoupe [DEBUG]: Running in PS mode classic

6.4 (most recent build from git)
pscoupe [DEBUG]: History: Process -R0/967.950524857/-100/6500
pscoupe [DEBUG]: History: Process -JX5i/-2i
pscoupe [DEBUG]: History: Process -Xc
pscoupe [DEBUG]: History: Process -Yc
pscoupe [DEBUG]: Look for file 0/967.950524857/-100/6500 in /Users/kylebradley/.gmt
pscoupe [DEBUG]: Look for file 0/967.950524857/-100/6500 in /Users/kylebradley/.gmt/cache
pscoupe [DEBUG]: Look for file 0/967.950524857/-100/6500 in /Users/kylebradley/.gmt/server
pscoupe [DEBUG]: Got regular w/e/s/n for region (0/967.950524857/-100/6500)
pscoupe [DEBUG]: Found readable file profiles/cmt_thrust_pscoupe.txt
pscoupe [DEBUG]: Replace file profiles/cmt_thrust_pscoupe.txt with path profiles/cmt_thrust_pscoupe.txt
pscoupe [DEBUG]: Replace file profiles/cmt_thrust_pscoupe.txt with profiles/cmt_thrust_pscoupe.txt
gmt [DEBUG]: Entering GMT_Destroy_Session

Thanks, I figured it out. I hadn’t realized that the format for -A changed between 6.1 and 6.2. Perhaps pscoupe could fail with a more informative message if the old format with arguments separated by “/” is detected, rather than just crashing? I imagine there are some scripts floating around that will be broken just by the change in -A, so a message could help others fix that more easily. Old news I know, 6.1->6.2 did happen quite a while ago!

All the best - Kyle

We do honor the old -A format and parse it, but pretty sure your 50k is not going to be read properly. Please post a single command with the old format and a single data point, e.g.

echo “one of your data records” | gmt pscoupe “your particular command”

so I can reproduce and see if there is a problem with the old parser.

GMT 6.1.1 works with the 50k in the old format for -A:

echo “154 -8.0000 33.000000 3.4677 -1.12989 -2.34093 2.48763 -1.42641 2.01632 22 156.36 -8.25 B022679A” | gmt pscoupe -R0/967.950524857/0/100 -JX5i/-2i -Aa154/-11/154/-5/90/50k/0/6500 -Sm0.05i -Xc -Yc -Bxaf -Byaf > test.ps

head Aa154.0_-11.0_154.0_-5.0_90_50_0_0

331.739920 33.000000 33.000000 -0.502766 0.744765 -0.242669 0.306353 -0.433049 0.534273 22 0 0 B022679A

GMT 6.2 fails with the same command:

pscoupe [DEBUG]: Look for file 200/500/0/100 in /Users/kylebradley/.gmt/server
pscoupe [DEBUG]: Got regular w/e/s/n for region (200/500/0/100)
gmt [DEBUG]: Entering GMT_Destroy_Session

Both GMT 6.1.1 and 6.2 work correctly with 50 instead of 50k, using the old format:

echo “154 -8.0000 33.000000 3.4677 -1.12989 -2.34093 2.48763 -1.42641 2.01632 22 156.36 -8.25 B022679A” | gmt pscoupe -R200/500/0/100 -JX5i/-2i -Aa154/-11/154/-5/90/50/0/6500 -Sm0.05i -Xc -Yc -Bxaf -Byaf > test.ps

So that means my 50k argument was always wrong but just happened to work up to 6.1.1. So all issues were on my end - thanks for the help!

Kyle

Thanks, the issue is that the older versions did not bother to check if the sscanf conversion was successful, whereas 6.2 and onward detected the error but then kept the reason to itself.

I have updated a pull request that adds an error message when scanning fails as well as letting the program. Since your 0/6500 are never parsed and they are uninitialized it needs to be an error.

See the PR on GitHub.

Now merged into master.