You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All,
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.
The example underneath illustrates this issue. The only difference between the two tests is that I exchanged the first 2 lines, so 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.
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute!
It should be gmt select temp -i0,1,t but anyway it does not work. I think we need something like that to work as it is not possible for some gmt modules like select, which is reading record by record, to detect that a later record than the first has in fact trailing text rather than the number field found at first. With -i0,1,t we would like it to use that knowledge rather than auto-figuring things out like now.
Actually, the way -i works it would not be a good place to tell a module that column 3 is text. This is a job for -f2s I think (s for string since t is already taken for time), which we currently don't have. If -f2s were implemented it would mean x and y are whatever they are for this module, but after the 2nd column everything should be considered trailing text.
"which column t" is nonsensical. t refers to the entire trailing text once it has been ingested into GMT. There are n numerical columns (n >= 0) plus optionally some trailing text. In a case like the one posted here, where the users third column cannot reliably be identified as trailing text based on the first column, we flag the third column as start of trailing text via -f2s and then all works consistently.
OK, if it is unclear to you I will re-read it and see if I can improve it, but
Default action reads the whole record, including trailing text (if the module can use it - i.e., not in surface etc). You never specify t to include trailing text, but you can use -in to skip it entirely. Would not do you any good in the poster's case since col 3 was identified as data and you end up with those NaNs
On output, again trailing text is the default for most/all modules that pass records through (ie.., not block* etc). If you do not want text on output you use -on, and if you want a mix of columns you use t, e.g., -o2,3,t
If you have the above case and need to explicitly say trailing text starts with column 2 then you use -f2s.
echo 1 2 3 text | gmt convert -it
gmtconvert [ERROR]: Selection -it (just trailing text, no numerical input) is not allowed. Consider using -ot instead, if available.
However, you do use it if you select columns and want to include the trailing text:
No, this is an observation before the updates, an example underneath. Also the column appear different
#!/bin/sh
gmtswitch gmt6
gmt grdmath -V -I.01 -R0/1/0/1 1 = test.grd
echo "0.1 0.1 A" > temp
echo ".7 .7 1" >> temp
echo "0.1 0.1 A" >> temp
echo "0.5 0.5 B" >> temp
gmt grdtrack temp -Gtest.grd
Result:
0.1 0.1 1 A
0.7 0.7 1 1
0.1 0.1 1 A
0.5 0.5 1 B
echo ".7 .7 1" > temp
echo "0.1 0.1 A" >> temp
echo "0.5 0.5 B" >> temp
gmt grdtrack temp -Gtest.grd
Result:
0.7 0.7 1 1
0.1 0.1 NaN 1
0.5 0.5 NaN 1
Maarten
From: Paul Wessel ***@***.***>
Sent: 21 June 2021 19:48
To: GenericMappingTools/gmt ***@***.***>
Cc: Maarten Vanneste ***@***.***>; Author ***@***.***>
Subject: Re: [GenericMappingTools/gmt] gmtselect issue (gmt6) (#5368)
grdtrack uses the same -i, -f, -o as any other modules. This is after the update? What is the symptoms?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#5368 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANEUELI64625UYUZNHNXG5DTT53OJANCNFSM47ACLZEQ>.
The confidentiality or integrity of this message can not be guaranteed following transmission on the Internet. The addressee should be aware of this before using the contents of this message.
Activity
welcome commentedon Jun 20, 2021
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute!
Please make sure you read our Contributing Guide and abide by our Code of Conduct.
PaulWessel commentedon Jun 20, 2021
It should be gmt select temp -i0,1,t but anyway it does not work. I think we need something like that to work as it is not possible for some gmt modules like select, which is reading record by record, to detect that a later record than the first has in fact trailing text rather than the number field found at first. With -i0,1,t we would like it to use that knowledge rather than auto-figuring things out like now.
joa-quim commentedon Jun 20, 2021
That's what I said in the forum post, though I thought the syntax should be -i0,1,2t
PaulWessel commentedon Jun 20, 2021
Actually, the way -i works it would not be a good place to tell a module that column 3 is text. This is a job for -f2s I think (s for string since t is already taken for time), which we currently don't have. If -f2s were implemented it would mean x and y are whatever they are for this module, but after the 2nd column everything should be considered trailing text.
joa-quim commentedon Jun 20, 2021
OK, but then what's the purpose of -icolt?
PaulWessel commentedon Jun 20, 2021
See https://docs.generic-mapping-tools.org/dev/gmt.html#icols-full for that. There is no 2t but there is a "column" called t.
PaulWessel commentedon Jun 20, 2021
OK, while we are taking I have implemented -fcols:
joa-quim commentedon Jun 20, 2021
I did read but the meaning of t is not obvious. Specially when it says you must explicitly add the column t to retain the text.. Which column t?
PaulWessel commentedon Jun 21, 2021
"which column t" is nonsensical. t refers to the entire trailing text once it has been ingested into GMT. There are n numerical columns (n >= 0) plus optionally some trailing text. In a case like the one posted here, where the users third column cannot reliably be identified as trailing text based on the first column, we flag the third column as start of trailing text via -f2s and then all works consistently.
Let -f<col>s explicity set start of input trailing text
joa-quim commentedon Jun 21, 2021
Sorry, but still far from clear. If one need to use t to retain the text why the -in? It seems -in equals no t.
PaulWessel commentedon Jun 21, 2021
OK, if it is unclear to you I will re-read it and see if I can improve it, but
joa-quim commentedon Jun 21, 2021
I may being particularly dumb tonight but when would we use -it then?
PaulWessel commentedon Jun 21, 2021
I think you never use -it. E.g.
However, you do use it if you select columns and want to include the trailing text:
versus
Let -f<col>s explicity set start of input trailing text (#5370)
joa-quim commentedon Jun 21, 2021
Ah, finally got it. So instead of
say something like:
PaulWessel commentedon Jun 21, 2021
OK, I can fix that.
mvanneste commentedon Jun 21, 2021
Thanks for the swift response and actions! Impressive (as usual).
mvanneste commentedon Jun 21, 2021
(Note: the same issue occurs with grdtrack)
PaulWessel commentedon Jun 21, 2021
grdtrack uses the same -i, -f, -o as any other modules. This is after the update? What is the symptoms?
mvanneste commentedon Jun 21, 2021
PaulWessel commentedon Jun 21, 2021
Works fine for me with master and the updates.