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

Add inline example for grd2cpt #2145

Merged
merged 7 commits into from
Oct 20, 2022
Merged
Changes from 3 commits
Commits
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
10 changes: 10 additions & 0 deletions pygmt/src/grd2cpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import build_arg_string, fmt_docstring, kwargs_to_strings, use_alias

__doctest_skip__ = ["grd2cpt"]


@fmt_docstring
@use_alias(
Expand Down Expand Up @@ -159,6 +161,14 @@ def grd2cpt(grid, **kwargs):
range. Note that ``cyclic=True`` cannot be set together with
``categorical=True``.
{verbose}

Example
-------
>>> import pygmt
>>> # load the 30 arc minute grid with "gridline" registration
>>> grid = pygmt.datasets.load_earth_relief("30m", registration="gridline")
>>> # create a CPT with grd2cpt
>>> pygmt.grd2cpt(grid=grid)
seisman marked this conversation as resolved.
Show resolved Hide resolved
"""
if kwargs.get("W") is not None and kwargs.get("Ww") is not None:
raise GMTInvalidInput("Set only categorical or cyclic to True, not both.")
Expand Down