Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions .github/workflows/style_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,14 @@ jobs:
rm output.txt
exit $nfiles
fi

- name: Ensure "Examples" instead of "Example" is used as the docstring heading
run: |
git ls-files '*.py' | xargs grep --line-number -E '^\s*Example\s*$' > output.txt || true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run this command on the main branch to list all files that use Example:

$ git ls-files '*.py' | xargs grep --line-number -E '^\s*Example\s*$'
pygmt/src/blockm.py:170:    Example
pygmt/src/blockm.py:284:    Example
pygmt/src/blockm.py:407:    Example
pygmt/src/coast.py:27:    Example
pygmt/src/coast.py:277:    Example
pygmt/src/colorbar.py:473:    Example
pygmt/src/dimfilter.py:131:    Example
pygmt/src/grd2cpt.py:189:    Example
pygmt/src/grd2xyz.py:135:    Example
pygmt/src/grdclip.py:94:    Example
pygmt/src/grdcontour.py:129:    Example
pygmt/src/grdcut.py:104:    Example
pygmt/src/grdfill.py:104:    Example
pygmt/src/grdgradient.py:221:    Example
pygmt/src/grdhisteq.py:109:        Example
pygmt/src/grdhisteq.py:206:        Example
pygmt/src/grdimage.py:161:    Example
pygmt/src/grdlandmask.py:114:    Example
pygmt/src/grdmask.py:194:    Example
pygmt/src/grdproject.py:110:    Example
pygmt/src/grdsample.py:99:    Example
pygmt/src/grdtrack.py:285:    Example
pygmt/src/grdview.py:256:    Example
pygmt/src/grdvolume.py:84:    Example
pygmt/src/nearneighbor.py:143:    Example
pygmt/src/select.py:210:    Example
pygmt/src/solar.py:89:    Example
pygmt/src/sph2grd.py:74:    Example
pygmt/src/sphdistance.py:112:    Example
pygmt/src/sphinterpolate.py:68:    Example
pygmt/src/surface.py:165:    Example
pygmt/src/xyz2grd.py:149:    Example

nlines=$(wc --lines output.txt | awk '{print $1}')
if [[ $nlines > 0 ]]; then
echo "Use 'Examples' instead of 'Example' as the docstring heading in following lines:"
cat output.txt
rm output.txt
exit $nlines
fi
12 changes: 6 additions & 6 deletions pygmt/src/blockm.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ def blockmean(
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set
(depends on ``output_type``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a table of ship observations of bathymetry off Baja California
>>> data = pygmt.datasets.load_sample_data(name="bathymetry")
Expand Down Expand Up @@ -281,8 +281,8 @@ def blockmedian(
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set
(depends on ``output_type``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a table of ship observations of bathymetry off Baja California
>>> data = pygmt.datasets.load_sample_data(name="bathymetry")
Expand Down Expand Up @@ -404,8 +404,8 @@ def blockmode(
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set
(depends on ``output_type``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a table of ship observations of bathymetry off Baja California
>>> data = pygmt.datasets.load_sample_data(name="bathymetry")
Expand Down
8 changes: 4 additions & 4 deletions pygmt/src/coast.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def _alias_option_C(lakes=None, river_lakes=None): # ruff: ignore[invalid-funct
"""
Helper function to create the alias list for the -C option.

Example
-------
Examples
--------
>>> def parse(**kwargs):
... return AliasSystem(C=_alias_option_C(**kwargs)).get("C")
>>> parse()
Expand Down Expand Up @@ -274,8 +274,8 @@ def coast(
pygmt.Figure.scalebar
Add a scale bar.

Example
-------
Examples
--------
>>> import pygmt
>>> from pygmt.params import Axis
>>> # Create a new plot with pygmt.Figure()
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ def colorbar(
$perspective
$transparency

Example
-------
Examples
--------
>>> import pygmt
>>> # Create a new figure instance with pygmt.Figure()
>>> fig = pygmt.Figure()
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/dimfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ def dimfilter(
- ``None`` if ``outgrid`` is set (grid output will be stored in the file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a grid of Earth relief data
>>> grid = pygmt.datasets.load_earth_relief()
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grd2cpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ def grd2cpt(
$region
$verbose

Example
-------
Examples
--------
>>> import pygmt
>>> # load the 30 arc-minutes grid with "gridline" registration
>>> grid = pygmt.datasets.load_earth_relief("30m", registration="gridline")
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grd2xyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def grd2xyz(
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set
(depends on ``output_type``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a grid of @earth_relief_30m data, with a longitude range of
>>> # 10° E to 30° E, and a latitude range of 15° N to 25° N
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdclip.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def grdclip(
- ``None`` if ``outgrid`` is set (grid output will be stored in the file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load the 30 arc-minutes Earth relief grid, with a longitude range of 10° E to
>>> # 30° E, and a latitude range of 15° N to 25° N
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdcontour.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def grdcontour(
$perspective
$transparency

Example
-------
Examples
--------
>>> import pygmt
>>> from pygmt.params import Axis
>>> # Load the 15 arc-minutes grid with "gridline" registration in the
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdcut.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def grdcut(
- ``None`` if ``outgrid`` is set (grid output will be stored in the file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a grid of @earth_relief_30m data, with a longitude range of
>>> # 10° E to 30° E, and a latitude range of 15° N to 25° N
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def grdfill(
- ``None`` if ``outgrid`` is set (grid output will be stored in the file set by
``outgrid``)

Example
-------
Examples
--------
Fill holes in a bathymetric grid with a constant value of 20.

>>> import pygmt
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdgradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ def grdgradient(
- ``None`` if ``outgrid`` is set (grid output will be stored in the file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a grid of @earth_relief_30m data, with a longitude range of
>>> # 10° E to 30° E, and a latitude range of 15° N to 25° N
Expand Down
8 changes: 4 additions & 4 deletions pygmt/src/grdhisteq.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def equalize_grid(
- :class:`xarray.DataArray` if ``outgrid`` is ``None``
- ``None`` if ``outgrid`` is a str (grid output is stored in ``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a grid of @earth_relief_30m data, with a longitude range
>>> # of 10°E to 30°E, and a latitude range of 15°N to 25°N
Expand Down Expand Up @@ -203,8 +203,8 @@ def compute_bins(
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not
set (depends on ``output_type``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a grid of @earth_relief_30m data, with a longitude range of
>>> # 10° E to 30° E, and a latitude range of 15° N to 25° N
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def grdimage(
$transparency
$cores

Example
-------
Examples
--------
>>> import pygmt
>>> from pygmt.params import Axis
>>> # load the 30 arc-minutes grid with "gridline" registration
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdlandmask.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def grdlandmask(
- ``None`` if ``outgrid`` is set (grid output will be stored in the file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Create a landmask grid with a longitude range of 125° E to 130° E, a
>>> # latitude range of 30° N to 35° N, and a grid spacing of 1 arc-degree
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdmask.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ def grdmask(
- ``None`` if ``outgrid`` is set (grid output will be stored in the file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> import numpy as np
>>> # Create a simple polygon as a triangle
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def grdproject(
- ``None`` if ``outgrid`` is set (grid output will be stored in the file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a grid of @earth_relief_30m data, with a longitude range of
>>> # 10° E to 30° E, and a latitude range of 15° N to 25° N
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def grdsample(
- ``None`` if ``outgrid`` is set (grid output will be stored in the file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a grid of @earth_relief_30m data, with a longitude range of
>>> # 10° E to 30° E, and a latitude range of 15° N to 25° N
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdtrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ def grdtrack(
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set
(depends on ``output_type``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a grid of @earth_relief_30m data, with a longitude range of
>>> # -118° E to -107° E, and a latitude range of -49° N to -42° N
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdview.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def grdview(
$perspective
$transparency

Example
-------
Examples
--------
>>> import pygmt
>>> from pygmt.params import Axis, Frame
>>> # Load the 30 arc-minutes grid with "gridline" registration in a given region
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grdvolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def grdvolume(
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set
(depends on ``output_type``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a grid of @earth_relief_30m data, with a longitude range of
>>> # 10° E to 30° E, and a latitude range of 15° N to 25° N
Expand Down
5 changes: 3 additions & 2 deletions pygmt/src/nearneighbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ def nearneighbor(
- :class:`xarray.DataArray`: if ``outgrid`` is not set
- ``None`` if ``outgrid`` is set (grid output will be stored in the file set by
``outgrid``)
Example
-------

Examples
--------
>>> import pygmt
>>> # Load a sample dataset of bathymetric x, y, and z values
>>> data = pygmt.datasets.load_sample_data(name="bathymetry")
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ def select(
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set
(depends on ``output_type``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a table of ship observations of bathymetry off Baja California
>>> ship_data = pygmt.datasets.load_sample_data(name="bathymetry")
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/solar.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def solar(
$perspective
$transparency

Example
-------
Examples
--------

Plot the day-night terminator at the current UTC date and time.

Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/sph2grd.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def sph2grd(
- None if ``outgrid`` is set (grid output will be stored in file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Create a new grid from the remote file "EGM96_to_36.txt",
>>> # set the grid spacing to 1 arc-degree, and the region to global ("g")
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/sphdistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def sphdistance(
- None if ``outgrid`` is set (grid output will be stored in file set by
``outgrid``)

Example
-------
Examples
--------
>>> import numpy as np
>>> import pygmt
>>> # Create an array of longitude/latitude coordinates
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/sphinterpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def sphinterpolate(
- None if ``outgrid`` is set (grid output will be stored in file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a table of Mars with longitude/latitude/radius columns
>>> mars_shape = pygmt.datasets.load_sample_data(name="mars_shape")
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def surface(
- None if ``outgrid`` is set (grid output will be stored in file set by
``outgrid``)

Example
-------
Examples
--------
>>> import pygmt
>>> # Load a sample table of topography
>>> topography = pygmt.datasets.load_sample_data(name="notre_dame_topography")
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/xyz2grd.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ def xyz2grd(
- None if ``outgrid`` is set (grid output will be stored in file set by
``outgrid``)

Example
-------
Examples
--------
>>> import numpy as np
>>> import pygmt
>>> # generate a grid for z=x**2+y**2, with an x-range of 0 to 3,
Expand Down
Loading