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

Wrap grdinfo aliases #799

Merged
merged 49 commits into from
Feb 7, 2021
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
27f5d20
Add cyl_transverse_mercator.py
willschlitzer Dec 11, 2020
d64983f
Add cyl_universal_transverse_mercator.py
willschlitzer Dec 11, 2020
6ba8185
Changing land color to red in cyl_mercator.py to match GMT docs examp…
willschlitzer Dec 11, 2020
76850ee
Merge branch 'master' into cylindrical-projections
willschlitzer Dec 13, 2020
48431db
Merge branch 'master' of https://github.com/GenericMappingTools/pygmt
willschlitzer Jan 12, 2021
01052d2
Merge branch 'master' of https://github.com/GenericMappingTools/pygmt
willschlitzer Jan 18, 2021
c710988
Merge remote-tracking branch 'origin/master'
willschlitzer Jan 21, 2021
b94e0a2
Merge branch 'master' of https://github.com/GenericMappingTools/pygmt
willschlitzer Jan 21, 2021
1466bb9
Add region alias to grdinfo
willschlitzer Jan 21, 2021
158ef5d
Add grid argument name to existing tests
willschlitzer Jan 21, 2021
a90ca99
Add tab, geographic, and zdata aliases
willschlitzer Jan 21, 2021
cac7aff
Add tab doc string
willschlitzer Jan 21, 2021
73e0af7
Add tab doc string
willschlitzer Jan 21, 2021
e6e8da0
Make grdinfo doc string an r-string
willschlitzer Jan 21, 2021
7640edc
Merge branch 'master' into grdinfo-alias
willschlitzer Jan 21, 2021
0e28700
Update doc string formatting
willschlitzer Jan 21, 2021
b4b74f4
Update doc string for geographic argument
willschlitzer Jan 21, 2021
9e85b30
Update zdata doc string
willschlitzer Jan 21, 2021
083b655
Updating grdinfo C alias
willschlitzer Jan 21, 2021
87146de
Add/change grdinfo aliases
willschlitzer Jan 21, 2021
1d5d0ed
Add minxmax_pos to doc string
willschlitzer Jan 21, 2021
720b5f3
Fix typo
willschlitzer Jan 21, 2021
13829e3
Add tiles doc string
willschlitzer Jan 21, 2021
dccc4b8
Fix typo
willschlitzer Jan 21, 2021
43372a0
Correct doc string for per_column rename
willschlitzer Jan 21, 2021
61ce2b6
Add doc string for spacing
willschlitzer Jan 21, 2021
51c1c85
Add nearest_multiple to grdinfo doc string
willschlitzer Jan 21, 2021
89ef66b
Add test for region argument
willschlitzer Jan 21, 2021
71ae773
Style fix
willschlitzer Jan 21, 2021
568f516
Fix argument names in per_column docstring
willschlitzer Jan 22, 2021
5a7df5d
Fix formatting typo
willschlitzer Jan 22, 2021
fbe8098
Merge branch 'master' into grdinfo-alias
seisman Jan 26, 2021
bfd027d
Apply suggestions from code review
willschlitzer Feb 5, 2021
2d2ca46
Merge branch 'master' into grdinfo-alias
willschlitzer Feb 5, 2021
c47d45a
Change tests in test_grdinfo.py to use long form aliases
willschlitzer Feb 5, 2021
ecce723
Apply suggestions from code review
willschlitzer Feb 5, 2021
2a94c6c
Update pygmt/modules.py
willschlitzer Feb 5, 2021
12ea457
Merge branch 'master' into grdinfo-alias
seisman Feb 5, 2021
72ef404
[format-command] fixes
actions-bot Feb 5, 2021
00a5961
Merge branch 'master' into grdinfo-alias
willschlitzer Feb 6, 2021
140f8e2
Replace short aliases with long form aliases; fix line length issues
willschlitzer Feb 6, 2021
584d3e2
Move grdinfo function to grdinfo.py
willschlitzer Feb 6, 2021
3b1001f
Remove unused imports
willschlitzer Feb 6, 2021
0d31d52
Update pygmt/src/grdinfo.py
willschlitzer Feb 6, 2021
fe66e7e
Remove unused imports; reorder aliases
willschlitzer Feb 6, 2021
994e7da
Update pygmt/src/grdinfo.py
weiji14 Feb 6, 2021
a368307
Merge branch 'master' into grdinfo-alias
willschlitzer Feb 7, 2021
f48dac2
Merge branch 'master' into grdinfo-alias
willschlitzer Feb 7, 2021
5c03c7a
[format-command] fixes
actions-bot Feb 7, 2021
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
16 changes: 15 additions & 1 deletion pygmt/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
data_kind,
dummy_context,
fmt_docstring,
kwargs_to_strings,
use_alias,
)
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved


@fmt_docstring
@use_alias(V="verbose")
@use_alias(C="tab", F="geographic", L="zdata", M="zextemes", R="region", V="verbose")
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
@kwargs_to_strings(R="sequence")
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
def grdinfo(grid, **kwargs):
"""
Get information about a grid.
Expand All @@ -29,6 +31,18 @@ def grdinfo(grid, **kwargs):
----------
grid : str or xarray.DataArray
The file name of the input grid or the grid loaded as a DataArray.
This is the only required argument.
{R}
tab : str or bool
**n**\ |**t**
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
Formats the report using tab-separated fields on a single line. The
output is name w e s n z0 z1 dx dy nx ny[ x0 y0 x1 y1 ] [ med scale ]
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
[mean std rms] [n_nan] registration gtype. The data in brackets are
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
outputted depending on the `zdata` and `zextremes` arguments.
Use **t** to place file name at the end of the output record or,
**n** or `True` to only output numerical columns. The registration is
either 0 (gridline) or 1 (pixel), while gtype is either 0 (Cartesian)
or 1 (geographic).

{V}

Expand Down
4 changes: 2 additions & 2 deletions pygmt/tests/test_grdinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ def test_grdinfo():
Make sure grd info works as expected.
"""
grid = load_earth_relief(registration="gridline")
result = grdinfo(grid, L=0, C="n")
result = grdinfo(grid=grid, L=0, C="n")
assert result.strip() == "-180 180 -90 90 -8592.5 5559 1 1 361 181 0 1"
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved


def test_grdinfo_file():
"""
Test grdinfo with file input.
"""
result = grdinfo("@earth_relief_01d", L=0, C="n")
result = grdinfo(grid="@earth_relief_01d", L=0, C="n")
assert result.strip() == "-180 180 -90 90 -8182 5651.5 1 1 360 180 1 1"


Expand Down