Convert geotiff to grd file

I’m afraid I’ll have to remind this again

If you ask questions that others don’t understand you hardly get help. How do you expect that we can guess what you are doing?

I explained what I am plotting one day ago before Andreas message…could you read it, please? The code has 429 lines, so, its complicated to include every commands here.

Best,

I have read your posts but telling as what you want to do is very different from showing what you are actually doing. The script is too long? That is why there is the concept of MWE (minimal working example) where one strips down the script to its minimal basics that still show the problem. Until than the best guess you had was:

Part of the code is in the following. Nothing after the psbasemap is shown on the same figure page after the map. If I copy it to a separate code, all the spatial-temporal plot works well.

.
.
.
.
gmt psxy -R -J -O -K -W1,- >> $fig << END
-31.7 53.5
-31.7 51.5
END

gmt psxy -R -J -O -K -W1,- >> $fig << END
-30 53.5
-30 51.5
END

##plot spatial-temporal EQs distribution
gmt psbasemap -R-35.75/-29/1950-1-1T/2022-1-1T -JX25/17 -V -Gwhite -Y-18.5 --FONT_LABEL=12p,Helvetica,black --FORMAT_GEO_MAP=ddd.x -Ba1.f.5/a5Yf1YWSne -K -O >> $fig

gmt psxy -R -J -O -K -W4,gray >> $fig << END
-35.3 2022
-35.3 1950
END

gmt psxy -R -J -O -K -W4,gray >> $fig << END
-31.7 2022
-31.7 1950
END

.
.
.
.

Since you are doing gmt classic on presumably an A4 or US letter paper size, are you sure that shifting the plotting 18.5 cm below where you started is STILL inside your fixed paper size? You probably need to make your first plot start > 18.5 cm before you move below the paper. E.g., add -Y19c to your very first plot statement,

See? Nothing new. You only show that the plot is vertically shifted 18.5 cm from its previous position. And what was that previous position? Nothing is telling us that.

-Y-18.5 because its position to be below the map. The paper size is an A3. It was working normal before when I plotted an initial version times ago on Ubuntu. I think that gmt version was GMT 5.4 at that time. I am now plotting with GMT 6.4 on mac, using the following gmtset:

gmt gmtset FONT_ANNOT_PRIMARY 11 FONT_ANNOT_SECONDARY 4 FONT_TITLE 10 FONT_LABEL 4 MAP_LABEL_OFFSET 0.1c MAP_ANNOT_OFFSET_PRIMARY 0.1c MAP_ANNOT_OFFSET_SECONDARY 0.7c PS_MEDIA a3 MAP_TICK_LENGTH 0.2 PS_LINE_CAP round FORMAT_FLOAT_OUT %lg FORMAT_GEO_MAP ddd.xx MAP_FRAME_TYPE plain

.
.
.

#Map
gmt makecpt -Cjet -T-6000/-500/1 -Z > paleta.batimetria.cpt
gmt psbasemap $R -JM25 -P -Ba1f.5/a0.5f0.25WSne --FONT_TITLE=15p,Helvetica,black --MAP_TITLE_OFFSET=10p -Xc -Y28 -K > $fig
gmt grdimage -R -JM $grid.grd -Cpaleta.batimetria.cpt -I$grid.slope.ill.grd -O -K >> $fig
.
.
.
then I continue with several plots.

I changed the -Y to -Y-8.5. See the result in figure:

Forget about the right trimming (I’m using A4). It works fine with this MWE

gmt psbasemap -R-35.75/-29/51:55/53:50 -JM25 -B -Y17 -P -K > lixo.ps
gmt psbasemap -R-35.75/-29/1950-1-1T/2022-1-1T -JX25/15 -Y-15.5 -B -O >> lixo.ps

EDIT: lixo.* is what I call to all my temporary files

I tried the same command and it shows:

gmt psbasemap -R-35.75/-29/51:55/53:50 -JM25 -B -Y17 -P -K > lixo.ps | gmt psbasemap -R-35.75/-29/1950-1-1T/2022-1-1T -JX25/15 -Y-15.5 -B -O >> lixo.ps

psbasemap [ERROR]: Found no history for option -B
psbasemap [ERROR]: Found no history for option -B

The file lixo.ps does not show anything.

I did not write that.

Ok. I just created a shell file with your two commands, and the result was the same:

% ./test.sh
psbasemap [ERROR]: Found no history for option -B
psbasemap [ERROR]: Found no history for option -B

The .sh file is attached but with the extension changed to .txt for upload permission.

test.txt (163 Bytes)

Either an older GMT version or a gmt.history file getting in the way.
Make it -Ba instead of -B in my example. And no need for scripts. Just run the two commands in the shell

Yes, it worked with -Ba. How can I identify if the mac have more than one gmt? It was installed for another person.

That’s a computer managing thing.

which gmt

tells you the one you are using (the one that is first in the path order). You may, or not have more, but only one can be used at a time (the docs explain how you can swap between installed versions but probably that’s not your case).

It is 6.4.0 version installed together GMTSAR. David installed to me together of the GMTSAR last year, but I am not at IGPP anymore. I would like to try the 6.1.1 version. If I download the file .dmg it go to Applications folder. So, should I download the gmt-6.1.1-src.tar.gz and include the files at the same folder where is located (/usr/local/Cellar/gmt/)?

No complicate. Use only the latest GMT version and forget (erase all others). You have no problems in the GMT program. Only in the script.

Hi

I figured out the problem. There were two clean lines in the end of txt file read on one psxy command. And it was generating the troubles on commands in follow. Thank you for let me know its not really my GMT version. :sweat_smile: :face_with_hand_over_mouth: :grin:

Hi Guilherme,

I’m not sure what you mean by “below”. Most of the commands plot above each other. In you example there is one the basemap layer, so this is difficult to reproduce.

I changed “>>” to “>”
because it seems that you might just append to the older file.
Then I removed the “-K” and “-O” since this is a new plot.
→ -Y18 does not plot on my paper (A4), its plotting outside. This might be different in your case, since my units are in centimeter. Futhremore it depends what your papersize is.
→ ->-Y6 plots a bit shifted.

gmt psbasemap -R-35.75/-29/1950-1-1T/2022-1-1T -JX25/17 -V -Xc -Yc -Bya5Yf1Y -Bxa1.f.5 -BWSne > out.ps

Although I could not reproduce the issue, I hope this might help since this creates a basemap.

Regards
Dietrich