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

POC: Add common docstrings for meca/coupe #3825

Closed
wants to merge 5 commits into from
Closed
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
39 changes: 39 additions & 0 deletions pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,45 @@
**Note**: If ``region=grdfile`` is used then the grid spacing and
the registration have already been initialized; use ``spacing`` and
``registration`` to override these values.""",
"spec": r"""
spec : str, 1-D numpy array, 2-D numpy array, dict, or pandas.DataFrame
Data that contain focal mechanism parameters.

``spec`` can be specified in either of the following types:

- *str*: a file name containing focal mechanism parameters as columns. The
meaning of each column is:

- Columns 1 and 2: event longitude and latitude
- Column 3: event depth (in kilometers)
- Columns 4 to 3+n: focal mechanism parameters. The number of columns *n*
depends on the choice of ``convention`` (see the table above for the
supported conventions).
- Columns 4+n and 5+n: longitude and latitude at which to place the
beachball. ``0 0`` plots the beachball at the longitude and latitude
given in the columns 1 and 2. [optional; requires ``offset=True``].
- Last Column: text string to appear near the beachball [optional].

- *1-D np.array*: focal mechanism parameters of a single event.
The meanings of columns are the same as above.
- *2-D np.array*: focal mechanism parameters of multiple events.
The meanings of columns are the same as above.
- *dict* or :class:`pandas.DataFrame`: The dict keys or
:class:`pandas.DataFrame` column names determine the focal mechanism
convention. For the different conventions, the combination of keys /
column names as given in the table above are required.

A dict may contain values for a single focal mechanism or lists of
values for multiple focal mechanisms.

Both dict and :class:`pandas.DataFrame` may optionally contain the keys /
column names: ``latitude``, ``longitude``, ``depth``, ``plot_longitude``,
``plot_latitude``, and/or ``event_name``.

If ``spec`` is either a str or a 1-D or 2-D numpy array, the ``convention``
parameter is required to interpret the columns. If ``spec`` is a dict or
a :class:`pandas.DataFrame`, ``convention`` is not needed and ignored if
specified. """,
"transparency": r"""
transparency : float
Set transparency level, in [0-100] percent range
Expand Down
39 changes: 1 addition & 38 deletions pygmt/src/meca.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,44 +99,7 @@ def meca( # noqa: PLR0912, PLR0913

Parameters
----------
spec : str, 1-D numpy array, 2-D numpy array, dict, or pandas.DataFrame
Data that contain focal mechanism parameters.

``spec`` can be specified in either of the following types:

- *str*: a file name containing focal mechanism parameters as columns. The
meaning of each column is:

- Columns 1 and 2: event longitude and latitude
- Column 3: event depth (in kilometers)
- Columns 4 to 3+n: focal mechanism parameters. The number of columns *n*
depends on the choice of ``convention`` (see the table above for the
supported conventions).
- Columns 4+n and 5+n: longitude and latitude at which to place the
beachball. ``0 0`` plots the beachball at the longitude and latitude
given in the columns 1 and 2. [optional; requires ``offset=True``].
- Last Column: text string to appear near the beachball [optional].

- *1-D np.array*: focal mechanism parameters of a single event.
The meanings of columns are the same as above.
- *2-D np.array*: focal mechanism parameters of multiple events.
The meanings of columns are the same as above.
- *dict* or :class:`pandas.DataFrame`: The dict keys or
:class:`pandas.DataFrame` column names determine the focal mechanism
convention. For the different conventions, the combination of keys /
column names as given in the table above are required.

A dict may contain values for a single focal mechanism or lists of
values for multiple focal mechanisms.

Both dict and :class:`pandas.DataFrame` may optionally contain the keys /
column names: ``latitude``, ``longitude``, ``depth``, ``plot_longitude``,
``plot_latitude``, and/or ``event_name``.

If ``spec`` is either a str or a 1-D or 2-D numpy array, the ``convention``
parameter is required to interpret the columns. If ``spec`` is a dict or
a :class:`pandas.DataFrame`, ``convention`` is not needed and ignored if
specified.
{spec}
scale : float or str
*scale*\ [**+a**\ *angle*][**+f**\ *font*][**+j**\ *justify*]\
[**+l**][**+m**][**+o**\ *dx*\ [/\ *dy*]][**+s**\ *reference*].
Expand Down
Loading