Format_float_out

Hello all,

Best wishes for a Happy New Year !!

i think i found a small “bug” in documentation of FORMAT_FLOAT_OUT. I was trying to get specific format for a single column in the output (didn’t mind for the rest) but it seems that i must declare the format for all output columns, although in the documentation it is written “To give some columns a separate format,…” see bellow for GMT6.4.

Best Regards
Thimios


FORMAT_FLOAT_OUT

Format (C language printf syntax) to be used when printing double precision floating point numbers to output files [default is %.12g]. For geographic coordinates, see FORMAT_GEO_OUT. To give some columns a separate format, supply one or more comma-separated cols:format specifications, where cols can be specific columns (e.g., 5 for 6th since 0 is the first) or a range of columns (e.g., 3-7). The last specification without column information will override the format for all other columns. Alternatively, you can list N space-separated formats and these apply to the first N columns.

Please include an example showing the problem, so it can be reproduced.

Hi again,

here it is …(by the way i am using windows and GMT6.4)

the commands are

rem this is ok
gmt select test.dat -Ccenter.dat+d4k -R0/20/0/20 --FORMAT_FLOAT_OUT=“0-1:%%5.3f,2:%%.0f,3:%%013.2f,4-8:%%2.3f” > out_all.dat
rem this is not ok
gmt select test.dat -Ccenter.dat+d4k -R0/20/0/20 --FORMAT_FLOAT_OUT=“3:%%013.2f” > out_one.dat

center.dat (5 Bytes) test.dat (466 Bytes)

Condensed script:

cat<<eof > test.dat
10.00 10.00 1111 010101010.00  1. 5.0  10.00 10.00 10.00
11.00 11.00 1111 010101010.12  1. 5.0  10.00 10.00 10.00
12.00 12.00 1111 010101010.00  2. 5.0  10.00 10.00 10.00
13.00 13.00 1111 010101010.00  3. 5.0  10.00 10.00 10.00
14.00 14.00 1111 010101010.15  5. 5.0  10.00 10.00 10.00
15.00 15.00 1111 010101010.00  6. 5.0  10.00 10.00 10.00
16.00 16.00 1111 010101010.18  7. 5.0  10.00 10.00 10.00
17.00 17.00 1111 010101010.00  8. 5.0  10.00 10.00 10.00
eof

cat<<eof > center.dat
15 15
eof

gmt select test.dat -Ccenter.dat+d4k -R0/20/0/20 --FORMAT_FLOAT_OUT="0-1:%5.3f,2:%.0f,3:%013.2f,4-8:%2.3f"
gmt select test.dat -Ccenter.dat+d4k -R0/20/0/20 --FORMAT_FLOAT_OUT="3:%013.2f"

Output:

13.000	13.000	1111	0010101010.00	3.000	5.000	10.000	10.000	10.000
14.000	14.000	1111	0010101010.15	5.000	5.000	10.000	10.000	10.000
15.000	15.000	1111	0010101010.00	6.000	5.000	10.000	10.000	10.000
16.000	16.000	1111	0010101010.18	7.000	5.000	10.000	10.000	10.000
17.000	17.000	1111	0010101010.00	8.000	5.000	10.000	10.000	10.000
3:0000000013.00	3:0000000013.00	3:0000001111.00	3:0010101010.00	3:0000000003.00	3:0000000005.00	3:0000000010.00	3:0000000010.00	3:0000000010.00
3:0000000014.00	3:0000000014.00	3:0000001111.00	3:0010101010.15	3:0000000005.00	3:0000000005.00	3:0000000010.00	3:0000000010.00	3:0000000010.00
3:0000000015.00	3:0000000015.00	3:0000001111.00	3:0010101010.00	3:0000000006.00	3:0000000005.00	3:0000000010.00	3:0000000010.00	3:0000000010.00
3:0000000016.00	3:0000000016.00	3:0000001111.00	3:0010101010.18	3:0000000007.00	3:0000000005.00	3:0000000010.00	3:0000000010.00	3:0000000010.00
3:0000000017.00	3:0000000017.00	3:0000001111.00	3:0010101010.00	3:0000000008.00	3:0000000005.00	3:0000000010.00	3:0000000010.00	3:0000000010.00