# Gmtselect -i+o option

**URL:** <https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182>\
**Category:** Q&A\
**Created:** [January 9, 2020, 12:45am UTC](https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182 "2020-01-09T00:45:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![RustyCuth](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@RustyCuth](https://forum.generic-mapping-tools.org/u/RustyCuth)\
**Post date:** [January 9, 2020, 12:45am UTC](https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182/1 "2020-01-09T00:45:42Z")

</div>

I’m trying to stop points being counted twice when using a series of calls to gmtselect with a solid grid of squares. Points that are exactly on the border can get selected in adjacent grid cells.  
So I want to add a tiny fraction to each lat and long (0.00005) to stop this (the lat and longs are only specified to 4 decimal places).

My command is of the form:  
gmtselect -Fpoly.txt -i5+o0.00005,6+o0.00005,0-7 -o2-9

The required adjustment is being made to column 5, but not to column 6 - it just gets passed as is.  
What am I doing wrong?  
Using gmt 5.3.4

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [January 9, 2020, 2:47am UTC](https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182/2 "2020-01-09T02:47:40Z")

</div>

0-7 is resetting what you have for 6

---

<div class="post-metadata">

**Author:** ![RustyCuth](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@RustyCuth](https://forum.generic-mapping-tools.org/u/RustyCuth)\
**Post date:** [January 9, 2020, 4:05am UTC](https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182/3 "2020-01-09T04:05:52Z")

</div>

Then why does 5 get the adjustment?

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [January 9, 2020, 4:53am UTC](https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182/4 "2020-01-09T04:53:51Z")

</div>

Not sure but you are specifying both 5 and 6 twice

---

<div class="post-metadata">

**Author:** ![RustyCuth](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@RustyCuth](https://forum.generic-mapping-tools.org/u/RustyCuth)\
**Post date:** [January 9, 2020, 6:47am UTC](https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182/5 "2020-01-09T06:47:58Z")

</div>

The manual states that columns may be repeated. I would have thought the repetitions of a column were “independent” and hence my original construction.

I did a clunky work around using:  
-i5+o0.00005,6+o0.00005,0,1,2,3,4,7 -o2-6,0,1,7  
but this meant that the lats/longs that were passed were the scaled ones, not the original. No big hassle, but annoying.

Should the column independence be a feature?

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [January 9, 2020, 7:25am UTC](https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182/6 "2020-01-09T07:25:33Z")

</div>

No, repeats are allowed. I see, you intentionally wanted what you wrote first. I will see if I can recreate the issue tomorrow.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [January 9, 2020, 8:13am UTC](https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182/7 "2020-01-09T08:13:39Z")

</div>

If I do this:

```
echo 0 1 2 3 4 5 6 7 > t.txt
gmt select t.txt -i5+o0.00005,6+o0.00005,0-7

```

I get

`5.00005	6	0	1	2	3	4	5.00005	6	7`

So you are right there is a bug in that column 6 is not affected by the offset; I will look at that. However, because each input column can only have one scaling and offset, it is not possible for you to write out the same column with two _separate_ offsets.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [January 9, 2020, 9:48pm UTC](https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182/8 "2020-01-09T21:48:33Z")

</div>

This bug has now been fixed in the repository and the output of my test now gives what you expect:

```
gmt select -i5+o0.00005,6+o0.00005,0-7 t.txt
5.00005 6.00005 0 1 2 3 4 5 6 7

```

Thanks for pointing out the bug!

---

<div class="post-metadata">

**Author:** ![RustyCuth](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@RustyCuth](https://forum.generic-mapping-tools.org/u/RustyCuth)\
**Post date:** [January 9, 2020, 9:58pm UTC](https://forum.generic-mapping-tools.org/t/gmtselect-i-o-option/182/9 "2020-01-09T21:58:17Z")

</div>

Excellent. Thanks Paul.  
Love GMT!
