Skip to content

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

Closed

Description

@core-man

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 GenericMappingTools/pygmt#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

  • Operating system: CentOS 7
  • GMT version (gmt --version): 6.1.1

Activity

  1. added
    bug
    on Mar 10, 2021
  2. welcome commented on Mar 10, 2021

    @welcome

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

  3. added
    documentation
    on Mar 10, 2021
  4. added a commit that references this issue on Mar 24, 2021
    e6db08c
  5. added a commit that references this issue on Mar 24, 2021
    092de5e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdocumentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions