Psconvert not recognized in generic mapping tool

Can someone help me with my problem, i cant use psconvert in GMT.5.1.2, here is the problem

GMT5.2 is very old. You are on Windows where it costs nothing to update.

At that time the psconvert program was called ps2raster. But you will have troubles with GMT5.2 because you have spaces in your file names. Normally one get problems when we use spaces in names (directory names are part of the file name), even more with old GMT versions.

And, sorry but, please past the error messages as text wrapped under triple back-ticks instead of screen-capture images.

sorry i’m a student and i try to learn GMT all by self, i’ve been upgrading my gmt to the newest and deleted the spaces in directory name but i still cant run the syntac.

D:\1.Dokumen\Paper\MATERIHypoDDPUSLITBANG\GMT\Animasi>psconvert -A -Tg -P animasi.ps -Ftmp\1481039105 -E100
GPL Ghostscript GIT PRERELEASE 9.54.0: **** Could not open the file 'tmp\1481039105.png'.
Error: /invalidfileaccess in --showpage--
Operand stack:
   1   true
Execution stack:
   %interp_exit   .runexec2   --nostringval--   showpage   --nostringval--   2   %stopped_push   --nostringval--   showpage   showpage   false   1   %stopped_push   1990   1   3   %oparray_pop   1989   1   3   %oparray_pop   1977   1   3   %oparray_pop   1978   1   3   %oparray_pop   showpage   showpage   2   1   1   showpage   %for_pos_int_continue   1981   1   7   %oparray_pop   showpage   showpage   1840   0   9   %oparray_pop   showpage   showpage
Dictionary stack:
   --dict:776/1123(ro)(G)--   --dict:1/20(G)--   --dict:80/200(L)--   --dict:80/200(L)--   --dict:133/256(ro)(G)--   --dict:318/325(ro)(G)--   --dict:33/64(L)--   --dict:6/9(L)--   --dict:6/20(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript GIT PRERELEASE 9.54.0: Unrecoverable error, exit code 1
psconvert [ERROR]: System call [@"C:/programs/gmt6/bin/gswin64c.exe" -q -dNOPAUSE -dBATCH -dNOSAFER -dPDFSETTINGS=/prepress -dDownsampleColorImages=false -dDownsampleGrayImages=false -dDownsampleMonoImages=false -dUseFlateCompression=true -dEmbedAllFonts=true -dSubsetFonts=true -dMonoImageFilter=/FlateEncode -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dSCANCONVERTERTYPE=2 -dALLOWPSTRANSPARENCY -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=2 -dTextAlphaBits=4 -sDEVICE=png16m  -g693x642 -r100 -sOutputFile="tmp\1481039105.png" "animasi_intermediate.pdf"] returned error 1.

Do you have a sub-directory of current dir called tmp? Why are you using the above -F option? Try without it.

after i followed your instruction the previous problem solved, but program on the terminal still looping and there is a warning like this, the file.png was created but the animation still not work

D:\1.Dokumen\Paper\MATERIHypoDDPUSLITBANG\GMT\Animasi>gawk "{if ($1<=1481049905) print $5,$4,$6,$7*0.04}" datatmp   | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -t80 -K  1>>animasi.ps
psxy [WARNING]: Mismatch between actual (1) and expected (4) fields near line 2 in file <Standard Input>

Well, the program is right. That line (third line) has 1 numeric field when 4 are needed. It’s up to the user to ensure that proper data is feed to the program.

the program still looping untul now even input data is only 5 event. should i wait untill the program finished?

can you give me any recomendation blog/video i can learn about GMT 6 for a beginner till an advance please

We have a very good documentation, that’s what you should read. Way, way better than videos.

Prepare your data as a separate file, LOOK at it and see why the program is complaining. We cannot tell more from an instruction such

gawk “{if ($1<=1481049905) print $5,$4,$6,$7*0.04}” datatmp | ...

would you mind to check this for me please, i really need this to made an animation but it is keep fail and i dont know where is the problem, thank you before

set F=animasi.ps
set R=95.85/96.5/5/5.65
set JM=15
set data=data.txt

mkdir tmp
@echo off
#BARIS AWAL DATA SETELAH HEADER ADALAH BARIS KE 14
set start=14
set num2=1 
for /f "delims=*" %%a in ('gawk "END {print NR}" %data%') do set stop=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-]" "NR==%start% {printf \"%%i\", $1}" %data%') do set year=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-]" "NR==%start% {printf \"%%i\", $2}" %data%') do set month=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-]" "NR==%start% {printf \"%%i\", $3}" %data%') do set day=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-]" "NR==%start% {printf \"%%i\", $4}" %data%') do set hour=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-]" "NR==%start% {printf \"%%i\", $5}" %data%') do set minute=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-|.]" "NR==%start% {printf \"%%i\", $6}" %data%') do set second=%%a

#HITUNG JUMLAH DETIK
set /a z=(14-100%month%%%100)/12, y=10000%year%%%10000-z
set /a ut=y*365+y/4-y/100+y/400+(153*(100%month%%%100+12*z-3)+2)/5+%day%-719469
set /a waktu=ut*86400+100%hour%%%100*3600+100%minute%%%100*60+100%second%%%100
gawk "NR==%start%  {print %waktu%-25200,$0}" %data% > datatmp

:loop
set /a start= %start% + %num2%
if %start% GTR %stop% goto close
goto open

:open
for /f "delims=*" %%a in ('gawk -F"[\t|:|-]" "NR==%start% {printf \"%%i\", $1}" %data%') do set year=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-]" "NR==%start% {printf \"%%i\", $2}" %data%') do set month=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-]" "NR==%start% {printf \"%%i\", $3}" %data%') do set day=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-]" "NR==%start% {printf \"%%i\", $4}" %data%') do set hour=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-]" "NR==%start% {printf \"%%i\", $5}" %data%') do set minute=%%a
for /f "delims=*" %%a in ('gawk -F"[\t|:|-|.]" "NR==%start% {printf \"%%i\", $6}" %data%') do set second=%%a
set /a z=(14-100%month%%%100)/12, y=10000%year%%%10000-z
set /a ut=y*365+y/4-y/100+y/400+(153*(100%month%%%100+12*z-3)+2)/5+%day%-719469
set /a waktu=ut*86400+100%hour%%%100*3600+100%minute%%%100*60+100%second%%%100
gawk "NR==%start%  {print %waktu%,$0}" %data% >> datatmp
goto loop

:close
echo on

#MENAMBAHKAN WAKTU SATU JAM SEBELUM DATA AWAL DAN SATU JAM SETELAH DATA AKHIR DENGAN STEP 360 DETIK ATAU 6 MENIT
for /f "delims=*" %%a in ('gawk "NR==1 {print $1-3600}" datatmp') do set starteq=%%a
for /f "delims=*" %%a in ('gawk "END {print $1+3600}" datatmp') do set stopeq=%%a
set step=360

:loopeq
set /a starteq= %starteq% + %step%
if %starteq% GTR %stopeq% goto closeeq
goto openeq

:openeq
#MEMBUAT PETA SEISMISITAS
pscoast -R%R% -JM%JM% -Dh -W1 -K -Slightblue -Gpalegreen4 -B0.3 > %F%
psxy -R -JM sesar.gmt -K -O -W1,black >> %F%
psxy -R -JM jlnlokal.gmt -K -O -W1,gray >> %F%
psxy -R -JM jlnkolektor.gmt -K -O -W1,white >> %F%
psxy -R -JM jlnarteri.gmt -K -O -W2,khaki2 >> %F%
echo 96 5.32 Sigli | pstext -R -JM -O -K -F+f12,Bookman-Demi >> %F%

#SET TRANSPARANSI UNTUK DATA GEMPA YANG SUDAH TERJADI
gawk "{if ($1<=%starteq%) print $5,$4,$6,$7*0.04}" datatmp | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -t80 -K >> %F%
gawk "{if ($1>%starteq% && $1<=%starteq%+%step%) print $5,$4,$6,$7*0.04}" datatmp | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -t60 -K >> %F%
gawk "{if ($1>%starteq%+%step% && $1<=%starteq%+%step%+%step%) print $5,$4,$6,$7*0.04}" datatmp | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -t40 -K >> %F%
gawk "{if ($1>%starteq%+%step%+%step% && $1<=%starteq%+%step%+%step%+%step%) print $5,$4,$6,$7*0.04}" datatmp | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -t20 -K >> %F%
gawk "{if ($1>%starteq%+%step%+%step%+%step% && $1<=%starteq%+%step%+%step%+%step%+%step%) print $5,$4,$6,$7*0.04}" datatmp | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -K >> %F%
gawk "BEGIN {print strftime(\"%%d-%%m-%%Y %%H:%%M:00 UTC\",%starteq%);}" | gawk "{print 96.35,5.6,$0}" | pstext -R -JM -O -F+f12,Bookman-Demi -K >> %F%
pscoast -R95/99/2/6 -JM4 -Dh -W1 -K -O -Slightblue -Gwhite -B3::wEsN --MAP_FRAME_TYPE=plain --FONT_ANNOT_PRIMARY=8p >> %F%
echo 95.85 5 > kotak
echo 95.85 5.65 >> kotak
echo 96.5 5.65 >> kotak
echo 96.5 5 >> kotak
echo 95.85 5 >> kotak
psxy -R -JM kotak -O -W1,red >> %F%
psconvert -A -Tg -P %F% -Ftmp\%starteq% -E100

goto loopeq
:closeeq

#KONVERSI KE FILE GIF DENGAN DELAY 10 (FPS=100/10=10) DAN LOOP 0 (KEMBALI KE AWAL)
converts -delay 10 -loop 0 tmp/*.png animasi.gif
del datatmp gmt.history kotak %F% 
rd /S /Q tmp

i got all the file needed from the link above

Panjang sangat lah skript itu, boleh bagi ‘datatmp’ file sahaja di sini kah? (The script is very long, can you just provide the ‘datatmp’ file here please?).

this is data.txt, datatmp and file .bat

datatmp.zip (528 Bytes)
animasi.zip (1.5 KB) data.zip (731 Bytes)

Not sure if it would help, but could you try changing the double quotes "..." to single quotes '...'? This works for me on Linux:

gawk '{if ($1<=1481049905) print $5,$4,$6,$7*0.04}' datatmp
# 96.11 5.3 10 0.16

but using double-quotes didn’t work. I managed to generate one frame at least:

export starteq=-3600
export stopeq=3600
#export starteq=$starteq + $step
#if $starteq GTR $stopeq goto closeeq
#goto openeq

#:openeq
#MEMBUAT PETA SEISMISITAS
#MAKE SEISMIC MAP
pscoast -R$R -JM$JM -Dh -W1 -K -Slightblue -Gpalegreen4 -B0.3 > $F
psxy -R -JM sesar.gmt -K -O -W1,black >> $F
psxy -R -JM jlnlokal.gmt -K -O -W1,gray >> $F
psxy -R -JM jlnkolektor.gmt -K -O -W1,white >> $F
psxy -R -JM jlnarteri.gmt -K -O -W2,khaki2 >> $F
echo 96 5.32 Sigli | pstext -R -JM -O -K -F+f12,Bookman-Demi >> $F

#SET TRANSPARANSI UNTUK DATA GEMPA YANG SUDAH TERJADI
#SET TRANSPARENCY FOR EARTHQUAKE DATA THAT HAS ALREADY HAPPENED
gawk '{if ($1<=$starteq) print $5,$4,$6,$7*0.04}' datatmp | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -t80 -K >> $F
gawk '{if ($1>$starteq && $1<=$starteq+$step) print $5,$4,$6,$7*0.04}' datatmp | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -t60 -K >> $F
gawk '{if ($1>$starteq+$step && $1<=$starteq+$step+$step) print $5,$4,$6,$7*0.04}' datatmp | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -t40 -K >> $F
gawk '{if ($1>$starteq+$step+$step && $1<=$starteq+$step+$step+$step) print $5,$4,$6,$7*0.04}' datatmp | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -t20 -K >> $F
gawk '{if ($1>$starteq+$step+$step+$step && $1<=$starteq+$step+$step+$step+$step) print $5,$4,$6,$7*0.04}' datatmp | psxy -R -JM -Sci -Ctabel.cpt -W1 -O -K >> $F
gawk 'BEGIN {print strftime("%%d-%%m-%%Y %%H:%%M:00 UTC",$starteq);}' | gawk '{print 96.35,5.6,$0}' | pstext -R -JM -O -F+f12,Bookman-Demi -K >> $F
pscoast -R95/99/2/6 -JM4 -Dh -W1 -K -O -Slightblue -Gwhite -B3::wEsN --MAP_FRAME_TYPE=plain --FONT_ANNOT_PRIMARY=8p >> $F
# MEMBUAT KOTAK
# MAKE A BOX
echo 95.85 5 > kotak
echo 95.85 5.65 >> kotak
echo 96.5 5.65 >> kotak
echo 96.5 5 >> kotak
echo 95.85 5 >> kotak
psxy -R -JM kotak -O -W1,red >> $F
psconvert -A -Tg -P $F -Ftmp/$starteq -E100

#goto loopeq
#:closeeq

i can generate all frame before but when it comes to convert file.png to file.gif it doesnt work

On Windows gawk (and others) must use double quotes instead of single.