GenericMappingTools / gmt

The Generic Mapping Tools
https://www.generic-mapping-tools.org
Other
843 stars 352 forks source link

Misleading description for the -I argument of gmt info #4938

Closed core-man closed 3 years ago

core-man commented 3 years ago

Description of the problem

I find the description for -I argument of gmt info may be a little misleading for new GMT users (originally posted at https://github.com/GenericMappingTools/pygmt/issues/1035).

It seems that only when the -C argument is combined with -I, then the output will be rounded up/down for as many columns as there are increments provided in -I. Without -C, -I only outputs the min/max values for the first two columns no matter how many increments we input. So, we'd better always add -C when we use -I unless only the first two columns are needed.


Test

I use Iris flower dataset downloaded from https://github.com/mwaskom/seaborn-data/raw/master/iris.csv to test -I and -C.

# Download the sample iris data:
$ wget https://github.com/mwaskom/seaborn-data/raw/master/iris.csv
# Output with -I and -C:
$ awk -F "," 'FNR>1 {print $4,$1,$3}' iris.csv | gmt info -C -I1/0.2/0.3
0   3   4.2 8   0.9 7.2

# Output with only -I:
$ awk -F "," 'FNR>1 {print $4,$1,$3}' iris.csv | gmt info -I1/0.2/0.3   
-R0/3/4.2/8

# Output with only -C:
$ awk -F "," 'FNR>1 {print $4,$1,$3}' iris.csv | gmt info -C            
0.1 2.5 4.3 7.9 1   6.9

# Output with neither -I nor -C:
$ awk -F "," 'FNR>1 {print $4,$1,$3}' iris.csv | gmt info   
<Standard Input>: N = 150   <0.1/2.5>   <4.3/7.9>   <1/6.9>

GMT DOC

  1. The description of gmt info at GMT DOC :

    As another option, info can find the extent of data in the first two columns rounded up and down to the nearest multiple of the supplied increments given by -I.

This is right. When we only use -I without -C, only the rounded min/max values of the first columns will be output.

If -C is combined with -I then the output will be in column form and rounded up/down for as many columns as there are increments provided in -I.

This is exactly right. When we use both -I and -C, we can output the rounded min/max values for each column provided in -I.

  1. The detailed description of -I at GMT DOC:

    Report the min/max of the first n columns to the nearest multiple of the provided increments (separate the n increments by slashes), and output results in the form -Rw/e/s/n (unless -C is set). If only one increment is given we also use it for the second column (for backwards compatibility).

The first part of the first sentence assumes -C is used, while the second part assumes -C is not used.


Suggestion

It's better to revise the description of -I option at GMT DOC to explicitly indicate the difference for the two cases, i.e., -C is used and is not used. I'd like to help this issue if you think we need to revise a little about -I.

System information

welcome[bot] commented 3 years ago

👋 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.