Closed core-man closed 3 years ago
It seems that only when the per_column parameter is combined with spacing, then the numpy.ndarray output will be rounded up/down for as many columns as there are increments provided in spacing. Without per_column, spacing only output the min/max values for the first two columns no matter how many spacings we input.
Yes you are correct here. Granted, we pretty much just copied the documentation from GMT, so it might be considered an 'upstream' issue.
So, we should always set per_column to be
True
when we use spacing unless only the first two columns are needed.
I would advise against automatically setting per_column=True
. There may be use cases where people don't want that to happen, someone's bug is another person's feature.
spacing (str) – [b|p|f|s]dx[/dy[/dz…]]. Report the min/max of the first n columns to the nearest multiple of the provided increments and output results in the form [w, e, s, n].
The first part of the description assumes per_column is set to be
True
, while the second part assumes per_column is not used.
As mentioned above, this was copied directly from https://github.com/GenericMappingTools/gmt/blame/6.1/doc/rst/source/gmtinfo.rst#L114-L116. We can change the wording here in PyGMT, but it might be worth submitting a Pull Request upstream as well so that things are consistent across projects.
P.S. I edited your original post slightly, was hard to think in double negatives.
As mentioned above, this was copied directly from https://github.com/GenericMappingTools/gmt/blame/6.1/doc/rst/source/gmtinfo.rst#L114-L116. We can change the wording here in PyGMT, but it might be worth submitting a Pull Request upstream as well so that things are consistent across projects.
Submitted to GMT (https://github.com/GenericMappingTools/gmt/issues/4938).
The upstream documentation issue has been fixed in https://github.com/GenericMappingTools/gmt/pull/5014.
I find the description for spacing parameter of
pygmt.info
may be a little misleading for new GMT users.It seems that only when the per_column parameter is combined with spacing, then the numpy.ndarray output will be rounded up/down for as many columns as there are increments provided in spacing. Without per_column, spacing only output the min/max values for the first two columns no matter how many spacings we input. So, we should always set per_column to be
True
when we use spacing unless only the first two columns are needed.Test:
I use the data in 3D Scatter plots to test spacing and per_column.
Output with spacing (-I) and per_column (-C):
Output with only spacing (-I):
Output with only per_column (-C):
Output with neither of per_column (-I) nor spacing (-C):
See the documentation of GMT and PyGMT:
gmtinfo
at GMT DOC :This is right. When we only use spacing without per_column, only the rounded min/max values of the first columns will be output.
This is exactly right. When we use both per_column and spacing, we can output the rounded min/max values for each column provided in spacing.
The detailed description of -I at GMT DOC:
The corresponding description of spacing at PyGMT DOC:
The first part of the description assumes per_column is set to be
True
, while the second part assumes per_column is not used.