Uh oh!
There was an error while loading. Please reload this page.
Figure.coast/pygmt.select/pygmt.grdlandmask: Use long names ("crude"/"low"/"intermediate"/"high"/"full") for the 'resolution' parameter - #3013
Conversation
b493d81 to
6840b39Compare6840b39 to
5fac3aeComparefdf817e to
5e1ebe8CompareCodSpeed Performance ReportMerging #3013 will not alter performanceComparing Summary
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Ping @GenericMappingTools/pygmt-maintainers for thoughts on the proposed changes towards more Pythonic arguments. |
seisman
commented
Oct 30, 2024
Actually, this PR is not needed if PR #3238 is implemented. |
seisman
commented
May 24, 2025
| def _parse_coastline_resolution( | ||
| resolution: Literal["auto", "full", "high", "intermediate", "low", "crude", None], | ||
| ) -> Literal["a", "f", "h", "i", "l", "c", None]: |
There was a problem hiding this comment.
Thoughts on making a StrEnum out of this?
There was a problem hiding this comment.
What are the benefits? This private function will likely be removed after #3239 is implemented.
There was a problem hiding this comment.
Yeah, StrEnum will be a lot more work, and we'll need to bring in something like pydantic (mentioned at #3239 (comment)) to fully enable runtime checks. Ok to keep this as is for now, and wait for #3239.
| kwargs["D"] = kwargs.get("D", _parse_coastline_resolution(resolution)) | ||
There was a problem hiding this comment.
The simplest form of this line is:
kwargs["D"] = _parse_coastline_resolution(resolution)
but to support short-form parameters like D="f", we have to write the code like:
kwargs["D"] = kwargs.get("D", _parse_coastline_resolution(resolution))
The D="resolution" line is also removed from the use_alias decorator. Otherwise, we have to write codes like below:
kwargs["D"] = _parse_coastline_resolution(kwgars.get("D"))
It's fine, but then ruff will complain that the resolution parameter is unused.
| A="area_thresh", | ||
| B="frame", | ||
| C="lakes", | ||
| D="resolution", |
There was a problem hiding this comment.
After removing D="resolution", this alias won't be shown in the alias list. Need to wait for #3945.
This PR updates the
resolutionparameter forFigure.coast/pygmt.select/pygmt.grdlandmaskto use long names.