Adjusting GMT version 4 compatible scripts so they can run in version 6

Hello everyone

I am just starting out using GMT and as it so happens I need to run scripts that are compatible with version 4 of GMT.

I have version 6 of GMT and the scripts are not running and I believe it might be because of differences between versions.

At first I tried to just install version 4 but could not figure out how to do that.

Could anyone on here give me tips on how to install version 4 on Linux?

Or else, does anyone here have experience in changing gmt4 compatible scripts so they can run in version 6 and could give me tips on how to do that?

Thank you

Hi there, I assume you have had a look at the migration page? If not, see what works for you there. GMT 6 should be compatible with GMT 4 scripts once you handle the lack of the “gmt” command in the old script via the migration steps.

1 Like

Few things I noticed where slightly modified syntax made my old scripts misbehave:

  • grdsample -Ql --> -nl
  • linewidths specified as -W8 --> -W4 (defaults is thicker, depending on the setting)
  • vector sticks -SV0.1/0/0 no good, use -SV0.1/0.01/0.01
  • psscale -D3/3/4/.2 --> -Dx3/3/4/.2 (to avoid Warnings)

this is all in the man pages of course.

1 Like

Hi @thwbecker, that is useful. We just merged a PR that adds -Q back to grdsample in compatibility mode 4. Linewidths is a bit trickier since in the dark past units were 1/300th of an inch (our dpi internally in PS) but now it is always assumed to be in points. So 8 as in 8/300 would have been 72*8/300 = ~1.9p I think. Vector sticks: I should be able to allow 0/0 - what happens if you use it? Finally, I will have a look at your scale args example

For the vectors, they seem to bomb with the /0/0 old-style specification / not get plotted, from what I recall.

The psscale stuff is implemented nicely, it works and just throws a warning which to sensitive souls like me can be upsetting.

Point taken as to linewidth, not a big deal to change. I’m liking the “new” features of GMT 5/6 now that I’ve arrived from the stone age.

FYI, we have committed two PRs to master: The first re-allows the old /0/0 specification for the GMT4 vectors - there was a small porting bug that triggered GMT to try to read size from file when 0/0/ was found and this was fixed. The second allows the -Dx/y/w/h GMT4 syntax in psscale. As is, this crashed in GMT 6 but now is treated like any other deprecated syntax, meaning it is quietly allowed if compatibility level is 4 and -Vc is not used. Using -Vc will report on deprecated syntax.
This is all part of our stated goal of having GMT 6 be backwards compatible with GMT 4 to the extent possible.

Awesome, thanks! This will help with future script adjustments!