ggab
October 7, 2020, 12:19pm
1
Hello everyone,
I am using GMT 6.1.0 and I don’t know how to create my “ps” file in the right directory.
Let me explain.
I am a script with the line command : “gmt begin MyPlot X D/MyDirectory”
if X format is pdf, png, jpg, It’s OK. The file MyPlot.X is created in the good directory.
If X is “ps”, the file is created in the directory of the script execution.
Thank for your help,
Regards
Germinal
using the following commands on Linux:
#!/bin/bash
for X in pdf png jpg ps; do
gmt begin $PWD/D/MyDirectory/MyPlot $X
gmt basemap -R0/2/0/2 -Jx5c -Ba0.5
gmt end
done
The MyPlot.ps is created in the current directory, both to GMT 6.2.0 and 6.1.0
Should open an issue in the GitHub?
ggab
October 7, 2020, 3:22pm
3
Hello MarceloBanik,
Thank for the response but I have not the same thing.
I am in the D1 directory witch contain a TEST2 directory with the csh1 script below:
#!/bin/bash
gmt begin $PWD/TEST2/MyPlot pdf
gmt basemap -R0/2/0/2 -Jx5c -Ba0.5
gmt end
gmt begin $PWD/TEST2/MyPlot jpg
gmt basemap -R0/2/0/2 -Jx5c -Ba0.5
gmt end
gmt begin $PWD/TEST2/MyPlot ps
gmt basemap -R0/2/0/2 -Jx5c -Ba0.5
gmt end
If I launch this script : csh TEST/csh1
MyPlot.jpg and MyPlot.pdf are created in the good directory ($PWD/TEST2)
MyPlot.ps is created in $PWD
as current directory == $PWD, then we have the same results, and I thing it is a bug.
running with option -Vd, I noted that when it is ps, it says:
psconvert [DEBUG]: Copying /home/marcelo/.gmt/sessions/gmt_session.139980/psconvert_139983d.eps → MyPlot.ps
when it is pdf, it says:
psconvert [DEBUG]: Running:
gs -q … -sOutputFile=‘/home/marcelo/gmt/forum/tmp/D/MyDirectory/MyPlot.pdf’ …
So appears that the problem is in the psconvert module.
appears that, at least for the simple test I posted here, the following patch solve this issue.fix_ps_path.zip (841 Bytes)
@MarceloBanik , maybe a PR please?
I hope I did it correctly:
save the PS file including the path
#4298 opened 2 minutes ago by MarceloBanik
ggab
October 13, 2020, 3:56pm
9
Hello,
Sorry for the delay !
Thanks for the solution but now, with the GMT5 version and later, I don’t knows where are the sources and how do to include your patch ?
Regards
Germinal
as the correction has already been done in the source code, I think the easiest way is to install from it. See:
https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md