BREAKING: Figure.coast: Add parameter river_lakes for setting fills of river-lakes separately - #4376
Open
seisman wants to merge 16 commits into
Open
BREAKING: Figure.coast: Add parameter river_lakes for setting fills of river-lakes separately#4376seisman wants to merge 16 commits into
seisman wants to merge 16 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Figure.coast’s handling of GMT’s -C option to provide a clearer long-form API for setting lake vs river-lake fills, while preserving backward compatibility with the existing lakes=[...] list syntax.
Changes:
- Added a dedicated
_alias_option_Chelper to build-Carguments fromlakes/river_lakes, including a compatibility path for the legacy list form. - Introduced new
river_lakesparameter and updatedcoastvalidation logic and alias mapping accordingly. - Updated docstring alias/parameter documentation around lake and river-lake fills.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
seisman
marked this pull request as draft
January 29, 2026 12:08
…f lakes/river-lakes
seisman
marked this pull request as ready for review
May 17, 2026 11:08
34 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (5)
pygmt/src/coast.py:306
- The “at least one plotting parameter” guard now checks
kwargs.get("C", lakes or river_lakes) is None, which can behave differently from the previousargs_in_kwargs-based check (e.g.,C=Falsewill bypass the guard even though it’s treated as “not given” elsewhere). Consider explicitly checkinglakes/river_lakesand usingargs_in_kwargsfor short-formCfor consistent semantics.
and kwargs.get("W", shorelines) is False
and kwargs.get("C", lakes or river_lakes) is None
and not args_in_kwargs(args=["E", "Q"], kwargs=kwargs)
pygmt/src/coast.py:323
- This PR introduces new parsing/aliasing behavior for GMT’s
-Coption (including legacy compatibility and mixed-usage errors), but there are no unit tests covering the newlakes/river_lakesparameters. Adding tests would help prevent regressions in argument translation and breaking-change semantics.
aliasdict = AliasSystem(
C=_alias_option_C(lakes=lakes, river_lakes=river_lakes),
pygmt/src/coast.py:63
- Typo in the inline comment: “sytax” should be “syntax” (helps keep comments searchable/readable).
# The new sytax.
pygmt/src/coast.py:85
lakes/river_lakeswere inserted in the middle of the publiccoastsignature, which creates an additional breaking change for any positional callers (arguments aftershorelinesshift). To minimize breakage, append the new parameters near the end of the signature (before**kwargs) so existing positional argument order is preserved.
shorelines: bool | str | Sequence[int | str] = False,
lakes: str | None = None,
river_lakes: str | None = None,
map_scale: str | None = None,
box: Box | bool = False,
pygmt/src/coast.py:149
- The new docstrings for
lakes/river_lakesdon’t mention the accepted legacy-Csyntax ("fill+l","fill+r", or a list of these) that_alias_option_Cstill supports. This can confuse users/type checkers during migration.
lakes
Select filling of lakes. If not specified, will use the fill for "wet" areas set
by the ``water`` parameter.
river_lakes
Select filling of river-lakes. If not specified, will use the fill for "wet"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves the alias of
coast's-Coption. The GMT CLI syntax is-Cfill[+l|+r].Previously,
-Cwas aliased tolakes. This PR split the-Coption into two parameters,lakesandriver_lakes. Here is a comparison of old and new usages:lakes="blue"lakes="blue", river_lakes="blue"lakes="blue+r"river_lakes="blue"lakes="blue+l"lakes="blue"lakes=["blue+r", "green+l"]lakes="green", river_lakes="blue"Please note that in the old syntax, using
lakes="blue"also set the fill color of river-lakes to"blue". If we preserved that behavior, there would be no Pythonic way to fill only lakes without also filling river-lakes. Therefore, I decided to aliaslakes="blue"to-Cblue+l, meaning “fill lakes only.” This introduces a breaking change.Related to #4240