Psclip difficulities

I am using GMT 6.4.0 on Windows 11. I am trying to execute the below script

------------------------------------
rem xyz2grd FREQ.txt -Gtest.grd -R129/146/30/46 -I1m -V
surface FREQ.txt -Gtest.grd -R129/146/30/46 -I1m -V
grd2cpt test.grd -Cseis -I -L-0.6/1.3 -S0.01/1.3/0.01 -Qi -D-0.6/1.3 > colors.cpt
rem nearneighbor FREQ.txt -Gtest.grd -R129/146/30/46 -I1m -V -S100k
psscale -Ccolors.cpt -Q -D14/4/7/0.5 -B5:Frequency:/:Hz: -K > testmap.ps
grdimage test.grd -Jm0.3i -Ccolors.cpt -P -K -O >> testmap.ps
pscoast -Jm0.3i -R129/146/30/46 -Ba5f0.g0./a5f0.g0.WSen -Df -A1 -W1p -P -V -O -Swhite >> testmap.ps
psclip clip.txt -R129/146/30/46 -Jm0.3i -O -K >> testmap.ps
psconvert -Tg -P -A testmap.ps
-------------------------------------------------
the clip.txt is containing 
130.0 40.0
136.0 40.0
136.0 45.0
130.0 45.0
---------------------------------------

but I have the below result without clipping. Could you please help to use the correct options for psclip??

You need to lay down the clip path before your image and then turn off clipping at the end. See the documentation

1 Like

I used the following script, as you recommend.
rem xyz2grd FREQ.txt -Gtest.grd -R129/146/30/46 -I1m -V
surface FREQ.txt -Gtest.grd -R129/146/30/46 -I1m -V
grd2cpt test.grd -Cseis -I -L-0.6/1.3 -S0.01/1.3/0.01 -Qi -D-0.6/1.3 > colors.cpt
rem nearneighbor FREQ.txt -Gtest.grd -R129/146/30/46 -I1m -V -S100k
psscale -Ccolors.cpt -Q -D14/4/7/0.5 -B5:Frequency:/:Hz: -K > testmap.ps
psclip clip.txt -R129/146/30/46 -Jm0.3i -Ba5f0.g0./a5f0.g0.WSen -A1 -N -K -O -V >> testmap.ps
grdimage test.grd -Jm0.3i -Ccolors.cpt -P -K -O >> testmap.ps
pscoast -Jm0.3i -R -Ba5f0.g0./a5f0.g0.WSen -Df -A1 -W1p -P -V -O -Swhite >> testmap.ps
psconvert -Tg -P -A testmap.ps
psclip -C -O -R -Jm0.3i -Ba5f0.g0./a5f0.g0.WSen -A1 >> testmap.ps

Yes, it works well now, But my problem now is How to keep the geographic boundaries and only clip the image inside the land??

Thanks so much for your help, I am really appreciating

It is OK now.
Thanks so much… I put both psclip before and after the image, then pscoast.

So many thanks.