Gmtselect issue with output columns (again!)

Seems me and gmtselect just don’t get along!

Trying to specify input and output columns.

(File “point.txt” contains “150.0 40.0”)

gmtselect <<END -Cpoint.txt+d100k -fg
150.1 40.1 A
150.2 40.1 B
END

Gives:

150.1 40.1 A
150.2 40.1 B

(as expected)

gmtselect <<END -Cpoint.txt+d100k -fg -o2,1,0
150.1 40.1 A
150.2 40.1 B
END

Gives:

NaN 40.1 150.1
NaN 40.1 150.2

Why isn’t column 2 output?

Tried specifying it as input (just in case this is what is expected):

gmtselect <<END -Cpoint.txt+d100k -fg -i0,1,2 -o2,1,0
150.1 40.1 A
150.2 40.1 B
END

Gives:

NaN 40.1 150.1
NaN 40.1 150.2

Seems it only works when long/lat are the first two columns.
Any idea what’s going on?
R

OK. Just realised that it’s getting upset because the extra columns are text and not numbers.
Why can’t it just pass the text columns?

All numerical columns come first, follow by any trailing text. See https://docs.generic-mapping-tools.org/dev/cookbook/options.html#input-columns-selection-the-i-option
If you want text in the position of x and y then awk is your only option.

1 Like