Hi,
I have the following observation with gmtselect, using either an area (-R) or polygon (-F) on a file which has x y and a third column which can be mixed as a text string or number. The outcome is that sometimes the text strings are printed as NaN, and this seems to depend on the value in the first line.
Example:
file1:
0.25 0.25 A
0.5 0.5 1
1.7 0.7 B
0.7 0.7 C
2 2 3
file2 = file 1, excluding the first line
gmtselect -R0/1/0/1 file1:
0.25 0.25 A
0.5 0.5 1
0.7 0.7 C
gmtselect -R0/1/0/1 file2:
0.5 0.5 1
0.7 0.7 NaN
So if the z-value in the first line contains a text string, the output appears correct, but not if it is a number.
See the -i option. Should be something like -i0-1,2t
to always select third column as text.
Thanks Joaquim, this -i allows indeed for interesting set of options.
However, it does not seem to work on the example, when adding the -i syntax.
Sorry, it seems to be working for even without -i. What am I missing?
printf "0.5 0.5 1\n0.7 0.7 NaN" | gmtselect -R0/1/0/1
0.5 0.5 1
0.7 0.7 NaN
printf "0.25 0.25 A\n0.5 0.5 1\n1.7 1.7 B\n0.7 0.7 NaN" | gmtselect -R0/1/0/1
0.25 0.25 A
0.5 0.5 1
0.7 0.7 NaN
I agree, that works. The example underneath does not seem to work (here). The only difference between the two files is that I exchanged the first two lines, and hence, the results should be identical. The result of test 1 gives me NaN instead of A and C, the result of test 2 is correct.
echo “Test 1”
echo “.5 .5 1” > temp
echo “.25 .25 A” >> temp
echo “1.7 .7 B” >> temp
echo “.7 .7 C” >> temp
gmtselect -R0/1/0/1 temp
echo “Test 2”
echo “.25 .25 A” > temp
echo “.5 .5 1” >> temp
echo “1.7 .7 B” >> temp
echo “.7 .7 C” >> temp
gmtselect -R0/1/0/1 temp
OK, I see (get the same). The bug here is that the t in -i0-1,2t is being ignored.
Please open an issue on this.
Thanks, Joaquim. I opened an issue on github on the matter.
Thanks, but please add the -i information part. That’s the most important part here because the other behavior is not a bug. We don’t test all the columns to see if they are a mix o text and numbers, apparently only the first row of each column.