Gmt math to get an additional column of index

There is a relatively simple task that I wonder how we can use gmt math to do for:

If we want to have a “time series”, we can simply do
gmt math -o0 -T1.e-4/1.e-2/2+l T =
to get the column of the data values (-o0 was used to suppress the duplicated column):
0.0001
0.0002
0.0005
0.001
0.002
0.005
0.01

Problem is, sometime I want to append “smartly” the indexing integers for each row; the final result I want in this case would be:
1 0.0001
2 0.0002
3 0.0005
4 0.001
5 0.002
6 0.005
7 0.01

The 1…7 list can also easily be generated using another gmt math command:
gmt math -o0 -T1/7/1 T =

But is there a way to generate the two columns AT ONCE using gmt math ?

Thanks

Hello Jianbo

You have to generate both column and paste them together. Try this:

gmt math -o0 -T1/7/1 T => tmp0
gmt math -o0 -T1.e-4/1.e-2/2+l T => tmp1
gmt convert tmp* -A > file.txt

1       0.0001
2       0.0002
3       0.0005
4       0.001
5       0.002
6       0.005
7       0.01

nl is a shell command that adds line numbers to the first columns.

1 Like

@Esteban82 @DL-gmt Thanks for the responses !

For now, I’ll stick to the 2-step approach using gmt convert.