Feature #822

IO_SEGMENT_MARKER - being able to use more than one character and output in multiple columns

Added by Andreas almost 2 years ago. Updated almost 2 years ago.

Status:ClosedStart date:2015-11-23
Priority:LowDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Platform:

Description

I really like the new IO_SEGMENT_MARKER option. However, I sometimes import stuff made in GMT directly into other software. Some of them requires a segment marker in each column where data is expected and not just in the 1st (or in GMTs world, 0th).

My suggestions:
  • As of today, the segment marker can only be a single character - having the possibility to use a trivial number of characters (text, numbers, whatever) in future versions of GMT would be useful.
  • The segment marker is only printed in the 0th column - it would be nice if one could tell GMT to print one segment marker in each column.

I've tried to illustrate these points below.

Say that I would like to use '-999' as segment marker, this would be my preferred output:

...
-999     -999
16.5398641947   64.8830395972
16.5432211795   64.8796826123
16.0790417334   65.203479057
16.5398641947   64.8830395972
-999     -999
12.1373311971   59.3647669184
12.3341725795   59.1111619745
12.130312047    59.3690394446
12.1373311971   59.3647669184
-999     -999
...

As of GMT pr. today, I am only be able to use a single character as marker (e.g. 'X') which is printed only in the 0th column (maybe also include an option to omit the bin information printed in the header lines?):

...
X Shore Bin # 72, Level 2
8.19562066072   60.1722743572
8.19302662699   60.1750209812
8.28686961166   60.0886549172
8.19562066072   60.1722743572
X Shore Bin # 72, Level 2
6.38361181048   61.6360723278
6.2783245594    61.7511253529
6.39169909209   61.6302738994
6.38361181048   61.6360723278
X Shore Bin # 72, Level 2
6.42114900435   61.9311818112
6.43411917296   61.9305714504
6.10223544671   61.9082932784
6.42114900435   61.9311818112
...

When using --IO_SEGMENT_MARKER=N, a 'NaN' in both columns is printed, which I like:

pscoast -M -R0/10/60/61 -Dc -W --IO_SEGMENT_MARKER=N

which gives

...
NaN     NaN
16.5398641947   64.8830395972
16.5432211795   64.8796826123
16.0790417334   65.203479057
16.5398641947   64.8830395972
NaN     NaN
12.1373311971   59.3647669184
12.3341725795   59.1111619745
12.130312047    59.3690394446
12.1373311971   59.3647669184
NaN     NaN
...

History

#1 Updated by Paul almost 2 years ago

I tried to add -d-999 but that did not work. However, this is trivially done via

gmt pscoast -M -R0/10/60/61 -Dc -W --IO_SEGMENT_MARKER=N | sed -e 's/NaN/-999/g'

#2 Updated by Andreas almost 2 years ago

True; maybe a built in function for this is not needed in GMT. Thanks Paul.

#3 Updated by Paul almost 2 years ago

  • Status changed from New to Resolved
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release
  • % Done changed from 0 to 100

Fixed the bug that prevented this from working in the first place. In r15271.

gmt pscoast -M -R0/10/60/61 -Dc -W --IO_SEGMENT_MARKER=N -do-999 > t.txt

#4 Updated by Paul almost 2 years ago

  • Status changed from Resolved to Closed

Closing this as fully resolved and tested.

Also available in: Atom PDF