GenericMappingTools/gmtmex

Error with psconvert on Example 2 Profilling

LoboNegro79 opened this issue · 2 comments

Description of the problem

I started using the GMTMEX on a windows computer. I start by running the examples from The GMT/MATLAB Toolbox 2017 paper. They all run as described except, for example 2 . When running the following line of code

I = gmt ('psconvert -TG -P -E300 -A', P);

I get the following error.

Full error message

psconvert [ERROR]: System call [@"C:\Program Files\gs\gs10.01.1\bin\gswin64c.exe" -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:\Users\pdq\AppData\Local\Temp/psconvert_stream_13184.ps" 2> "./psconvert_13184c.bb"] returned error 1.
GMT: Module return with failure while executing the command
psconvert -TG -P -E300 -A
Error using gmtmex
GMT: exiting

I install the latest gs version, before I had the 9.2 version and I had the same error.

Full script that generated the error
Here is the full matlab script

clear; clc; close all
% Read in relief grid and Japan trench location
G = gmt ('read -Tg JP.nc');
T = gmt ('read -Td JP.txt');
% Take gradient in N45E direction to be used for illumination
intens = gmt ('grdgradient -Nt0.8 -A90', G);
% Sample grid along profiles normal to the trench
[profiles, stack] = gmt ('grdtrack -G -C300k/1k/25k -Sm+s+a', T, G);
% Evaluate an asymmetrical color palette with hinge at sealevel
C = gmt ('makecpt', '-Cgeo -T-8000/2000');
% Make the GMT plot
P = gmt ('grdimage', ['-R141/147/35/42 -JM6i -P -Baf -BWSne -I -K -C ' ...
    '--FORMAT_GEO_MAP=dddF'], G, intens, C);
P = gmt ('pscoast', ['-R -J -O -K -W0.25p -Dh ' ...
    '-LjTR+w200k+u+f+c38:30N+o0.5i/0.2i -F+gwhite+p0.5p']);
% Use first and last point of each profile and create a polygon of the area
A = gmt('convert', '-Ef -T', profiles);
B = gmt('convert', '-El -T -Is', profiles);
area = gmt ('catsegment', [A B]); % Join the two segments
P = gmt ('psxy', '-R -J -O -K -Ggreen@85', area);
P = gmt ('psxy -R -J -O -K -W2p+v0.3c+gred+p0.25p+bc+ec', T);
P = gmt ('psxy -R -J -O -K -W0.5p,red+v0.25c+p0.25p+bt+et', profiles);
P = gmt ('psscale', ['-R -J -O -DjBL+w3i/0.1i+h+o0.3i/0.4i -C -W0.001 ' ...
    '-F+gwhite+p0.5p+i0.25p -Bxaf -By+l"km"'], C);

I = gmt ('psconvert -TG -P -E300 -A', P); % Windows Version

figure(1); clf
h = imshow (I.image); set (h, 'AlphaData', I.alpha)
% Figure 1 shows the stacked relief profiles across the trench
figure(2); clf; hold on
for k=1:length(profiles)
    plot (profiles(k).data(:,3), profiles(k).data(:,5))
end
plot (stack.data(:,1), stack.data(:,2), 'LineWidth', 3)
xlabel('Distance (km)'); ylabel ('Depth (m)')
title ('Japan Trench Profiles'); xlim ([-150 150]); grid on

System information

  • Operating system: Windows 10
  • Version of GMT: GMT 6.4
  • Version of GMTMex: Not sure of this, but I am assuming the latest from the GMT 6.4 version

👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute!

Will have a loot into this when find some time but the easiest is to just create the postscript file on disk and pass that file name as argument to psconvert.