How to print statistics for a column of a table

Hello!

How can I print statistics (mean, median, mode, std dev, MAD, LMS scale) for a certain column of a table?

I could hack it with grdinfo and some extra steps, but it’s not a grd.

I seem to recall doing this with one simple call of pshistogram in GMT 4 or 5, but I haven’t been able to figure it out in GMT 6. Either my memory is incomplete or the syntax has changed.

Any help would be much appreciated.

Thanks!

Hello @mkbarker,

Hm. Can you please post the code you were using with GMT 4 or 5? I feel this can be helpful for other to check how this can be done in GMT 6. As we are already at GMT 6.5 it is not unlikely that things have changed.

The promise has always been that all past syntax’s are still accepted. As long as they are not mixed with the newer ones.

Unfortunately, I don’t remember the exact syntax, but the closest I’ve gotten with GMT 6 pshistogram is:
cat mytable.txt | pshistogram -I -i3 -T0.01
0.400706297514 0.978123016204 0 3
which I believe are the min, max of column 3, and then two other numbers I don’t know.

Well, gmtmath has all stats operators you may wish.

OK, but how do I get gmtmath to compute multiple statistics (e.g., MAD, STD, etc.) simultaneously on one column? I don’t want to issue the command (and read the input table) multiple times.

In one column? or one column per operator ?

You can use the ‘store’ mechanism with -o to achieve that I suppose ?