Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn all short aliases into long form #474

Merged
merged 25 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c75d2d1
Turn common aliases from short form to long form
weiji14 Jun 1, 2020
1e14b72
Fix fmt_docstring test
weiji14 Jun 1, 2020
144effa
Alias U as timestamp instead of logo
weiji14 Jun 1, 2020
2223ae2
Remove short aliases for makecpt
weiji14 Jun 2, 2020
f5fc1a3
Remove short aliases for surface
weiji14 Jun 2, 2020
8906d59
Add common alias interpolation (n) for grdtrack
weiji14 Jun 2, 2020
db842e7
Remove short alias for which and refactor test
weiji14 Jun 2, 2020
71fb973
Remove short aliases from coast
seisman Jun 2, 2020
f131cd5
Remove short aliases from colorbar
seisman Jun 2, 2020
57f25ea
Improve docstring of colorbar
seisman Jun 2, 2020
ce6e84f
Remove short aliases from grdcontour
seisman Jun 2, 2020
cb5fb41
Remove short aliases from legend
seisman Jun 2, 2020
ac6aad3
Remove short aliases for logo
seisman Jun 2, 2020
52b8d0c
Aliased per_column(C), spacing(I), nearest_multiple(T) for info
weiji14 Jun 3, 2020
aa369dc
Remove short aliases for psconvert and improve fmt docstring
weiji14 Jun 3, 2020
718e786
Add U to docstring of grdcontour
seisman Jun 3, 2020
b8f7b33
Remove short aliases for plot
seisman Jun 3, 2020
30136d5
Remove short aliases for contour
seisman Jun 3, 2020
c320756
Improve docstring of text
weiji14 Jun 3, 2020
d9a3290
Remove short alias from image
weiji14 Jun 3, 2020
d87b7e4
Use frame instead of B for basemap.
weiji14 Jun 3, 2020
e3b5183
Fix a typo "book"->"bool"
seisman Jun 3, 2020
15b9c6b
Alias map_scale(L), rose(Td), compass(Tm) for basemap
weiji14 Jun 3, 2020
a1f5839
Change x, y to x/y in docstrings to make it look nicer
weiji14 Jun 4, 2020
8869feb
Fix string to str in docstrings
seisman Jun 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Aliased per_column(C), spacing(I), nearest_multiple(T) for info
Also updated test_info.py to use long aliases instead of short ones, though the output of `info` are still strings that use short aliases.
  • Loading branch information
weiji14 committed Jun 3, 2020
commit 52b8d0c666ef042b22a813b42b00a2bb6089a0dd
15 changes: 9 additions & 6 deletions pygmt/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def grdinfo(grid, **kwargs):


@fmt_docstring
@use_alias(C="per_column", I="spacing", T="nearest_multiple")
def info(fname, **kwargs):
"""
Get information about data tables.
Expand All @@ -62,23 +63,25 @@ def info(fname, **kwargs):
n columns rounded up and down to the nearest multiple of the supplied
increments. By default, this output will be in the form *-Rw/e/s/n*,
or the output will be in column form for as many columns as there are
increments provided. The *T* option will provide a *-Tzmin/zmax/dz* string
for makecpt.
increments provided. The *nearest_multiple* option will provide a
*-Tzmin/zmax/dz* string for makecpt.

Full option list at :gmt-docs:`gmtinfo.html`

{aliases}

Parameters
----------
fname : str
The file name of the input data table file.
C : bool
per_column : bool
Report the min/max values per column in separate columns.
I : str
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 *-Rw/e/s/n*
(unless *C* is set).
T : str
(unless *per_column* is set).
nearest_multiple : str
``'dz[+ccol]'``
Report the min/max of the first (0'th) column to the nearest multiple
of dz and output this as the string *-Tzmin/zmax/dz*.
Expand Down
31 changes: 17 additions & 14 deletions pygmt/tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,35 @@ def test_info():
"Make sure info works"
output = info(fname=POINTS_DATA)
expected_output = (
"{}: N = 20 " "<11.5309/61.7074> " "<-2.9289/7.8648> " "<0.1412/0.9338>\n"
).format(POINTS_DATA)
f"{POINTS_DATA}: N = 20 "
"<11.5309/61.7074> "
"<-2.9289/7.8648> "
"<0.1412/0.9338>\n"
)
assert output == expected_output


def test_info_c():
"Make sure the C option works"
output = info(fname=POINTS_DATA, C=True)
def test_info_per_column():
"Make sure the per_column option works"
output = info(fname=POINTS_DATA, per_column=True)
assert output == "11.5309 61.7074 -2.9289 7.8648 0.1412 0.9338\n"


def test_info_i():
"Make sure the I option works"
output = info(fname=POINTS_DATA, I=0.1)
def test_info_spacing():
"Make sure the spacing option works"
output = info(fname=POINTS_DATA, spacing=0.1)
assert output == "-R11.5/61.8/-3/7.9\n"


def test_info_c_i():
"Make sure the C and I options work together"
output = info(fname=POINTS_DATA, C=True, I=0.1)
def test_info_per_column_spacing():
"Make sure the per_column and spacing options work together"
output = info(fname=POINTS_DATA, per_column=True, spacing=0.1)
assert output == "11.5 61.8 -3 7.9 0.1412 0.9338\n"


def test_info_t():
"Make sure the T option works"
output = info(fname=POINTS_DATA, T=0.1)
def test_info_nearest_multiple():
"Make sure the nearest_multiple option works"
output = info(fname=POINTS_DATA, nearest_multiple=0.1)
assert output == "-T11.5/61.8/0.1\n"


Expand Down