From 2bd69cc5337dd56fbe4542f9e0cc59bf2d1143bc Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 4 Dec 2025 15:48:33 +0800 Subject: [PATCH 1/4] Figure.coast: Migrate the land/water parameter to the new alias system --- pygmt/src/coast.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pygmt/src/coast.py b/pygmt/src/coast.py index ae6efb3e0bb..0f4b47a358f 100644 --- a/pygmt/src/coast.py +++ b/pygmt/src/coast.py @@ -24,18 +24,18 @@ A="area_thresh", C="lakes", E="dcw", - G="land", I="rivers", L="map_scale", N="borders", - S="water", W="shorelines", ) -def coast( +def coast( # noqa: PLR0913 self, resolution: Literal[ "auto", "full", "high", "intermediate", "low", "crude", None ] = None, + land: str | None = None, + water: str | None = None, box: Box | bool = False, projection: str | None = None, frame: str | Sequence[str] | bool = False, @@ -69,9 +69,11 @@ def coast( $aliases - B = frame - D = resolution + - G = land - F = box - J = projection - R = region + - S = water - V = verbose - c = panel - p = perspective @@ -97,8 +99,10 @@ def coast( ``"low"``, and ``"crude"``, which drops by 80% between levels. Default is ``"auto"`` to automatically select the most suitable resolution given the chosen map scale. - land : str + land Select filling of "dry" areas. + water + Select filling of "wet" areas. rivers : int, str, or list *river*\ [/*pen*]. Draw rivers. Specify the type of rivers and [optionally] append @@ -149,8 +153,6 @@ def coast( - ``3``: marine boundaries - ``"a"``: all boundaries (``1`` - ``3``) - water : str - Select filling "wet" areas. shorelines : bool, int, str, or list [*level*\ /]\ *pen*. Draw shorelines [Default is no shorelines]. Append pen attributes @@ -222,6 +224,8 @@ def coast( }, ), F=Alias(box, name="box"), + G=Alias(land, name="land"), + S=Alias(water, name="water"), ).add_common( B=frame, J=projection, From 42d7c9537dd900a72358c6e824548ac9669bf55e Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 4 Dec 2025 17:15:23 +0800 Subject: [PATCH 2/4] Fix the chekcing --- pygmt/src/coast.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pygmt/src/coast.py b/pygmt/src/coast.py index 0f4b47a358f..149e2af72ff 100644 --- a/pygmt/src/coast.py +++ b/pygmt/src/coast.py @@ -203,7 +203,12 @@ def coast( # noqa: PLR0913 >>> fig.show() """ self._activate_figure() - if not args_in_kwargs(args=["C", "G", "S", "I", "N", "E", "Q", "W"], kwargs=kwargs): + + if ( + kwargs.get("G", land) is None + and kwargs.get("S", water) is None + and not args_in_kwargs(args=["C", "I", "N", "E", "Q", "W"], kwargs=kwargs) + ): msg = ( "At least one of the following parameters must be specified: " "lakes, land, water, rivers, borders, dcw, Q, or shorelines." From 9dda6e77e763853997503987e227df3dbca2fe36 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 4 Dec 2025 19:14:50 +0800 Subject: [PATCH 3/4] Update pygmt/src/coast.py [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- pygmt/src/coast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/coast.py b/pygmt/src/coast.py index 149e2af72ff..ab73afc3023 100644 --- a/pygmt/src/coast.py +++ b/pygmt/src/coast.py @@ -69,8 +69,8 @@ def coast( # noqa: PLR0913 $aliases - B = frame - D = resolution - - G = land - F = box + - G = land - J = projection - R = region - S = water From 00e12bc04eabe48b5f814c4979d0f5420f885b57 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 4 Dec 2025 19:15:13 +0800 Subject: [PATCH 4/4] Update error message [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- pygmt/src/coast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/coast.py b/pygmt/src/coast.py index ab73afc3023..046d03d3ef5 100644 --- a/pygmt/src/coast.py +++ b/pygmt/src/coast.py @@ -211,7 +211,7 @@ def coast( # noqa: PLR0913 ): msg = ( "At least one of the following parameters must be specified: " - "lakes, land, water, rivers, borders, dcw, Q, or shorelines." + "land, water, lakes, rivers, borders, dcw, Q, or shorelines." ) raise GMTInvalidInput(msg)