diff --git a/pygmt/src/grd2xyz.py b/pygmt/src/grd2xyz.py index 0a33a5bbe67..38cc1807d8c 100644 --- a/pygmt/src/grd2xyz.py +++ b/pygmt/src/grd2xyz.py @@ -126,6 +126,22 @@ def grd2xyz(grid, output_type="pandas", outfile=None, **kwargs): - :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set (depends on ``output_type``) + Example + ------- + >>> import pygmt # doctest: +SKIP + >>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to 30, + >>> # and a y-range of 15 to 25 + >>> grid = pygmt.datasets.load_earth_relief( + ... resolution="30m", region=[10, 30, 15, 25] + ... ) # doctest: +SKIP + >>> # Create a pandas DataFrame with the xyz data from an input grid + >>> xyz_dataframe = pygmt.grd2xyz( + ... grid=grid, output_type="pandas" + ... ) # doctest: +SKIP + >>> xyz_dataframe.head(n=2) # doctest: +SKIP + lon lat elevation + 0 10.25 24.75 903.5 + 1 10.75 24.75 820.0 """ if output_type not in ["numpy", "pandas", "file"]: raise GMTInvalidInput( diff --git a/pygmt/src/grdclip.py b/pygmt/src/grdclip.py index 56cb829ffe5..4ace6011683 100644 --- a/pygmt/src/grdclip.py +++ b/pygmt/src/grdclip.py @@ -78,8 +78,8 @@ def grdclip(grid, **kwargs): - None if ``outgrid`` is set (grid output will be stored in file set by ``outgrid``) - Examples - -------- + Example + ------- >>> import pygmt # doctest: +SKIP >>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to 30, >>> # and a y-range of 15 to 25 diff --git a/pygmt/src/grdcut.py b/pygmt/src/grdcut.py index f922aaaf04f..a212b0e6a01 100644 --- a/pygmt/src/grdcut.py +++ b/pygmt/src/grdcut.py @@ -88,8 +88,8 @@ def grdcut(grid, **kwargs): - None if ``outgrid`` is set (grid output will be stored in file set by ``outgrid``) - Examples - -------- + Example + ------- >>> import pygmt # doctest: +SKIP >>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to 30, >>> # and a y-range of 15 to 25 diff --git a/pygmt/src/grdfilter.py b/pygmt/src/grdfilter.py index eb57b271a54..cffcb928d22 100644 --- a/pygmt/src/grdfilter.py +++ b/pygmt/src/grdfilter.py @@ -119,8 +119,8 @@ def grdfilter(grid, **kwargs): - None if ``outgrid`` is set (grid output will be stored in file set by ``outgrid``) - Examples - -------- + Example + ------- >>> import os >>> import pygmt