Skip to content

Commit ccfca7d

Browse files
Figure.coast: Migrate the land/water parameters to the new alias system (#4241)
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
1 parent c43e91a commit ccfca7d

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

pygmt/src/coast.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@
2424
A="area_thresh",
2525
C="lakes",
2626
E="dcw",
27-
G="land",
2827
I="rivers",
2928
L="map_scale",
3029
N="borders",
31-
S="water",
3230
W="shorelines",
3331
)
34-
def coast(
32+
def coast( # noqa: PLR0913
3533
self,
3634
resolution: Literal[
3735
"auto", "full", "high", "intermediate", "low", "crude", None
3836
] = None,
37+
land: str | None = None,
38+
water: str | None = None,
3939
box: Box | bool = False,
4040
projection: str | None = None,
4141
frame: str | Sequence[str] | bool = False,
@@ -70,8 +70,10 @@ def coast(
7070
- B = frame
7171
- D = resolution
7272
- F = box
73+
- G = land
7374
- J = projection
7475
- R = region
76+
- S = water
7577
- V = verbose
7678
- c = panel
7779
- p = perspective
@@ -97,8 +99,10 @@ def coast(
9799
``"low"``, and ``"crude"``, which drops by 80% between levels. Default is
98100
``"auto"`` to automatically select the most suitable resolution given the chosen
99101
map scale.
100-
land : str
102+
land
101103
Select filling of "dry" areas.
104+
water
105+
Select filling of "wet" areas.
102106
rivers : int, str, or list
103107
*river*\ [/*pen*].
104108
Draw rivers. Specify the type of rivers and [optionally] append
@@ -149,8 +153,6 @@ def coast(
149153
- ``3``: marine boundaries
150154
- ``"a"``: all boundaries (``1`` - ``3``)
151155
152-
water : str
153-
Select filling "wet" areas.
154156
shorelines : bool, int, str, or list
155157
[*level*\ /]\ *pen*.
156158
Draw shorelines [Default is no shorelines]. Append pen attributes
@@ -201,10 +203,15 @@ def coast(
201203
>>> fig.show()
202204
"""
203205
self._activate_figure()
204-
if not args_in_kwargs(args=["C", "G", "S", "I", "N", "E", "Q", "W"], kwargs=kwargs):
206+
207+
if (
208+
kwargs.get("G", land) is None
209+
and kwargs.get("S", water) is None
210+
and not args_in_kwargs(args=["C", "I", "N", "E", "Q", "W"], kwargs=kwargs)
211+
):
205212
msg = (
206213
"At least one of the following parameters must be specified: "
207-
"lakes, land, water, rivers, borders, dcw, Q, or shorelines."
214+
"land, water, lakes, rivers, borders, dcw, Q, or shorelines."
208215
)
209216
raise GMTInvalidInput(msg)
210217

@@ -222,6 +229,8 @@ def coast(
222229
},
223230
),
224231
F=Alias(box, name="box"),
232+
G=Alias(land, name="land"),
233+
S=Alias(water, name="water"),
225234
).add_common(
226235
B=frame,
227236
J=projection,

0 commit comments

Comments
 (0)