|
2 | 2 | coast - Plot land and water.
|
3 | 3 | """
|
4 | 4 |
|
| 5 | +from typing import Literal |
| 6 | + |
| 7 | +from pygmt.alias import Alias, AliasSystem |
5 | 8 | from pygmt.clib import Session
|
6 | 9 | from pygmt.exceptions import GMTInvalidInput
|
7 | 10 | from pygmt.helpers import (
|
|
20 | 23 | A="area_thresh",
|
21 | 24 | B="frame",
|
22 | 25 | C="lakes",
|
23 |
| - D="resolution", |
24 | 26 | E="dcw",
|
25 | 27 | F="box",
|
26 | 28 | G="land",
|
|
37 | 39 | t="transparency",
|
38 | 40 | )
|
39 | 41 | @kwargs_to_strings(R="sequence", c="sequence_comma", p="sequence")
|
40 |
| -def coast(self, **kwargs): |
| 42 | +def coast( |
| 43 | + self, |
| 44 | + resolution: Literal[ # noqa: ARG001 |
| 45 | + "auto", "full", "high", "intermediate", "low", "crude" |
| 46 | + ] = "auto", |
| 47 | + **kwargs, |
| 48 | +): |
41 | 49 | r"""
|
42 | 50 | Plot continents, shorelines, rivers, and borders on maps.
|
43 | 51 |
|
@@ -75,11 +83,19 @@ def coast(self, **kwargs):
|
75 | 83 | parameter. Optionally, specify separate fills by appending
|
76 | 84 | **+l** for lakes or **+r** for river-lakes, and passing multiple
|
77 | 85 | strings in a list.
|
78 |
| - resolution : str |
79 |
| - **f**\|\ **h**\|\ **i**\|\ **l**\|\ **c**. |
80 |
| - Select the resolution of the data set to: (**f**\ )ull, |
81 |
| - (**h**\ )igh, (**i**\ )ntermediate, (**l**\ )ow, |
82 |
| - and (**c**\ )rude. |
| 86 | + resolution |
| 87 | + Select the resolution of the GSHHG coastline data set to use. The available |
| 88 | + resolutions from highest to lowest are: |
| 89 | +
|
| 90 | + - ``"full"`` - Full resolution (may be very slow for large regions). |
| 91 | + - ``"high"`` - High resolution (may be slow for large regions). |
| 92 | + - ``"intermediate"`` - Intermediate resolution. |
| 93 | + - ``"low"`` - Low resolution. |
| 94 | + - ``"crude"`` - Crude resolution, for tasks that need crude continent outlines |
| 95 | + only. |
| 96 | +
|
| 97 | + The default is ``"auto"`` to automatically select the best resolution given the |
| 98 | + chosen map scale. |
83 | 99 | land : str
|
84 | 100 | Select filling or clipping of "dry" areas.
|
85 | 101 | rivers : int, str, or list
|
@@ -220,11 +236,15 @@ def coast(self, **kwargs):
|
220 | 236 | >>> # Show the plot
|
221 | 237 | >>> fig.show()
|
222 | 238 | """
|
| 239 | + alias = AliasSystem( |
| 240 | + D=Alias("resolution", mapping=True), |
| 241 | + ) |
223 | 242 | kwargs = self._preprocess(**kwargs)
|
224 | 243 | if not args_in_kwargs(args=["C", "G", "S", "I", "N", "E", "Q", "W"], kwargs=kwargs):
|
225 | 244 | raise GMTInvalidInput(
|
226 | 245 | """At least one of the following parameters must be specified:
|
227 | 246 | lakes, land, water, rivers, borders, dcw, Q, or shorelines"""
|
228 | 247 | )
|
| 248 | + |
229 | 249 | with Session() as lib:
|
230 |
| - lib.call_module(module="coast", args=build_arg_list(kwargs)) |
| 250 | + lib.call_module(module="coast", args=build_arg_list(alias.kwdict)) |
0 commit comments