Grdtrack output format

Hi,

I use grdtrack to extract grid points from a grid. The file with the grid points looks like this:

lon   lat   name   altitude
7.4475   46.9480   Bern   540

Now, grdtrack inserts the value from the grid between the latitude-column and name-column. Is it possible with an option that grdtrack inserts the value from the grid at the end (after the altitude)?

Like this:

lon   lat   name   altitude   sample
7.4475  46.9480   Bern   540   0.8782911

I am using GMT 6.1.1. Under GMT 4.5.5 the value (sample) was added at the end of the line by default.

Thank you for the support!

One big change from GMT 4 to 5 and 6 that is not backwards compatible is the handling of mixed data and text records. In GMT5 onwards we have a numerical column section followed by an optional text section. There are lots of reasons for this, not at least knowing column order (I you had Hong Kong as city then is that 2 columns?) as well as parsing. So your best approach is to ensure your data tables follow that format. As it is, the 540 is not seen as a number but part of the trailing text “Bern 540”.

1 Like

Thanks for the information pwessel! I will modify my analysis script.