Grdtrack : error in min and max values calculation?

Dear all,

I use grdtrack with gmt 6.2.0 (on Windows). I wonder if there is an error in grdtrack for min and max calulation.

I tried to plot crossed-profiles with grdtrack, as explained in the gmt example gallery (n°33).

In this example a multiple-track profile is plotted with a confidence interval in light grey :

By the way, I think there is a confusion in this example (it is not the main issue of this post, but it is an important point to explain my problem) : the grey enveloppe doesn’t show the upper/lower values encountered, but the upper / lower bound of the 95% confidence interval. Indeed, the code to generate this enveloppe is the following:

gmt convert stack.txt -o0,5 > env.txt
gmt convert stack.txt -o0,6 -I -T >> env.txt

Yet, according to the grdtrack documentation (see -S argument), columns 5 and 6 corrspond to the lower and upper confidence bounds (and not to the upper/lower values):

The leading column holds cross distance, while the first four columns in a group hold stacked value, deviation, min value, and max value, respectively. If method is one of a|m|p then we also write the lower and upper confidence bounds (see +c)

So I tried to plot the same profile but using minimum and maximum values for the enveloppe. To do so, I used exactly the same code as in the example mentionned above, except that I used columns 3 and 4 to generate the grey envelope. These columns correspond to the min and max values according to the grdtrack documentation (see link and citation above). So the code I used to generate the envelope is now:

gmt convert stack.txt -o0,3 > env.txt
gmt convert stack.txt -o0,4 -I -T >> env.txt

Here appear the issue this post aims to raise:

At each point of the graph, the minimum value plotted seems to correspond to the lower value among all the minimum values encountered since the origin of the graph (and equivalent for maximum, but with the upper value).

(note that to obtain this figure I also changed the min and max of the Y-axis of the example code, to better visualize.)

Instead of this result, I would expect to obtain an enveloppe with the local minimum and maximum values i.e. to get the minimum/maximum value among all the values obtained at a same “distance from the ridge”.

Is it a bug or do I have missed something in the way grdtrack works ?

Thanks in advance for your help.

Thanks for pointing out this bug so clearly. I have submitted a PR to master and expect this to be approved and merged very shortly.

Thank you for your feedback.

Now approved and merged into GitHub master.