From a8d1583ba741c439e165418992b1c1ba1e3d7151 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 25 Sep 2025 19:27:15 +0800 Subject: [PATCH 01/31] Add entry in doc/_static/version_switch.js for documentation switcher --- doc/_static/version_switch.js | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/_static/version_switch.js b/doc/_static/version_switch.js index 3db1fc7ebdc..87f5741edcc 100644 --- a/doc/_static/version_switch.js +++ b/doc/_static/version_switch.js @@ -12,6 +12,7 @@ var all_versions = { 'latest': 'latest', 'dev': 'dev', + 'v0.17.0': 'v0.17.0', 'v0.16.0': 'v0.16.0', 'v0.15.0': 'v0.15.0', 'v0.14.2': 'v0.14.2', From 8f5dd4eeeec921df2043abbdec3d0351d34a4d70 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 25 Sep 2025 19:32:24 +0800 Subject: [PATCH 02/31] Add the version to the compatibility table doc/minversions.md --- doc/minversions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/minversions.md b/doc/minversions.md index 48ffb57abba..7f4fd4c7b87 100644 --- a/doc/minversions.md +++ b/doc/minversions.md @@ -47,6 +47,7 @@ compatibility reasons. | PyGMT Version | Documentation | GMT | Python | NumPy | pandas | Xarray | |---|---|---|---|---|---|---| | [Dev][]* | , [HTML+ZIP](doc:dev/pygmt-docs.zip), [PDF](doc:dev/pygmt-docs.pdf) | {{ requires.gmt }} | {{ requires.python }} | {{ requires.numpy }} | {{ requires.pandas }} | {{ requires.xarray }} | +| | , , | >=6.4.0 | >=3.11 | >=1.26 | >=2.2 | >=2023.10 | | | , , | >=6.4.0 | >=3.11 | >=1.26 | >=2.1 | >=2023.07 | | | , , | >=6.4.0 | >=3.11 | >=1.25 | >=2.0 | >=2023.04 | | | , | >=6.4.0 | >=3.11 | >=1.25 | >=2.0 | >=2023.04 | From 51de6d7ff33bf3d636dfa145ed38ce87cccd29b9 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 25 Sep 2025 19:52:49 +0800 Subject: [PATCH 03/31] Update citation information CITATION.cff and BibTeX in README --- CITATION.cff | 6 +++--- README.md | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index fecb6107431..79a07819bf7 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -76,9 +76,9 @@ authors: family-names: Wessel affiliation: University of Hawaiʻi at Mānoa, USA orcid: https://orcid.org/0000-0001-5708-7336 -date-released: 2025-06-18 -doi: 10.5281/zenodo.15628725 +date-released: 2025-09-30 +doi: 10.5281/zenodo.17156962 license: BSD-3-Clause repository-code: https://github.com/GenericMappingTools/pygmt type: software -version: 0.16.0 +version: 0.17.0 diff --git a/README.md b/README.md index cee0d6cd242..0f2d37c8696 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ Feel free to cite our work in your research using the following BibTeX: ``` @software{ - pygmt_2025_15628725, + pygmt_2025_17156962, author = {Tian, Dongdong and Uieda, Leonardo and Leong, Wei Ji and @@ -157,12 +157,12 @@ Feel free to cite our work in your research using the following BibTeX: Quinn, Jamie and Wessel, Paul}, title = {{PyGMT: A Python interface for the Generic Mapping Tools}}, - month = jun, + month = sep, year = 2025, publisher = {Zenodo}, - version = {0.16.0}, - doi = {10.5281/zenodo.15628725}, - url = {https://doi.org/10.5281/zenodo.15628725} + version = {0.17.0}, + doi = {10.5281/zenodo.17156962}, + url = {https://doi.org/10.5281/zenodo.17156962} } ``` From b8d6ee3060334cbbbd0f991123be272ca56de17f Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 25 Sep 2025 19:57:18 +0800 Subject: [PATCH 04/31] Move Leo to second last and update affiliation --- AUTHORS.md | 2 +- CITATION.cff | 8 ++++---- README.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 09afed5ff16..fb8367ddda6 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -17,7 +17,7 @@ The following people have contributed code and/or documentation to the project | [Jiayuan Yao](https://github.com/core-man) | [0000-0001-7036-4238](https://orcid.org/0000-0001-7036-4238) | Nanyang Technological University, Singapore | | [Jing-Hui Tong](https://github.com/jhtong33) | [0009-0002-7195-3071](https://orcid.org/0009-0002-7195-3071) | National Taiwan Normal University, Taiwan | | [Kathryn Materna](https://github.com/kmaterna) | [0000-0002-6687-980X](https://orcid.org/0000-0002-6687-980X) | US Geological Survey, USA | -| [Leonardo Uieda](https://www.leouieda.com/) | [0000-0001-6123-9515](https://orcid.org/0000-0001-6123-9515) | University of Liverpool, United Kingdom | +| [Leonardo Uieda](https://www.leouieda.com/) | [0000-0001-6123-9515](https://orcid.org/0000-0001-6123-9515) | Universidade de São Paulo, Brazil | | [Liam Toney](https://liam.earth/) | [0000-0003-0167-9433](https://orcid.org/0000-0003-0167-9433) | University of Alaska Fairbanks, USA | | [Malte Ziebarth](https://github.com/mjziebarth) | [0000-0002-5190-4478](https://orcid.org/0000-0002-5190-4478) | GFZ German Research Centre for Geosciences, Germany | | [Max Jones](https://github.com/maxrjones) | [0000-0003-0180-8928](https://orcid.org/0000-0003-0180-8928) | University of Hawaiʻi at Mānoa, USA | diff --git a/CITATION.cff b/CITATION.cff index 79a07819bf7..2db463c3214 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,10 +8,6 @@ authors: family-names: Tian affiliation: China University of Geosciences, China orcid: https://orcid.org/0000-0001-7967-1197 -- given-names: Leonardo - family-names: Uieda - affiliation: University of Liverpool, United Kingdom - orcid: https://orcid.org/0000-0001-6123-9515 - given-names: Wei Ji family-names: Leong affiliation: Development Seed, USA @@ -72,6 +68,10 @@ authors: family-names: Quinn affiliation: University College London, United Kingdom orcid: https://orcid.org/0000-0002-0268-7032 +- given-names: Leonardo + family-names: Uieda + affiliation: Universidade de São Paulo, Brazil + orcid: https://orcid.org/0000-0001-6123-9515 - given-names: Paul family-names: Wessel affiliation: University of Hawaiʻi at Mānoa, USA diff --git a/README.md b/README.md index 0f2d37c8696..ae9a4edf667 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,6 @@ Feel free to cite our work in your research using the following BibTeX: @software{ pygmt_2025_17156962, author = {Tian, Dongdong and - Uieda, Leonardo and Leong, Wei Ji and Fröhlich, Yvonne and Grund, Michael and @@ -155,6 +154,7 @@ Feel free to cite our work in your research using the following BibTeX: Anant, Abhishek and Ziebarth, Malte and Quinn, Jamie and + Uieda, Leonardo and Wessel, Paul}, title = {{PyGMT: A Python interface for the Generic Mapping Tools}}, month = sep, From 2d2eb7e9a85bf7e86ebdb5163f041b6d31baf9e6 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 25 Sep 2025 20:02:52 +0800 Subject: [PATCH 05/31] Copy the draft release note from the release page --- doc/changes.md | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/doc/changes.md b/doc/changes.md index cc094e761c1..e72493e1356 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -1,5 +1,71 @@ # Changelog +## Release v0.17.0 (20YY/MM/DD) + +[![Digital Object Identifier for PyGMT v0.17.0](https://zenodo.org/badge/DOI/10.5281/zenodo.3781524.svg)](https://doi.org/10.5281/zenodo.3781524) + +### Highlights + +* + +### New Features + +* GMTDataArrayAccessor: Support applying grid operations on the current xarray.DataArray object ([#3854](https://github.com/GenericMappingTools/pygmt/pull/3854)) +* Add the Box class for specifying the box of GMT embellishments ([#3995](https://github.com/GenericMappingTools/pygmt/pull/3995)) + +### Enhancements + +* sequence_join: Correctly join datetime-like values in pd.DataFrame/xr.DataArray objects ([#4097](https://github.com/GenericMappingTools/pygmt/pull/4097)) +* pygmt.show_versions: Report GDAL version by calling the GDAL C function ([#4104](https://github.com/GenericMappingTools/pygmt/pull/4104)) +* pygmt.binstats: Let the parameter 'statistic' support descriptive arguments ([#3012](https://github.com/GenericMappingTools/pygmt/pull/3012)) +* New Alias System: Add the private _to_string function ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986)) +* New Alias System: Add the AliasSystem class ([#4000](https://github.com/GenericMappingTools/pygmt/pull/4000)) +* New Alias System: Add the Alias class ([#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) +* Migrate the parameter 'verbose' to the new alias system and let it support descriptive arguments ([#4039](https://github.com/GenericMappingTools/pygmt/pull/4039)) +* Figure.solar: Support terminator datetime with timezone ([#4112](https://github.com/GenericMappingTools/pygmt/pull/4112)) +* Figure.logo: Let the 'style' parameter support descriptive arguments ([#4074](https://github.com/GenericMappingTools/pygmt/pull/4074)) +* BREAKING: Raise GMTValueError exception for invalid values. Previously raise GMTInvalidInput ([#3985](https://github.com/GenericMappingTools/pygmt/pull/3985)) +* BREAKING: Raise GMTValueError exception for invalid values part 2 ([#3998](https://github.com/GenericMappingTools/pygmt/pull/3998)) +* BREAKING: Raise GMTTypeError exception for invalid types. Previously raise GMTInvalidInput ([#3999](https://github.com/GenericMappingTools/pygmt/pull/3999)) + +### Deprecations + +* sequence_join/_to_string/Alias: Deprecate parameter 'separator', use 'sep' instead. [Will be removed in v0.19.0] ([#4033](https://github.com/GenericMappingTools/pygmt/pull/4033)) + +### Bug Fixes + +* x2sys_cross: Fix IndexError to allow empty dataframe outputs ([#4060](https://github.com/GenericMappingTools/pygmt/pull/4060)) +* is_nonstr_iter: 0-D array is now recognized as non-iterable ([#4004](https://github.com/GenericMappingTools/pygmt/pull/4004)) +* _to_string: Fix the bug when a 2-D sequence is passed ([#4032](https://github.com/GenericMappingTools/pygmt/pull/4032)) +* Fix the bug when passing a sequence that contains True to a parameter ([#3982](https://github.com/GenericMappingTools/pygmt/pull/3982)) + +### Documentation + +* DOC: Add gallery example to show text formatting ([#3987](https://github.com/GenericMappingTools/pygmt/pull/3987)) +* DOC: Add gallery example for using EPSG codes ([#3973](https://github.com/GenericMappingTools/pygmt/pull/3973)) +* DOC: Add Technical Reference page for justification codes ([#4028](https://github.com/GenericMappingTools/pygmt/pull/4028)) +* DOC: Technical Reference: Add table for text formatting ([#3976](https://github.com/GenericMappingTools/pygmt/pull/3976)) + +### Maintenance + +* sequence_join/_to_string/Alias: Deprecate parameter 'separator', use 'sep' instead. [Will be removed in v0.19.0] ([#4033](https://github.com/GenericMappingTools/pygmt/pull/4033)) +* [BREAKING] Figure.text: Raise GMTTypeError if text is a sequence when position is given ([#4065](https://github.com/GenericMappingTools/pygmt/pull/4065)) +* [BREAKING] Figure.grdimage: Raise NotImplementedError instead of GMTInvalidInput for -A option ([#4062](https://github.com/GenericMappingTools/pygmt/pull/4062)) +* Switch from pre-commit to prek ([#4082](https://github.com/GenericMappingTools/pygmt/pull/4082)) +* SPEC 0: Bump minimum supported version to pandas 2.2 ([#4092](https://github.com/GenericMappingTools/pygmt/pull/4092)) +* SPEC 0: Bump minimum supported version to Xarray 2023.10 ([#4091](https://github.com/GenericMappingTools/pygmt/pull/4091)) +* Remove the support of non-aliased aliases in use_alias/fmt_docstrings ([#4042](https://github.com/GenericMappingTools/pygmt/pull/4042)) +* CI: Use macos-26 in the GMT Dev Tests workflow ([#4084](https://github.com/GenericMappingTools/pygmt/pull/4084)) +* CI: Bump to macOS 14 in the GMT Legacy Tests workflow ([#3996](https://github.com/GenericMappingTools/pygmt/pull/3996)) +* CI: Access DagsHub repository via an access token ([#4078](https://github.com/GenericMappingTools/pygmt/pull/4078)) + +**Full Changelog**: + +### Contributors + +[Dongdong Tian](https://github.com/seisman), [Wei Ji Leong](https://github.com/weiji14) and [Yvonne Fröhlich](https://github.com/yvonnefroehlich) + + ## Release v0.16.0 (2025/06/18) [![Digital Object Identifier for PyGMT v0.16.0](https://zenodo.org/badge/DOI/10.5281/zenodo.15628725.svg)](https://doi.org/10.5281/zenodo.15628725) From 0a4129c896d1c23a9d2c1d278e8670c4914dc8c7 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 25 Sep 2025 20:06:06 +0800 Subject: [PATCH 06/31] Update release date, doi and contributors in the changelog --- doc/changes.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/changes.md b/doc/changes.md index e72493e1356..bc383cf93a8 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -1,8 +1,8 @@ # Changelog -## Release v0.17.0 (20YY/MM/DD) +## Release v0.17.0 (2025/09/30) -[![Digital Object Identifier for PyGMT v0.17.0](https://zenodo.org/badge/DOI/10.5281/zenodo.3781524.svg)](https://doi.org/10.5281/zenodo.3781524) +[![Digital Object Identifier for PyGMT v0.17.0](https://zenodo.org/badge/DOI/10.5281/zenodo.17156962.svg)](https://doi.org/10.5281/zenodo.17156962) ### Highlights @@ -63,8 +63,12 @@ ### Contributors -[Dongdong Tian](https://github.com/seisman), [Wei Ji Leong](https://github.com/weiji14) and [Yvonne Fröhlich](https://github.com/yvonnefroehlich) +* [Dongdong Tian](https://github.com/seisman) +* [Yvonne Fröhlich](https://github.com/yvonnefroehlich) +* [Wei Ji Leong](https://github.com/weiji14) +* [Michael Grund](https://github.com/michaelgrund) +--- ## Release v0.16.0 (2025/06/18) From 3ce82daa14068d9c41176b453c3a6067c3ac70bd Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 26 Sep 2025 09:17:24 +0800 Subject: [PATCH 07/31] Add PR #4020 [skip ci] --- doc/changes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changes.md b/doc/changes.md index bc383cf93a8..a14cc1307ef 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -12,6 +12,7 @@ * GMTDataArrayAccessor: Support applying grid operations on the current xarray.DataArray object ([#3854](https://github.com/GenericMappingTools/pygmt/pull/3854)) * Add the Box class for specifying the box of GMT embellishments ([#3995](https://github.com/GenericMappingTools/pygmt/pull/3995)) +* Add the Pattern class for specifying bit and hachure patterns to fill symbols and polygons ([#4020](https://github.com/GenericMappingTools/pygmt/pull/4020)) ### Enhancements From 959aa130427fbe93cb90310aae3f9ecb5cce7fac Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 26 Sep 2025 10:02:40 +0800 Subject: [PATCH 08/31] Merge some entries [skip ci] --- doc/changes.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/changes.md b/doc/changes.md index a14cc1307ef..0f9db8240d6 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -19,9 +19,7 @@ * sequence_join: Correctly join datetime-like values in pd.DataFrame/xr.DataArray objects ([#4097](https://github.com/GenericMappingTools/pygmt/pull/4097)) * pygmt.show_versions: Report GDAL version by calling the GDAL C function ([#4104](https://github.com/GenericMappingTools/pygmt/pull/4104)) * pygmt.binstats: Let the parameter 'statistic' support descriptive arguments ([#3012](https://github.com/GenericMappingTools/pygmt/pull/3012)) -* New Alias System: Add the private _to_string function ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986)) -* New Alias System: Add the AliasSystem class ([#4000](https://github.com/GenericMappingTools/pygmt/pull/4000)) -* New Alias System: Add the Alias class ([#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) +* Implement the new alias system towards to a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) * Migrate the parameter 'verbose' to the new alias system and let it support descriptive arguments ([#4039](https://github.com/GenericMappingTools/pygmt/pull/4039)) * Figure.solar: Support terminator datetime with timezone ([#4112](https://github.com/GenericMappingTools/pygmt/pull/4112)) * Figure.logo: Let the 'style' parameter support descriptive arguments ([#4074](https://github.com/GenericMappingTools/pygmt/pull/4074)) @@ -53,8 +51,7 @@ * [BREAKING] Figure.text: Raise GMTTypeError if text is a sequence when position is given ([#4065](https://github.com/GenericMappingTools/pygmt/pull/4065)) * [BREAKING] Figure.grdimage: Raise NotImplementedError instead of GMTInvalidInput for -A option ([#4062](https://github.com/GenericMappingTools/pygmt/pull/4062)) * Switch from pre-commit to prek ([#4082](https://github.com/GenericMappingTools/pygmt/pull/4082)) -* SPEC 0: Bump minimum supported version to pandas 2.2 ([#4092](https://github.com/GenericMappingTools/pygmt/pull/4092)) -* SPEC 0: Bump minimum supported version to Xarray 2023.10 ([#4091](https://github.com/GenericMappingTools/pygmt/pull/4091)) +* SPEC 0: Bump minimum supported version to pandas 2.2 and Xarray 2023.10 ([#4092](https://github.com/GenericMappingTools/pygmt/pull/4092), [#4091](https://github.com/GenericMappingTools/pygmt/pull/4091)) * Remove the support of non-aliased aliases in use_alias/fmt_docstrings ([#4042](https://github.com/GenericMappingTools/pygmt/pull/4042)) * CI: Use macos-26 in the GMT Dev Tests workflow ([#4084](https://github.com/GenericMappingTools/pygmt/pull/4084)) * CI: Bump to macOS 14 in the GMT Legacy Tests workflow ([#3996](https://github.com/GenericMappingTools/pygmt/pull/3996)) From 985ba907e5aa5d9380eb58154965a2c56686e7b9 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 26 Sep 2025 10:04:11 +0800 Subject: [PATCH 09/31] Polish some changelog entries [skip ci] --- doc/changes.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/changes.md b/doc/changes.md index 0f9db8240d6..2f6339aa437 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -23,9 +23,8 @@ * Migrate the parameter 'verbose' to the new alias system and let it support descriptive arguments ([#4039](https://github.com/GenericMappingTools/pygmt/pull/4039)) * Figure.solar: Support terminator datetime with timezone ([#4112](https://github.com/GenericMappingTools/pygmt/pull/4112)) * Figure.logo: Let the 'style' parameter support descriptive arguments ([#4074](https://github.com/GenericMappingTools/pygmt/pull/4074)) -* BREAKING: Raise GMTValueError exception for invalid values. Previously raise GMTInvalidInput ([#3985](https://github.com/GenericMappingTools/pygmt/pull/3985)) -* BREAKING: Raise GMTValueError exception for invalid values part 2 ([#3998](https://github.com/GenericMappingTools/pygmt/pull/3998)) -* BREAKING: Raise GMTTypeError exception for invalid types. Previously raise GMTInvalidInput ([#3999](https://github.com/GenericMappingTools/pygmt/pull/3999)) +* **BREAKING** Raise GMTValueError exception for invalid values. Previously raise GMTInvalidInput ([#3985](https://github.com/GenericMappingTools/pygmt/pull/3985), [#3998](https://github.com/GenericMappingTools/pygmt/pull/3998)) +* **BREAKING** Raise GMTTypeError exception for invalid types. Previously raise GMTInvalidInput ([#3999](https://github.com/GenericMappingTools/pygmt/pull/3999)) ### Deprecations @@ -40,20 +39,20 @@ ### Documentation -* DOC: Add gallery example to show text formatting ([#3987](https://github.com/GenericMappingTools/pygmt/pull/3987)) -* DOC: Add gallery example for using EPSG codes ([#3973](https://github.com/GenericMappingTools/pygmt/pull/3973)) -* DOC: Add Technical Reference page for justification codes ([#4028](https://github.com/GenericMappingTools/pygmt/pull/4028)) -* DOC: Technical Reference: Add table for text formatting ([#3976](https://github.com/GenericMappingTools/pygmt/pull/3976)) +* Add gallery example to show text formatting ([#3987](https://github.com/GenericMappingTools/pygmt/pull/3987)) +* Add gallery example for using EPSG codes ([#3973](https://github.com/GenericMappingTools/pygmt/pull/3973)) +* Add Technical Reference page for justification codes ([#4028](https://github.com/GenericMappingTools/pygmt/pull/4028)) +* Add Technical Reference page for text formatting ([#3976](https://github.com/GenericMappingTools/pygmt/pull/3976)) ### Maintenance * sequence_join/_to_string/Alias: Deprecate parameter 'separator', use 'sep' instead. [Will be removed in v0.19.0] ([#4033](https://github.com/GenericMappingTools/pygmt/pull/4033)) -* [BREAKING] Figure.text: Raise GMTTypeError if text is a sequence when position is given ([#4065](https://github.com/GenericMappingTools/pygmt/pull/4065)) -* [BREAKING] Figure.grdimage: Raise NotImplementedError instead of GMTInvalidInput for -A option ([#4062](https://github.com/GenericMappingTools/pygmt/pull/4062)) +* **BREAKING** Figure.text: Raise GMTTypeError if text is a sequence when position is given ([#4065](https://github.com/GenericMappingTools/pygmt/pull/4065)) +* **BREAKING** Figure.grdimage: Raise NotImplementedError instead of GMTInvalidInput for -A option ([#4062](https://github.com/GenericMappingTools/pygmt/pull/4062)) * Switch from pre-commit to prek ([#4082](https://github.com/GenericMappingTools/pygmt/pull/4082)) * SPEC 0: Bump minimum supported version to pandas 2.2 and Xarray 2023.10 ([#4092](https://github.com/GenericMappingTools/pygmt/pull/4092), [#4091](https://github.com/GenericMappingTools/pygmt/pull/4091)) * Remove the support of non-aliased aliases in use_alias/fmt_docstrings ([#4042](https://github.com/GenericMappingTools/pygmt/pull/4042)) -* CI: Use macos-26 in the GMT Dev Tests workflow ([#4084](https://github.com/GenericMappingTools/pygmt/pull/4084)) +* CI: Bump to macOS 26 in the GMT Dev Tests workflow ([#4084](https://github.com/GenericMappingTools/pygmt/pull/4084)) * CI: Bump to macOS 14 in the GMT Legacy Tests workflow ([#3996](https://github.com/GenericMappingTools/pygmt/pull/3996)) * CI: Access DagsHub repository via an access token ([#4078](https://github.com/GenericMappingTools/pygmt/pull/4078)) From c7d900bf61f0041fc1df6b424a92890a20e6fbc5 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 26 Sep 2025 12:34:26 +0800 Subject: [PATCH 10/31] Reorder entries --- doc/changes.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/changes.md b/doc/changes.md index 2f6339aa437..ca38d20c9b3 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -16,15 +16,15 @@ ### Enhancements -* sequence_join: Correctly join datetime-like values in pd.DataFrame/xr.DataArray objects ([#4097](https://github.com/GenericMappingTools/pygmt/pull/4097)) +* Figure.solar: Support terminator datetime with timezone ([#4112](https://github.com/GenericMappingTools/pygmt/pull/4112)) +* Implement the new alias system towards to a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) * pygmt.show_versions: Report GDAL version by calling the GDAL C function ([#4104](https://github.com/GenericMappingTools/pygmt/pull/4104)) * pygmt.binstats: Let the parameter 'statistic' support descriptive arguments ([#3012](https://github.com/GenericMappingTools/pygmt/pull/3012)) -* Implement the new alias system towards to a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) -* Migrate the parameter 'verbose' to the new alias system and let it support descriptive arguments ([#4039](https://github.com/GenericMappingTools/pygmt/pull/4039)) -* Figure.solar: Support terminator datetime with timezone ([#4112](https://github.com/GenericMappingTools/pygmt/pull/4112)) * Figure.logo: Let the 'style' parameter support descriptive arguments ([#4074](https://github.com/GenericMappingTools/pygmt/pull/4074)) +* Let the 'verbose' parameter support descriptive arguments ([#4039](https://github.com/GenericMappingTools/pygmt/pull/4039)) * **BREAKING** Raise GMTValueError exception for invalid values. Previously raise GMTInvalidInput ([#3985](https://github.com/GenericMappingTools/pygmt/pull/3985), [#3998](https://github.com/GenericMappingTools/pygmt/pull/3998)) * **BREAKING** Raise GMTTypeError exception for invalid types. Previously raise GMTInvalidInput ([#3999](https://github.com/GenericMappingTools/pygmt/pull/3999)) +* sequence_join: Correctly join datetime-like values in pd.DataFrame/xr.DataArray objects ([#4097](https://github.com/GenericMappingTools/pygmt/pull/4097)) ### Deprecations From a15872f35b403a3ac64a9c67aa0d8189cc8d7e27 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 26 Sep 2025 12:35:14 +0800 Subject: [PATCH 11/31] Remove one duplicate entry --- doc/changes.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index ca38d20c9b3..b3f9f64d3f4 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -46,7 +46,6 @@ ### Maintenance -* sequence_join/_to_string/Alias: Deprecate parameter 'separator', use 'sep' instead. [Will be removed in v0.19.0] ([#4033](https://github.com/GenericMappingTools/pygmt/pull/4033)) * **BREAKING** Figure.text: Raise GMTTypeError if text is a sequence when position is given ([#4065](https://github.com/GenericMappingTools/pygmt/pull/4065)) * **BREAKING** Figure.grdimage: Raise NotImplementedError instead of GMTInvalidInput for -A option ([#4062](https://github.com/GenericMappingTools/pygmt/pull/4062)) * Switch from pre-commit to prek ([#4082](https://github.com/GenericMappingTools/pygmt/pull/4082)) From ec452399bdaa1a8167ab04bcd170102d1ceb775a Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 28 Sep 2025 09:37:45 +0800 Subject: [PATCH 12/31] Update doc/changes.md 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> --- doc/changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index b3f9f64d3f4..5930cb4983d 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -17,7 +17,7 @@ ### Enhancements * Figure.solar: Support terminator datetime with timezone ([#4112](https://github.com/GenericMappingTools/pygmt/pull/4112)) -* Implement the new alias system towards to a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) +* Implement the new alias system towards a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) * pygmt.show_versions: Report GDAL version by calling the GDAL C function ([#4104](https://github.com/GenericMappingTools/pygmt/pull/4104)) * pygmt.binstats: Let the parameter 'statistic' support descriptive arguments ([#3012](https://github.com/GenericMappingTools/pygmt/pull/3012)) * Figure.logo: Let the 'style' parameter support descriptive arguments ([#4074](https://github.com/GenericMappingTools/pygmt/pull/4074)) From 850732cf96866c844937f24e24f689dc3239b88a Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 28 Sep 2025 13:34:37 +0800 Subject: [PATCH 13/31] Add highlights --- doc/changes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index 5930cb4983d..c01c1e83353 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -6,7 +6,9 @@ ### Highlights -* +* 🎉 Seventeenth minor release of PyGMT 🎉 +* Implement the new alias system towards a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) +* GMTDataArrayAccessor: Support applying grid operations on the current xarray.DataArray object ([#3854](https://github.com/GenericMappingTools/pygmt/pull/3854)) ### New Features From ced8d90990411bebed6072f2b29ba5fee41a1702 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 28 Sep 2025 13:49:44 +0800 Subject: [PATCH 14/31] Remove one entry already in highlights [skip ci] --- doc/changes.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index c01c1e83353..c55e5715df6 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -19,7 +19,6 @@ ### Enhancements * Figure.solar: Support terminator datetime with timezone ([#4112](https://github.com/GenericMappingTools/pygmt/pull/4112)) -* Implement the new alias system towards a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) * pygmt.show_versions: Report GDAL version by calling the GDAL C function ([#4104](https://github.com/GenericMappingTools/pygmt/pull/4104)) * pygmt.binstats: Let the parameter 'statistic' support descriptive arguments ([#3012](https://github.com/GenericMappingTools/pygmt/pull/3012)) * Figure.logo: Let the 'style' parameter support descriptive arguments ([#4074](https://github.com/GenericMappingTools/pygmt/pull/4074)) From e0989a258f0623c1261e2daf473d111f2dfda827 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 28 Sep 2025 13:50:00 +0800 Subject: [PATCH 15/31] Remove one entry already in highlights --- doc/changes.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index c55e5715df6..eb980afbbcc 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -12,7 +12,6 @@ ### New Features -* GMTDataArrayAccessor: Support applying grid operations on the current xarray.DataArray object ([#3854](https://github.com/GenericMappingTools/pygmt/pull/3854)) * Add the Box class for specifying the box of GMT embellishments ([#3995](https://github.com/GenericMappingTools/pygmt/pull/3995)) * Add the Pattern class for specifying bit and hachure patterns to fill symbols and polygons ([#4020](https://github.com/GenericMappingTools/pygmt/pull/4020)) From b859074c9cb32048b3e98b78c812e4f98542f787 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 28 Sep 2025 13:54:13 +0800 Subject: [PATCH 16/31] Remove an entry for a private function --- doc/changes.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index eb980afbbcc..02ace64ec48 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -34,7 +34,6 @@ * x2sys_cross: Fix IndexError to allow empty dataframe outputs ([#4060](https://github.com/GenericMappingTools/pygmt/pull/4060)) * is_nonstr_iter: 0-D array is now recognized as non-iterable ([#4004](https://github.com/GenericMappingTools/pygmt/pull/4004)) -* _to_string: Fix the bug when a 2-D sequence is passed ([#4032](https://github.com/GenericMappingTools/pygmt/pull/4032)) * Fix the bug when passing a sequence that contains True to a parameter ([#3982](https://github.com/GenericMappingTools/pygmt/pull/3982)) ### Documentation From dd06fbaa17d55b8b2f76f6d781bd474346118745 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 28 Sep 2025 13:55:07 +0800 Subject: [PATCH 17/31] Fix an changelog description, because _to_string/Alias are new in v0.17.0 --- doc/changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index 02ace64ec48..a3c591778f2 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -28,7 +28,7 @@ ### Deprecations -* sequence_join/_to_string/Alias: Deprecate parameter 'separator', use 'sep' instead. [Will be removed in v0.19.0] ([#4033](https://github.com/GenericMappingTools/pygmt/pull/4033)) +* sequence_join: Deprecate parameter 'separator', use 'sep' instead. [Will be removed in v0.19.0] ([#4033](https://github.com/GenericMappingTools/pygmt/pull/4033)) ### Bug Fixes From 7ac227872a312ee4d1bb6bcaa7d9a374c3dd4428 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Sep 2025 10:07:58 +0800 Subject: [PATCH 18/31] Boldify the first highlight --- doc/changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index a3c591778f2..de0da8527f4 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -6,7 +6,7 @@ ### Highlights -* 🎉 Seventeenth minor release of PyGMT 🎉 +* 🎉 **Seventeenth minor release of PyGMT** 🎉 * Implement the new alias system towards a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) * GMTDataArrayAccessor: Support applying grid operations on the current xarray.DataArray object ([#3854](https://github.com/GenericMappingTools/pygmt/pull/3854)) From 04087ee42dee362a87950bb8b2621d7e7dd910a5 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Sep 2025 12:55:19 +0800 Subject: [PATCH 19/31] Move entries [skip ci] Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- doc/changes.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/changes.md b/doc/changes.md index de0da8527f4..a42fd2b6a1d 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -22,12 +22,13 @@ * pygmt.binstats: Let the parameter 'statistic' support descriptive arguments ([#3012](https://github.com/GenericMappingTools/pygmt/pull/3012)) * Figure.logo: Let the 'style' parameter support descriptive arguments ([#4074](https://github.com/GenericMappingTools/pygmt/pull/4074)) * Let the 'verbose' parameter support descriptive arguments ([#4039](https://github.com/GenericMappingTools/pygmt/pull/4039)) -* **BREAKING** Raise GMTValueError exception for invalid values. Previously raise GMTInvalidInput ([#3985](https://github.com/GenericMappingTools/pygmt/pull/3985), [#3998](https://github.com/GenericMappingTools/pygmt/pull/3998)) -* **BREAKING** Raise GMTTypeError exception for invalid types. Previously raise GMTInvalidInput ([#3999](https://github.com/GenericMappingTools/pygmt/pull/3999)) * sequence_join: Correctly join datetime-like values in pd.DataFrame/xr.DataArray objects ([#4097](https://github.com/GenericMappingTools/pygmt/pull/4097)) ### Deprecations +* **BREAKING** Raise GMTValueError exception for invalid values. Previously raise GMTInvalidInput ([#3985](https://github.com/GenericMappingTools/pygmt/pull/3985), [#3998](https://github.com/GenericMappingTools/pygmt/pull/3998)) +* **BREAKING** Raise GMTTypeError exception for invalid types. Previously raise GMTInvalidInput ([#3999](https://github.com/GenericMappingTools/pygmt/pull/3999)) +* **BREAKING** Figure.grdimage: Raise NotImplementedError instead of GMTInvalidInput for -A option ([#4062](https://github.com/GenericMappingTools/pygmt/pull/4062)) * sequence_join: Deprecate parameter 'separator', use 'sep' instead. [Will be removed in v0.19.0] ([#4033](https://github.com/GenericMappingTools/pygmt/pull/4033)) ### Bug Fixes From eff515530c05172439f279277b90f4f9ddbd5e9b Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Sep 2025 12:55:50 +0800 Subject: [PATCH 20/31] Remove one duplicate entry Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- doc/changes.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index a42fd2b6a1d..f74854e44cb 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -47,7 +47,6 @@ ### Maintenance * **BREAKING** Figure.text: Raise GMTTypeError if text is a sequence when position is given ([#4065](https://github.com/GenericMappingTools/pygmt/pull/4065)) -* **BREAKING** Figure.grdimage: Raise NotImplementedError instead of GMTInvalidInput for -A option ([#4062](https://github.com/GenericMappingTools/pygmt/pull/4062)) * Switch from pre-commit to prek ([#4082](https://github.com/GenericMappingTools/pygmt/pull/4082)) * SPEC 0: Bump minimum supported version to pandas 2.2 and Xarray 2023.10 ([#4092](https://github.com/GenericMappingTools/pygmt/pull/4092), [#4091](https://github.com/GenericMappingTools/pygmt/pull/4091)) * Remove the support of non-aliased aliases in use_alias/fmt_docstrings ([#4042](https://github.com/GenericMappingTools/pygmt/pull/4042)) From 2866dbebefa591cf78885413c67e3c20e2b1daaa Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Sep 2025 19:41:59 +0800 Subject: [PATCH 21/31] Update doc/changes.md 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> --- doc/changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index f74854e44cb..8e96bcfd7fa 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -33,7 +33,7 @@ ### Bug Fixes -* x2sys_cross: Fix IndexError to allow empty dataframe outputs ([#4060](https://github.com/GenericMappingTools/pygmt/pull/4060)) +* x2sys_cross: Fix IndexError to allow empty DataFrame outputs ([#4060](https://github.com/GenericMappingTools/pygmt/pull/4060)) * is_nonstr_iter: 0-D array is now recognized as non-iterable ([#4004](https://github.com/GenericMappingTools/pygmt/pull/4004)) * Fix the bug when passing a sequence that contains True to a parameter ([#3982](https://github.com/GenericMappingTools/pygmt/pull/3982)) From 2dd4391a2b477fbd6961414f76de6fc945de26ff Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Sep 2025 23:01:48 +0800 Subject: [PATCH 22/31] Bump to Ghostscript 10.06.0 and update baseline images (#4125) --- .github/workflows/ci_docs.yml | 2 +- .github/workflows/ci_tests.yaml | 2 +- .github/workflows/ci_tests_dev.yaml | 2 +- ci/requirements/docs.yml | 2 +- environment.yml | 2 +- pygmt/tests/baseline/test_contour_interval.png.dvc | 5 ++--- pygmt/tests/baseline/test_contour_matrix.png.dvc | 4 ++-- pygmt/tests/baseline/test_contour_multiple_levels.png.dvc | 5 ++--- pygmt/tests/baseline/test_contour_one_level.png.dvc | 5 ++--- pygmt/tests/baseline/test_contour_vec.png.dvc | 4 ++-- pygmt/tests/baseline/test_text_transparency.png.dvc | 4 ++-- pygmt/tests/baseline/test_text_varying_transparency.png.dvc | 4 ++-- 12 files changed, 19 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index d0b9cbfff0d..7b4e078dd92 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -92,7 +92,7 @@ jobs: create-args: >- python=3.13 gmt=6.5.0 - ghostscript=10.04.0 + ghostscript=10.06.0 numpy pandas xarray diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 0ffc814dbe2..739f4c57e52 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -125,7 +125,7 @@ jobs: create-args: >- python=${{ matrix.python-version }}${{ matrix.optional-packages }} gmt=6.5.0 - ghostscript=10.04.0 + ghostscript=10.06.0 numpy=${{ matrix.numpy-version }} pandas${{ matrix.pandas-version }} xarray${{ matrix.xarray-version }} diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index bd6da4fcaac..c9dc74ae1b5 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -73,7 +73,7 @@ jobs: ninja curl fftw - ghostscript=10.04.0 + ghostscript=10.06.0 glib hdf5 libblas diff --git a/ci/requirements/docs.yml b/ci/requirements/docs.yml index efde2e0f620..a745bd99215 100644 --- a/ci/requirements/docs.yml +++ b/ci/requirements/docs.yml @@ -6,7 +6,7 @@ dependencies: # Required dependencies - python=3.13 - gmt=6.5.0 - - ghostscript=10.04.0 + - ghostscript=10.06.0 - numpy - pandas - xarray diff --git a/environment.yml b/environment.yml index 9194eaeb035..f5539983e08 100644 --- a/environment.yml +++ b/environment.yml @@ -6,7 +6,7 @@ dependencies: - python>=3.11 # Required dependencies - gmt=6.5.0 - - ghostscript=10.04.0 + - ghostscript=10.06.0 - numpy>=1.26 - pandas>=2.2 - xarray>=2023.10 diff --git a/pygmt/tests/baseline/test_contour_interval.png.dvc b/pygmt/tests/baseline/test_contour_interval.png.dvc index 32b57f89111..28a723b56ae 100644 --- a/pygmt/tests/baseline/test_contour_interval.png.dvc +++ b/pygmt/tests/baseline/test_contour_interval.png.dvc @@ -1,6 +1,5 @@ outs: -- md5: 44d70a0b17bc7c7939462184bf06e4da - size: 50998 - isexec: true +- md5: d4f3cfbe632135ba468ce0bf83d5f2bd + size: 50461 hash: md5 path: test_contour_interval.png diff --git a/pygmt/tests/baseline/test_contour_matrix.png.dvc b/pygmt/tests/baseline/test_contour_matrix.png.dvc index f693c0b7c3d..5a34c3399d3 100644 --- a/pygmt/tests/baseline/test_contour_matrix.png.dvc +++ b/pygmt/tests/baseline/test_contour_matrix.png.dvc @@ -1,5 +1,5 @@ outs: -- md5: e147503fcaacb1686211653be7eb7709 - size: 74897 +- md5: bc881c2baecfccb21c801028ef2f7ba0 + size: 75120 path: test_contour_matrix.png hash: md5 diff --git a/pygmt/tests/baseline/test_contour_multiple_levels.png.dvc b/pygmt/tests/baseline/test_contour_multiple_levels.png.dvc index 1e5012d7460..dee42c9b041 100644 --- a/pygmt/tests/baseline/test_contour_multiple_levels.png.dvc +++ b/pygmt/tests/baseline/test_contour_multiple_levels.png.dvc @@ -1,6 +1,5 @@ outs: -- md5: 7bef85a616c46b9f05f4dbed07bd703d - size: 29247 - isexec: true +- md5: 1f8a24696910f3cc433fd8e61caf6aa2 + size: 29184 hash: md5 path: test_contour_multiple_levels.png diff --git a/pygmt/tests/baseline/test_contour_one_level.png.dvc b/pygmt/tests/baseline/test_contour_one_level.png.dvc index 02234514e0c..a22522a3151 100644 --- a/pygmt/tests/baseline/test_contour_one_level.png.dvc +++ b/pygmt/tests/baseline/test_contour_one_level.png.dvc @@ -1,6 +1,5 @@ outs: -- md5: 8c1ed221788e3af76279a7765640ea43 - size: 28882 - isexec: true +- md5: 04234f57de3bbe994798947cac6c479c + size: 28963 hash: md5 path: test_contour_one_level.png diff --git a/pygmt/tests/baseline/test_contour_vec.png.dvc b/pygmt/tests/baseline/test_contour_vec.png.dvc index 80d7509e648..8a048de2d48 100644 --- a/pygmt/tests/baseline/test_contour_vec.png.dvc +++ b/pygmt/tests/baseline/test_contour_vec.png.dvc @@ -1,5 +1,5 @@ outs: -- md5: 017a19fea9fda195fae9deeb329f761a - size: 82368 +- md5: 3e4819ddedc2b6452186844a1a927cd0 + size: 82042 path: test_contour_vec.png hash: md5 diff --git a/pygmt/tests/baseline/test_text_transparency.png.dvc b/pygmt/tests/baseline/test_text_transparency.png.dvc index a1fcb1005ee..afe62a0983b 100644 --- a/pygmt/tests/baseline/test_text_transparency.png.dvc +++ b/pygmt/tests/baseline/test_text_transparency.png.dvc @@ -1,5 +1,5 @@ outs: -- md5: 3e44dbdab2c386fd361481438fa10d58 - size: 18174 +- md5: e1885c2a16e268ac5c06e2a959668c88 + size: 18149 path: test_text_transparency.png hash: md5 diff --git a/pygmt/tests/baseline/test_text_varying_transparency.png.dvc b/pygmt/tests/baseline/test_text_varying_transparency.png.dvc index b49eb4fb3a9..f64ab023588 100644 --- a/pygmt/tests/baseline/test_text_varying_transparency.png.dvc +++ b/pygmt/tests/baseline/test_text_varying_transparency.png.dvc @@ -1,5 +1,5 @@ outs: -- md5: f16009816a1a007a93aef6cfc21f5dee - size: 18382 +- md5: 39e602f34ad20541668b712351b29375 + size: 18351 path: test_text_varying_transparency.png hash: md5 From 25becb28ba41d05953d878faac261da17e65d2df Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 30 Sep 2025 00:17:50 +0800 Subject: [PATCH 23/31] AliasSystem: Migrate the region parameter to the new alias system (#4099) --- pygmt/alias.py | 6 ++++-- pygmt/src/basemap.py | 7 +++++-- pygmt/src/binstats.py | 7 +++++-- pygmt/src/blockm.py | 19 +++++++++++++------ pygmt/src/coast.py | 7 +++++-- pygmt/src/colorbar.py | 7 +++++-- pygmt/src/contour.py | 9 ++++++--- pygmt/src/dimfilter.py | 14 ++++++-------- pygmt/src/grd2cpt.py | 7 +++++-- pygmt/src/grd2xyz.py | 7 +++++-- pygmt/src/grdclip.py | 18 ++++++++---------- pygmt/src/grdcontour.py | 7 +++++-- pygmt/src/grdcut.py | 14 +++++--------- pygmt/src/grdfill.py | 17 +++++++---------- pygmt/src/grdfilter.py | 7 +++++-- pygmt/src/grdgradient.py | 8 +++++--- pygmt/src/grdhisteq.py | 26 +++++++++----------------- pygmt/src/grdimage.py | 7 +++++-- pygmt/src/grdinfo.py | 7 +++++-- pygmt/src/grdlandmask.py | 14 ++++++-------- pygmt/src/grdproject.py | 7 +++++-- pygmt/src/grdsample.py | 7 +++++-- pygmt/src/grdtrack.py | 7 +++++-- pygmt/src/grdview.py | 7 +++++-- pygmt/src/grdvolume.py | 8 ++++++-- pygmt/src/histogram.py | 7 +++++-- pygmt/src/image.py | 8 ++++++-- pygmt/src/inset.py | 8 ++++++-- pygmt/src/legend.py | 8 ++++++-- pygmt/src/logo.py | 8 ++++++-- pygmt/src/meca.py | 6 ++++-- pygmt/src/nearneighbor.py | 7 +++++-- pygmt/src/plot.py | 6 ++++-- pygmt/src/plot3d.py | 6 ++++-- pygmt/src/rose.py | 7 +++++-- pygmt/src/select.py | 7 +++++-- pygmt/src/solar.py | 8 ++++++-- pygmt/src/sph2grd.py | 7 +++++-- pygmt/src/sphdistance.py | 9 ++++++--- pygmt/src/sphinterpolate.py | 8 ++++++-- pygmt/src/subplot.py | 7 +++++-- pygmt/src/surface.py | 7 +++++-- pygmt/src/ternary.py | 7 +++++-- pygmt/src/text.py | 6 ++++-- pygmt/src/tilemap.py | 15 ++++++++------- pygmt/src/triangulate.py | 13 +++++++++---- pygmt/src/velo.py | 7 +++++-- pygmt/src/wiggle.py | 7 +++++-- pygmt/src/x2sys_cross.py | 7 ++++--- pygmt/src/x2sys_init.py | 7 +++++-- pygmt/src/xyz2grd.py | 9 ++++++--- 51 files changed, 285 insertions(+), 168 deletions(-) diff --git a/pygmt/alias.py b/pygmt/alias.py index 472653d09a5..35f64f8b610 100644 --- a/pygmt/alias.py +++ b/pygmt/alias.py @@ -300,6 +300,10 @@ def add_common(self, **kwargs): """ for key, value in kwargs.items(): match key: + case "J": + alias = Alias(value, name="projection") + case "R": + alias = Alias(value, name="region", sep="/", size=(4, 6)) case "V": alias = Alias( value, @@ -314,8 +318,6 @@ def add_common(self, **kwargs): "debug": "d", }, ) - case "J": - alias = Alias(value, name="projection") case "c": alias = Alias(value, name="panel", sep=",", size=2) case "t": diff --git a/pygmt/src/basemap.py b/pygmt/src/basemap.py index b7753893319..6ec874fdbe4 100644 --- a/pygmt/src/basemap.py +++ b/pygmt/src/basemap.py @@ -2,6 +2,7 @@ basemap - Plot base maps and frames. """ +from collections.abc import Sequence from typing import Literal from pygmt.alias import AliasSystem @@ -11,7 +12,6 @@ @fmt_docstring @use_alias( - R="region", Jz="zscale", JZ="zsize", B="frame", @@ -22,10 +22,11 @@ f="coltypes", p="perspective", ) -@kwargs_to_strings(R="sequence", p="sequence") +@kwargs_to_strings(p="sequence") def basemap( self, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -47,6 +48,7 @@ def basemap( {aliases} - J = projection + - R = region - V = verbose - c = panel - t = transparency @@ -97,6 +99,7 @@ def basemap( aliasdict = AliasSystem().add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/binstats.py b/pygmt/src/binstats.py index f20ceff111b..256b71eea8e 100644 --- a/pygmt/src/binstats.py +++ b/pygmt/src/binstats.py @@ -2,6 +2,7 @@ binstats - Bin spatial data and determine statistics per bin. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -16,7 +17,6 @@ E="empty", I="spacing", N="normalize", - R="region", S="search_radius", W="weight", a="aspatial", @@ -25,7 +25,7 @@ i="incols", r="registration", ) -@kwargs_to_strings(I="sequence", R="sequence", i="sequence_comma") +@kwargs_to_strings(I="sequence", i="sequence_comma") def binstats( data: PathLike | TableLike, outgrid: PathLike | None = None, @@ -48,6 +48,7 @@ def binstats( "sum", ] = "number", quantile_value: float = 50, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -67,6 +68,7 @@ def binstats( {aliases} - C = statistic + - R = region - V = verbose Parameters @@ -154,6 +156,7 @@ def binstats( }, ), ).add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/blockm.py b/pygmt/src/blockm.py index 6f2920f7591..9aa593df3e1 100644 --- a/pygmt/src/blockm.py +++ b/pygmt/src/blockm.py @@ -2,6 +2,7 @@ blockm - Block average (x, y, z) data tables by mean, median, or mode estimation. """ +from collections.abc import Sequence from typing import Literal import numpy as np @@ -73,7 +74,6 @@ def _blockm( @fmt_docstring @use_alias( I="spacing", - R="region", S="summary", a="aspatial", b="binary", @@ -86,7 +86,7 @@ def _blockm( r="registration", w="wrap", ) -@kwargs_to_strings(I="sequence", R="sequence", i="sequence_comma", o="sequence_comma") +@kwargs_to_strings(I="sequence", i="sequence_comma", o="sequence_comma") def blockmean( data: PathLike | TableLike | None = None, x=None, @@ -94,6 +94,7 @@ def blockmean( z=None, output_type: Literal["pandas", "numpy", "file"] = "pandas", outfile: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -113,6 +114,7 @@ def blockmean( Full GMT docs at :gmt-docs:`blockmean.html`. {aliases} + - R = region - V = verbose Parameters @@ -166,6 +168,7 @@ def blockmean( >>> data_bmean = pygmt.blockmean(data=data, region=[245, 255, 20, 30], spacing="5m") """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) @@ -185,7 +188,6 @@ def blockmean( @fmt_docstring @use_alias( I="spacing", - R="region", a="aspatial", b="binary", d="nodata", @@ -197,7 +199,7 @@ def blockmean( r="registration", w="wrap", ) -@kwargs_to_strings(I="sequence", R="sequence", i="sequence_comma", o="sequence_comma") +@kwargs_to_strings(I="sequence", i="sequence_comma", o="sequence_comma") def blockmedian( data: PathLike | TableLike | None = None, x=None, @@ -205,6 +207,7 @@ def blockmedian( z=None, output_type: Literal["pandas", "numpy", "file"] = "pandas", outfile: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -224,6 +227,7 @@ def blockmedian( Full GMT docs at :gmt-docs:`blockmedian.html`. {aliases} + - R = region - V = verbose Parameters @@ -271,6 +275,7 @@ def blockmedian( ... ) """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) @@ -290,7 +295,6 @@ def blockmedian( @fmt_docstring @use_alias( I="spacing", - R="region", a="aspatial", b="binary", d="nodata", @@ -302,7 +306,7 @@ def blockmedian( r="registration", w="wrap", ) -@kwargs_to_strings(I="sequence", R="sequence", i="sequence_comma", o="sequence_comma") +@kwargs_to_strings(I="sequence", i="sequence_comma", o="sequence_comma") def blockmode( data: PathLike | TableLike | None = None, x=None, @@ -310,6 +314,7 @@ def blockmode( z=None, output_type: Literal["pandas", "numpy", "file"] = "pandas", outfile: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -329,6 +334,7 @@ def blockmode( Full GMT docs at :gmt-docs:`blockmode.html`. {aliases} + - R = region - V = verbose Parameters @@ -374,6 +380,7 @@ def blockmode( >>> data_bmode = pygmt.blockmode(data=data, region=[245, 255, 20, 30], spacing="5m") """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/coast.py b/pygmt/src/coast.py index 5a82482a8aa..730e3dab404 100644 --- a/pygmt/src/coast.py +++ b/pygmt/src/coast.py @@ -2,6 +2,7 @@ coast - Plot continents, countries, shorelines, rivers, and borders. """ +from collections.abc import Sequence from typing import Literal from pygmt.alias import Alias, AliasSystem @@ -29,12 +30,11 @@ I="rivers", L="map_scale", N="borders", - R="region", S="water", W="shorelines", p="perspective", ) -@kwargs_to_strings(R="sequence", p="sequence") +@kwargs_to_strings(p="sequence") def coast( self, projection: str | None = None, @@ -42,6 +42,7 @@ def coast( "auto", "full", "high", "intermediate", "low", "crude", None ] = None, box: Box | bool = False, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -71,6 +72,7 @@ def coast( - D = resolution - F = box - J = projection + - R = region - V = verbose - c = panel - t = transparency @@ -222,6 +224,7 @@ def coast( F=Alias(box, name="box"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index 857f0712e8e..00271c65878 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -2,6 +2,7 @@ colorbar - Plot gray scale or color scale bar. """ +from collections.abc import Sequence from typing import Literal from pygmt.alias import Alias, AliasSystem @@ -21,16 +22,16 @@ I="shading", L="equalsize", Q="log", - R="region", W="scale", Z="zfile", p="perspective", ) -@kwargs_to_strings(R="sequence", G="sequence", I="sequence", p="sequence") +@kwargs_to_strings(G="sequence", I="sequence", p="sequence") def colorbar( self, projection: str | None = None, box: Box | bool = False, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -53,6 +54,7 @@ def colorbar( {aliases} - F = box - J = projection + - R = region - V = verbose - c = panel - t = transparency @@ -151,6 +153,7 @@ def colorbar( F=Alias(box, name="box"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/contour.py b/pygmt/src/contour.py index fc08179d79e..f85434543f6 100644 --- a/pygmt/src/contour.py +++ b/pygmt/src/contour.py @@ -2,6 +2,7 @@ contour - Contour table data by direct triangulation. """ +from collections.abc import Sequence from typing import Literal from pygmt._typing import PathLike, TableLike @@ -23,7 +24,6 @@ C="levels", G="label_placement", L="triangular_mesh_pen", - R="region", S="skip", W="pen", b="binary", @@ -35,8 +35,8 @@ l="label", p="perspective", ) -@kwargs_to_strings(R="sequence", i="sequence_comma", p="sequence") -def contour( +@kwargs_to_strings(i="sequence_comma", p="sequence") +def contour( # noqa: PLR0913 self, data: PathLike | TableLike | None = None, x=None, @@ -44,6 +44,7 @@ def contour( z=None, no_clip: bool = False, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -63,6 +64,7 @@ def contour( {aliases} - J = projection - N = no_clip + - R = region - V = verbose - c = panel - t = transparency @@ -164,6 +166,7 @@ def contour( N=Alias(no_clip, name="no_clip"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/dimfilter.py b/pygmt/src/dimfilter.py index a95a5d6e7bc..f70b6ea12a6 100644 --- a/pygmt/src/dimfilter.py +++ b/pygmt/src/dimfilter.py @@ -2,6 +2,7 @@ dimfilter - Directional filtering of grids in the space domain. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -15,17 +16,12 @@ @fmt_docstring -@use_alias( - D="distance", - F="filter", - I="spacing", - N="sectors", - R="region", -) -@kwargs_to_strings(I="sequence", R="sequence") +@use_alias(D="distance", F="filter", I="spacing", N="sectors") +@kwargs_to_strings(I="sequence") def dimfilter( grid: PathLike | xr.DataArray, outgrid: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -52,6 +48,7 @@ def dimfilter( Full GMT docs at :gmt-docs:`dimfilter.html`. {aliases} + - R = region - V = verbose Parameters @@ -152,6 +149,7 @@ def dimfilter( raise GMTInvalidInput(msg) aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grd2cpt.py b/pygmt/src/grd2cpt.py index c85dd7f9a4e..9535ba874ca 100644 --- a/pygmt/src/grd2cpt.py +++ b/pygmt/src/grd2cpt.py @@ -2,6 +2,7 @@ grd2cpt - Make linear or histogram-equalized color palette table from grid. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -24,12 +25,11 @@ H="output", I="reverse", L="limit", - R="region", T="series", W="categorical", Ww="cyclic", ) -@kwargs_to_strings(L="sequence", R="sequence", T="sequence") +@kwargs_to_strings(L="sequence", T="sequence") def grd2cpt( grid: PathLike | xr.DataArray, truncate: tuple[float, float] | None = None, @@ -37,6 +37,7 @@ def grd2cpt( no_bg: bool = False, log: bool = False, continuous: bool = False, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -89,6 +90,7 @@ def grd2cpt( - M = overrule_bg - N = no_bg - Q = log + - R = region - Z = continuous - V = verbose @@ -210,6 +212,7 @@ def grd2cpt( Q=Alias(log, name="log"), Z=Alias(continuous, name="continuous"), ).add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grd2xyz.py b/pygmt/src/grd2xyz.py index 67cad34e2b6..662fe228c81 100644 --- a/pygmt/src/grd2xyz.py +++ b/pygmt/src/grd2xyz.py @@ -2,6 +2,7 @@ grd2xyz - Convert grid to data table. """ +from collections.abc import Sequence from typing import Literal import numpy as np @@ -25,7 +26,6 @@ @fmt_docstring @use_alias( C="cstyle", - R="region", W="weight", Z="convention", b="binary", @@ -35,11 +35,12 @@ o="outcols", s="skiprows", ) -@kwargs_to_strings(R="sequence", o="sequence_comma") +@kwargs_to_strings(o="sequence_comma") def grd2xyz( grid: PathLike | xr.DataArray, output_type: Literal["pandas", "numpy", "file"] = "pandas", outfile: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -53,6 +54,7 @@ def grd2xyz( Full GMT docs at :gmt-docs:`grd2xyz.html`. {aliases} + - R = region - V = verbose Parameters @@ -161,6 +163,7 @@ def grd2xyz( column_names = [str(grid.dims[1]), str(grid.dims[0]), str(grid.name)] aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grdclip.py b/pygmt/src/grdclip.py index e79f1560daa..021550036d2 100644 --- a/pygmt/src/grdclip.py +++ b/pygmt/src/grdclip.py @@ -10,13 +10,7 @@ from pygmt.alias import Alias, AliasSystem from pygmt.clib import Session from pygmt.exceptions import GMTInvalidInput -from pygmt.helpers import ( - build_arg_list, - deprecate_parameter, - fmt_docstring, - kwargs_to_strings, - use_alias, -) +from pygmt.helpers import build_arg_list, deprecate_parameter, fmt_docstring __doctest_skip__ = ["grdclip"] @@ -24,8 +18,6 @@ # TODO(PyGMT>=0.19.0): Remove the deprecated "new" parameter. @fmt_docstring @deprecate_parameter("new", "replace", "v0.15.0", remove_version="v0.19.0") -@use_alias(R="region") -@kwargs_to_strings(R="sequence") def grdclip( grid: PathLike | xr.DataArray, outgrid: PathLike | None = None, @@ -33,6 +25,7 @@ def grdclip( below: Sequence[float] | None = None, between: Sequence[float] | Sequence[Sequence[float]] | None = None, replace: Sequence[float] | Sequence[Sequence[float]] | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -54,7 +47,11 @@ def grdclip( Full GMT docs at :gmt-docs:`grdclip.html`. - {aliases} + **Aliases:** + .. hlist:: + :columns: 3 + + - R = region - Sa = above - Sb = below - Si = between @@ -125,6 +122,7 @@ def grdclip( Si=Alias(between, name="between", sep="/", size=3, ndim=2), Sr=Alias(replace, name="replace", sep="/", size=2, ndim=2), ).add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grdcontour.py b/pygmt/src/grdcontour.py index d363bf15d27..000eefa95b6 100644 --- a/pygmt/src/grdcontour.py +++ b/pygmt/src/grdcontour.py @@ -2,6 +2,7 @@ grdcontour - Make contour map using a grid. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -29,18 +30,18 @@ G="label_placement", L="limit", Q="cut", - R="region", S="resample", W="pen", l="label", f="coltypes", p="perspective", ) -@kwargs_to_strings(R="sequence", L="sequence", p="sequence") +@kwargs_to_strings(L="sequence", p="sequence") def grdcontour( self, grid: PathLike | xr.DataArray, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -56,6 +57,7 @@ def grdcontour( {aliases} - J = projection + - R = region - V = verbose - c = panel - t = transparency @@ -165,6 +167,7 @@ def grdcontour( aliasdict = AliasSystem().add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/grdcut.py b/pygmt/src/grdcut.py index 4ae0ff0ff01..cf198d9dc74 100644 --- a/pygmt/src/grdcut.py +++ b/pygmt/src/grdcut.py @@ -2,6 +2,7 @@ grdcut - Extract subregion from a grid or image or a slice from a cube. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -13,7 +14,6 @@ build_arg_list, data_kind, fmt_docstring, - kwargs_to_strings, use_alias, ) @@ -21,19 +21,13 @@ @fmt_docstring -@use_alias( - R="region", - N="extend", - S="circ_subregion", - Z="z_subregion", - f="coltypes", -) -@kwargs_to_strings(R="sequence") +@use_alias(N="extend", S="circ_subregion", Z="z_subregion", f="coltypes") def grdcut( grid: PathLike | xr.DataArray, kind: Literal["grid", "image"] = "grid", outgrid: PathLike | None = None, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -54,6 +48,7 @@ def grdcut( {aliases} - J = projection + - R = region - V = verbose Parameters @@ -130,6 +125,7 @@ def grdcut( aliasdict = AliasSystem().add_common( J=projection, + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index 97c27855720..11dd368caf5 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -3,6 +3,7 @@ """ import warnings +from collections.abc import Sequence from typing import Literal import numpy as np @@ -11,13 +12,7 @@ from pygmt.alias import Alias, AliasSystem from pygmt.clib import Session from pygmt.exceptions import GMTInvalidInput -from pygmt.helpers import ( - build_arg_list, - deprecate_parameter, - fmt_docstring, - kwargs_to_strings, - use_alias, -) +from pygmt.helpers import build_arg_list, deprecate_parameter, fmt_docstring, use_alias __doctest_skip__ = ["grdfill"] @@ -77,9 +72,8 @@ def _validate_params( # TODO(PyGMT>=0.19.0): Remove the deprecated 'no_data' parameter. # TODO(PyGMT>=0.19.0): Remove the deprecated 'mode' parameter. @deprecate_parameter("no_data", "hole", "v0.15.0", remove_version="v0.19.0") -@use_alias(R="region", f="coltypes") -@kwargs_to_strings(R="sequence") -def grdfill( +@use_alias(f="coltypes") +def grdfill( # noqa: PLR0913 grid: PathLike | xr.DataArray, outgrid: PathLike | None = None, constantfill: float | None = None, @@ -89,6 +83,7 @@ def grdfill( inquire: bool = False, hole: float | None = None, mode: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -111,6 +106,7 @@ def grdfill( - As = splinefill - L = inquire - N = hole + - R = region - V = verbose Parameters @@ -191,6 +187,7 @@ def grdfill( L=Alias(inquire, name="inquire"), N=Alias(hole, name="hole"), ).add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grdfilter.py b/pygmt/src/grdfilter.py index 060f07d593a..4347df7d995 100644 --- a/pygmt/src/grdfilter.py +++ b/pygmt/src/grdfilter.py @@ -2,6 +2,7 @@ grdfilter - Filter a grid in the space (or time) domain. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -17,15 +18,15 @@ F="filter", I="spacing", N="nans", - R="region", T="toggle", f="coltypes", r="registration", ) -@kwargs_to_strings(I="sequence", R="sequence") +@kwargs_to_strings(I="sequence") def grdfilter( grid: PathLike | xr.DataArray, outgrid: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, cores: int | bool = False, @@ -47,6 +48,7 @@ def grdfilter( Full GMT docs at :gmt-docs:`grdfilter.html`. {aliases} + - R = region - V = verbose - x = cores @@ -137,6 +139,7 @@ def grdfilter( >>> smooth_field = pygmt.grdfilter(grid=grid, filter="g600", distance="4") """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, x=cores, ) diff --git a/pygmt/src/grdgradient.py b/pygmt/src/grdgradient.py index f0862ee276e..c10784a0391 100644 --- a/pygmt/src/grdgradient.py +++ b/pygmt/src/grdgradient.py @@ -2,6 +2,7 @@ grdgradient - Compute directional gradients from a grid. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -27,15 +28,15 @@ E="radiance", N="normalize", Q="tiles", - R="region", S="slope_file", f="coltypes", n="interpolation", ) -@kwargs_to_strings(A="sequence", E="sequence", R="sequence") +@kwargs_to_strings(A="sequence", E="sequence") def grdgradient( grid: PathLike | xr.DataArray, outgrid: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -49,6 +50,7 @@ def grdgradient( Full GMT docs at :gmt-docs:`grdgradient.html`. {aliases} + - R = region - V = verbose Parameters @@ -156,7 +158,6 @@ def grdgradient( - ``None`` if ``outgrid`` is set (grid output will be stored in the file set by ``outgrid``) - Example ------- >>> import pygmt @@ -179,6 +180,7 @@ def grdgradient( raise GMTInvalidInput(msg) aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grdhisteq.py b/pygmt/src/grdhisteq.py index 77b86a15df5..a877ab69198 100644 --- a/pygmt/src/grdhisteq.py +++ b/pygmt/src/grdhisteq.py @@ -2,6 +2,7 @@ grdhisteq - Perform histogram equalization for a grid. """ +from collections.abc import Sequence from typing import Literal import numpy as np @@ -14,7 +15,6 @@ from pygmt.helpers import ( build_arg_list, fmt_docstring, - kwargs_to_strings, use_alias, validate_output_table_type, ) @@ -55,17 +55,11 @@ class grdhisteq: # noqa: N801 @staticmethod @fmt_docstring - @use_alias( - C="divisions", - R="region", - N="gaussian", - Q="quadratic", - h="header", - ) - @kwargs_to_strings(R="sequence") + @use_alias(C="divisions", N="gaussian", Q="quadratic", h="header") def equalize_grid( grid: PathLike | xr.DataArray, outgrid: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal[ "quiet", "error", "warning", "timing", "info", "compat", "debug" ] @@ -84,6 +78,7 @@ def equalize_grid( Full GMT docs at :gmt-docs:`grdhisteq.html`. {aliases} + - R = region - V = verbose Parameters @@ -131,6 +126,7 @@ def equalize_grid( grids to account for node area varying with latitude. """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) @@ -148,18 +144,12 @@ def equalize_grid( @staticmethod @fmt_docstring - @use_alias( - C="divisions", - R="region", - N="gaussian", - Q="quadratic", - h="header", - ) - @kwargs_to_strings(R="sequence") + @use_alias(C="divisions", N="gaussian", Q="quadratic", h="header") def compute_bins( grid: PathLike | xr.DataArray, output_type: Literal["pandas", "numpy", "file"] = "pandas", outfile: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal[ "quiet", "error", "warning", "timing", "info", "compat", "debug" ] @@ -186,6 +176,7 @@ def compute_bins( Full GMT docs at :gmt-docs:`grdhisteq.html`. {aliases} + - R = region - V = verbose Parameters @@ -247,6 +238,7 @@ def compute_bins( raise GMTInvalidInput(msg) aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grdimage.py b/pygmt/src/grdimage.py index d27d5472252..ca64d550373 100644 --- a/pygmt/src/grdimage.py +++ b/pygmt/src/grdimage.py @@ -2,6 +2,7 @@ grdimage - Project and plot grids or images. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -22,18 +23,18 @@ G="bitcolor", I="shading", Q="nan_transparent", - R="region", n="interpolation", f="coltypes", p="perspective", ) -@kwargs_to_strings(R="sequence", p="sequence") +@kwargs_to_strings(p="sequence") def grdimage( self, grid: PathLike | xr.DataArray, monochrome: bool = False, no_clip: bool = False, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -78,6 +79,7 @@ def grdimage( - J = projection - M = monochrome - N = no_clip + - R = region - V = verbose - c = panel - t = transparency @@ -180,6 +182,7 @@ def grdimage( N=Alias(no_clip, name="no_clip"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/grdinfo.py b/pygmt/src/grdinfo.py index ec09317023e..cd7195f58d2 100644 --- a/pygmt/src/grdinfo.py +++ b/pygmt/src/grdinfo.py @@ -2,6 +2,7 @@ grdinfo - Extract information from 2-D grids or 3-D cubes. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -25,13 +26,13 @@ I="spacing", L="force_scan", M="minmax_pos", - R="region", T="nearest_multiple", f="coltypes", ) -@kwargs_to_strings(D="sequence", I="sequence", R="sequence") +@kwargs_to_strings(D="sequence", I="sequence") def grdinfo( grid: PathLike | xr.DataArray, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -44,6 +45,7 @@ def grdinfo( Full GMT docs at :gmt-docs:`grdinfo.html`. {aliases} + - R = region - V = verbose Parameters @@ -121,6 +123,7 @@ def grdinfo( A string with information about the grid. """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grdlandmask.py b/pygmt/src/grdlandmask.py index 6f8f0111b8e..30a3738f537 100644 --- a/pygmt/src/grdlandmask.py +++ b/pygmt/src/grdlandmask.py @@ -16,13 +16,8 @@ @fmt_docstring -@use_alias( - A="area_thresh", - I="spacing", - R="region", - r="registration", -) -@kwargs_to_strings(I="sequence", R="sequence") +@use_alias(A="area_thresh", I="spacing", r="registration") +@kwargs_to_strings(I="sequence") def grdlandmask( outgrid: PathLike | None = None, maskvalues: Sequence[float] | None = None, @@ -30,6 +25,7 @@ def grdlandmask( resolution: Literal[ "auto", "full", "high", "intermediate", "low", "crude", None ] = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, cores: int | bool = False, @@ -50,6 +46,7 @@ def grdlandmask( - D = resolution - E = bordervalues - N = maskvalues + - R = region - V = verbose - x = cores @@ -111,7 +108,7 @@ def grdlandmask( >>> # latitude range of 30° N to 35° N, and a grid spacing of 1 arc-degree >>> landmask = pygmt.grdlandmask(spacing=1, region=[125, 130, 30, 35]) """ - if kwargs.get("I") is None or kwargs.get("R") is None: + if kwargs.get("I") is None or kwargs.get("R", region) is None: msg = "Both 'region' and 'spacing' must be specified." raise GMTInvalidInput(msg) @@ -131,6 +128,7 @@ def grdlandmask( N=Alias(maskvalues, name="maskvalues", sep="/", size=(2, 5)), E=Alias(bordervalues, name="bordervalues", sep="/", size=4), ).add_common( + R=region, V=verbose, x=cores, ) diff --git a/pygmt/src/grdproject.py b/pygmt/src/grdproject.py index afd8e4e975a..97910ab7061 100644 --- a/pygmt/src/grdproject.py +++ b/pygmt/src/grdproject.py @@ -2,6 +2,7 @@ grdproject - Forward and inverse map transformation of grids. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -22,15 +23,15 @@ F="scaling", I="inverse", M="unit", - R="region", n="interpolation", r="registration", ) -@kwargs_to_strings(C="sequence", D="sequence", R="sequence") +@kwargs_to_strings(C="sequence", D="sequence") def grdproject( grid: PathLike | xr.DataArray, outgrid: PathLike | None = None, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -57,6 +58,7 @@ def grdproject( {aliases} - J = projection + - R = region - V = verbose Parameters @@ -119,6 +121,7 @@ def grdproject( aliasdict = AliasSystem().add_common( J=projection, + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grdsample.py b/pygmt/src/grdsample.py index 1af517380c2..0ab0b46e354 100644 --- a/pygmt/src/grdsample.py +++ b/pygmt/src/grdsample.py @@ -2,6 +2,7 @@ grdsample - Resample a grid onto a new lattice. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -16,16 +17,16 @@ @fmt_docstring @use_alias( I="spacing", - R="region", T="translate", f="coltypes", n="interpolation", r="registration", ) -@kwargs_to_strings(I="sequence", R="sequence") +@kwargs_to_strings(I="sequence") def grdsample( grid: PathLike | xr.DataArray, outgrid: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, cores: int | bool = False, @@ -50,6 +51,7 @@ def grdsample( Full GMT docs at :gmt-docs:`grdsample.html`. {aliases} + - R = region - V = verbose - x = cores @@ -92,6 +94,7 @@ def grdsample( >>> new_grid = pygmt.grdsample(grid=grid, translate=True, spacing=[0.5, 0.5]) """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, x=cores, ) diff --git a/pygmt/src/grdtrack.py b/pygmt/src/grdtrack.py index 973125ebf48..fd0631de1fc 100644 --- a/pygmt/src/grdtrack.py +++ b/pygmt/src/grdtrack.py @@ -2,6 +2,7 @@ grdtrack - Sample one or more grids at specified locations. """ +from collections.abc import Sequence from typing import Literal import numpy as np @@ -29,7 +30,6 @@ D="dfile", E="profile", F="critical", - R="region", N="no_skip", S="stack", T="radius", @@ -48,13 +48,14 @@ s="skiprows", w="wrap", ) -@kwargs_to_strings(R="sequence", S="sequence", i="sequence_comma", o="sequence_comma") +@kwargs_to_strings(S="sequence", i="sequence_comma", o="sequence_comma") def grdtrack( grid: PathLike | xr.DataArray, points: PathLike | TableLike | None = None, output_type: Literal["pandas", "numpy", "file"] = "pandas", outfile: PathLike | None = None, newcolname=None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -79,6 +80,7 @@ def grdtrack( Full GMT docs at :gmt-docs:`grdtrack.html`. {aliases} + - R = region - V = verbose Parameters @@ -313,6 +315,7 @@ def grdtrack( column_names = [*points.columns.to_list(), newcolname] aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/grdview.py b/pygmt/src/grdview.py index 52268299e52..8835cca7cf2 100644 --- a/pygmt/src/grdview.py +++ b/pygmt/src/grdview.py @@ -2,6 +2,7 @@ grdview - Create 3-D perspective image or surface mesh from a grid. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -15,7 +16,6 @@ @fmt_docstring @use_alias( - R="region", Jz="zscale", JZ="zsize", B="frame", @@ -31,11 +31,12 @@ n="interpolation", p="perspective", ) -@kwargs_to_strings(R="sequence", p="sequence") +@kwargs_to_strings(p="sequence") def grdview( self, grid: PathLike | xr.DataArray, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -55,6 +56,7 @@ def grdview( {aliases} - J = projection + - R = region - V = verbose - c = panel - t = transparency @@ -156,6 +158,7 @@ def grdview( aliasdict = AliasSystem().add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/grdvolume.py b/pygmt/src/grdvolume.py index 986b4d4c7a3..1f97f12994d 100644 --- a/pygmt/src/grdvolume.py +++ b/pygmt/src/grdvolume.py @@ -2,6 +2,7 @@ grdvolume - Calculate grid volume and area constrained by a contour. """ +from collections.abc import Sequence from typing import Literal import numpy as np @@ -22,12 +23,13 @@ @fmt_docstring -@use_alias(C="contour", R="region", S="unit") -@kwargs_to_strings(C="sequence", R="sequence") +@use_alias(C="contour", S="unit") +@kwargs_to_strings(C="sequence") def grdvolume( grid: PathLike | xr.DataArray, output_type: Literal["pandas", "numpy", "file"] = "pandas", outfile: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -44,6 +46,7 @@ def grdvolume( Full GMT docs at :gmt-docs:`grdvolume.html`. {aliases} + - R = region - V = verbose Parameters @@ -104,6 +107,7 @@ def grdvolume( output_type = validate_output_table_type(output_type, outfile=outfile) aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 357d1b55391..5fa11cacc21 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -2,6 +2,7 @@ Histogram - Calculate and plot histograms. """ +from collections.abc import Sequence from typing import Literal from pygmt._typing import PathLike, TableLike @@ -22,7 +23,6 @@ L="extreme", N="distribution", Q="cumulative", - R="region", S="stairs", T="series", W="pen", @@ -36,11 +36,12 @@ p="perspective", w="wrap", ) -@kwargs_to_strings(R="sequence", T="sequence", i="sequence_comma", p="sequence") +@kwargs_to_strings(T="sequence", i="sequence_comma", p="sequence") def histogram( self, data: PathLike | TableLike, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -54,6 +55,7 @@ def histogram( {aliases} - J = projection + - R = region - V = verbose - c = panel - t = transparency @@ -149,6 +151,7 @@ def histogram( aliasdict = AliasSystem().add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/image.py b/pygmt/src/image.py index 1ef00b887c7..78a19ad9edd 100644 --- a/pygmt/src/image.py +++ b/pygmt/src/image.py @@ -2,6 +2,7 @@ image - Plot raster or EPS images. """ +from collections.abc import Sequence from typing import Literal from pygmt._typing import PathLike @@ -12,12 +13,13 @@ @fmt_docstring -@use_alias(D="position", G="bitcolor", R="region", p="perspective") -@kwargs_to_strings(R="sequence", p="sequence") +@use_alias(D="position", G="bitcolor", p="perspective") +@kwargs_to_strings(p="sequence") def image( self, imagefile: PathLike, projection: str | None = None, + region: Sequence[float | str] | str | None = None, box: Box | bool = False, monochrome: bool = False, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] @@ -48,6 +50,7 @@ def image( - F = box - J = projection - M = monochrome + - R = region - V = verbose - c = panel - t = transparency @@ -93,6 +96,7 @@ def image( M=Alias(monochrome, name="monochrome"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/inset.py b/pygmt/src/inset.py index 617bb36a274..30b5d316e0b 100644 --- a/pygmt/src/inset.py +++ b/pygmt/src/inset.py @@ -3,6 +3,7 @@ """ import contextlib +from collections.abc import Sequence from typing import Literal from pygmt.alias import Alias, AliasSystem @@ -15,11 +16,12 @@ @fmt_docstring @contextlib.contextmanager -@use_alias(D="position", M="margin", R="region") -@kwargs_to_strings(D="sequence", M="sequence", R="sequence") +@use_alias(D="position", M="margin") +@kwargs_to_strings(D="sequence", M="sequence") def inset( self, projection: str | None = None, + region: Sequence[float | str] | str | None = None, box: Box | bool = False, no_clip: bool = False, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] @@ -39,6 +41,7 @@ def inset( - F = box - J = projection - N = no_clip + - R = region - V = verbose Parameters @@ -135,6 +138,7 @@ def inset( N=Alias(no_clip, name="no_clip"), ).add_common( J=projection, + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/legend.py b/pygmt/src/legend.py index 8e299bf401c..ad3022a9711 100644 --- a/pygmt/src/legend.py +++ b/pygmt/src/legend.py @@ -3,6 +3,7 @@ """ import io +from collections.abc import Sequence from typing import Literal from pygmt._typing import PathLike @@ -21,12 +22,13 @@ @fmt_docstring -@use_alias(R="region", D="position", p="perspective") -@kwargs_to_strings(R="sequence", p="sequence") +@use_alias(D="position", p="perspective") +@kwargs_to_strings(p="sequence") def legend( self, spec: PathLike | io.StringIO | None = None, projection: str | None = None, + region: Sequence[float | str] | str | None = None, position="JTR+jTR+o0.2c", box: Box | bool = False, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] @@ -49,6 +51,7 @@ def legend( {aliases} - F = box - J = projection + - R = region - V = verbose - c = panel - t = transparency @@ -104,6 +107,7 @@ def legend( F=Alias(box, name="box"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/logo.py b/pygmt/src/logo.py index c74ee2dea2b..61a648a6c12 100644 --- a/pygmt/src/logo.py +++ b/pygmt/src/logo.py @@ -2,6 +2,7 @@ logo - Plot the GMT logo. """ +from collections.abc import Sequence from typing import Literal from pygmt.alias import Alias, AliasSystem @@ -11,11 +12,12 @@ @fmt_docstring -@use_alias(R="region", D="position") -@kwargs_to_strings(R="sequence", p="sequence") +@use_alias(D="position") +@kwargs_to_strings(p="sequence") def logo( self, projection: str | None = None, + region: Sequence[float | str] | str | None = None, style: Literal["standard", "url", "no_label"] = "standard", box: Box | bool = False, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] @@ -37,6 +39,7 @@ def logo( {aliases} - F = box - J = projection + - R = region - S = style - V = verbose - c = panel @@ -74,6 +77,7 @@ def logo( ), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/meca.py b/pygmt/src/meca.py index 335496d0acf..6969f41f40a 100644 --- a/pygmt/src/meca.py +++ b/pygmt/src/meca.py @@ -124,12 +124,11 @@ def _auto_offset(spec) -> bool: Fr="labelbox", G="compressionfill", L="outline", - R="region", T="nodal", W="pen", p="perspective", ) -@kwargs_to_strings(R="sequence", p="sequence") +@kwargs_to_strings(p="sequence") def meca( # noqa: PLR0913 self, spec: PathLike | TableLike, @@ -144,6 +143,7 @@ def meca( # noqa: PLR0913 event_name: str | Sequence[str] | None = None, no_clip: bool = False, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -204,6 +204,7 @@ def meca( # noqa: PLR0913 {aliases} - J = projection - N = no_clip + - R = region - S = scale/convention/component - V = verbose - c = panel @@ -374,6 +375,7 @@ def meca( # noqa: PLR0913 N=Alias(no_clip, name="no_clip"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/nearneighbor.py b/pygmt/src/nearneighbor.py index 48c6610e775..8f7d0466d93 100644 --- a/pygmt/src/nearneighbor.py +++ b/pygmt/src/nearneighbor.py @@ -2,6 +2,7 @@ nearneighbor - Grid table data using a "Nearest neighbor" algorithm. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -18,7 +19,6 @@ E="empty", I="spacing", N="sectors", - R="region", S="search_radius", a="aspatial", b="binary", @@ -31,13 +31,14 @@ r="registration", w="wrap", ) -@kwargs_to_strings(I="sequence", R="sequence", i="sequence_comma") +@kwargs_to_strings(I="sequence", i="sequence_comma") def nearneighbor( data: PathLike | TableLike | None = None, x=None, y=None, z=None, outgrid: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -79,6 +80,7 @@ def nearneighbor( Full GMT docs at :gmt-docs:`nearneighbor.html`. {aliases} + - R = region - V = verbose Parameters @@ -150,6 +152,7 @@ def nearneighbor( ... ) """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index 1f54088c6e4..0c5142c7828 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -31,7 +31,6 @@ I="intensity", L="close", N="no_clip", - R="region", S="style", W="pen", Z="zvalue", @@ -47,7 +46,7 @@ p="perspective", w="wrap", ) -@kwargs_to_strings(R="sequence", i="sequence_comma", p="sequence") +@kwargs_to_strings(i="sequence_comma", p="sequence") def plot( # noqa: PLR0912, PLR0913 self, data: PathLike | TableLike | None = None, @@ -58,6 +57,7 @@ def plot( # noqa: PLR0912, PLR0913 direction=None, straight_line: bool | Literal["x", "y"] = False, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -90,6 +90,7 @@ def plot( # noqa: PLR0912, PLR0913 {aliases} - A = straight_line - J = projection + - R = region - V = verbose - c = panel - t = transparency @@ -293,6 +294,7 @@ def plot( # noqa: PLR0912, PLR0913 aliasdict = AliasSystem( A=Alias(straight_line, name="straight_line"), ).add_common( + R=region, J=projection, V=verbose, c=panel, diff --git a/pygmt/src/plot3d.py b/pygmt/src/plot3d.py index cc3e123a345..6601d39ca2b 100644 --- a/pygmt/src/plot3d.py +++ b/pygmt/src/plot3d.py @@ -32,7 +32,6 @@ L="close", N="no_clip", Q="no_sort", - R="region", S="style", W="pen", Z="zvalue", @@ -48,7 +47,7 @@ p="perspective", w="wrap", ) -@kwargs_to_strings(R="sequence", i="sequence_comma", p="sequence") +@kwargs_to_strings(i="sequence_comma", p="sequence") def plot3d( # noqa: PLR0912, PLR0913 self, data: PathLike | TableLike | None = None, @@ -60,6 +59,7 @@ def plot3d( # noqa: PLR0912, PLR0913 direction=None, straight_line: bool | Literal["x", "y"] = False, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -92,6 +92,7 @@ def plot3d( # noqa: PLR0912, PLR0913 {aliases} - A = straight_line - J = projection + - R = region - V = verbose - c = panel - t = transparency @@ -273,6 +274,7 @@ def plot3d( # noqa: PLR0912, PLR0913 A=Alias(straight_line, name="straight_line"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/rose.py b/pygmt/src/rose.py index b573d84ef51..685c196c494 100644 --- a/pygmt/src/rose.py +++ b/pygmt/src/rose.py @@ -2,6 +2,7 @@ rose - Plot a polar histogram (rose, sector, windrose diagrams). """ +from collections.abc import Sequence from typing import Literal from pygmt._typing import PathLike, TableLike @@ -24,7 +25,6 @@ L="labels", M="vector_params", Q="alpha", - R="region", S="norm", T="orientation", W="pen", @@ -37,12 +37,13 @@ p="perspective", w="wrap", ) -@kwargs_to_strings(R="sequence", i="sequence_comma", p="sequence") +@kwargs_to_strings(i="sequence_comma", p="sequence") def rose( self, data: PathLike | TableLike | None = None, length=None, azimuth=None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -65,6 +66,7 @@ def rose( Full GMT docs at :gmt-docs:`rose.html`. {aliases} + - R = region - V = verbose - c = panel - t = transparency @@ -208,6 +210,7 @@ def rose( self._activate_figure() aliasdict = AliasSystem().add_common( + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/select.py b/pygmt/src/select.py index 15fbcd1d79d..c9ff73c35d7 100644 --- a/pygmt/src/select.py +++ b/pygmt/src/select.py @@ -2,6 +2,7 @@ select - Select data table subsets based on multiple spatial criteria. """ +from collections.abc import Sequence from typing import Literal import numpy as np @@ -29,7 +30,6 @@ I="reverse", L="dist2line", N="mask", - R="region", Z="z_subregion", b="binary", d="nodata", @@ -42,7 +42,7 @@ s="skiprows", w="wrap", ) -@kwargs_to_strings(N="sequence", R="sequence", i="sequence_comma", o="sequence_comma") +@kwargs_to_strings(N="sequence", i="sequence_comma", o="sequence_comma") def select( data: PathLike | TableLike | None = None, output_type: Literal["pandas", "numpy", "file"] = "pandas", @@ -51,6 +51,7 @@ def select( "auto", "full", "high", "intermediate", "low", "crude", None ] = None, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -79,6 +80,7 @@ def select( {aliases} - D = resolution - J = projection + - R = region - V = verbose Parameters @@ -233,6 +235,7 @@ def select( ), ).add_common( J=projection, + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/solar.py b/pygmt/src/solar.py index 6641961d0b8..dea8d7d4d21 100644 --- a/pygmt/src/solar.py +++ b/pygmt/src/solar.py @@ -2,6 +2,7 @@ solar - Plot day-night terminators and other sunlight parameters. """ +from collections.abc import Sequence from typing import Literal import pandas as pd @@ -14,8 +15,8 @@ @fmt_docstring -@use_alias(B="frame", R="region", p="perspective") -@kwargs_to_strings(R="sequence", p="sequence") +@use_alias(B="frame", p="perspective") +@kwargs_to_strings(p="sequence") def solar( self, terminator: Literal["astronomical", "civil", "day_night", "nautical"] = "day_night", @@ -23,6 +24,7 @@ def solar( fill: str | None = None, pen: str | None = None, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -40,6 +42,7 @@ def solar( {aliases} - G = fill - J = projection + - R = region - T = terminator, **+d**/**+z**: terminator_datetime - V = verbose - W = pen @@ -137,6 +140,7 @@ def solar( W=Alias(pen, name="pen"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index 9887292c20c..3446c65d3a6 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -2,6 +2,7 @@ sph2grd - Compute grid from spherical harmonic coefficients. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -16,16 +17,16 @@ @fmt_docstring @use_alias( I="spacing", - R="region", b="binary", h="header", i="incols", r="registration", ) -@kwargs_to_strings(I="sequence", R="sequence", i="sequence_comma") +@kwargs_to_strings(I="sequence", i="sequence_comma") def sph2grd( data: PathLike | TableLike, outgrid: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, cores: int | bool = False, @@ -41,6 +42,7 @@ def sph2grd( Full GMT docs at :gmt-docs:`sph2grd.html`. {aliases} + - R = region - V = verbose - x = cores @@ -77,6 +79,7 @@ def sph2grd( >>> new_grid = pygmt.sph2grd(data="@EGM96_to_36.txt", spacing=1, region="g") """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, x=cores, ) diff --git a/pygmt/src/sphdistance.py b/pygmt/src/sphdistance.py index 243968e3249..ba185a7a665 100644 --- a/pygmt/src/sphdistance.py +++ b/pygmt/src/sphdistance.py @@ -3,6 +3,7 @@ sphere. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -24,14 +25,14 @@ L="unit", N="node_table", Q="voronoi", - R="region", ) -@kwargs_to_strings(I="sequence", R="sequence") +@kwargs_to_strings(I="sequence") def sphdistance( data: PathLike | TableLike | None = None, x=None, y=None, outgrid: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -47,6 +48,7 @@ def sphdistance( Full GMT docs at :gmt-docs:`sphdistance.html`. {aliases} + - R = region - V = verbose Parameters @@ -119,11 +121,12 @@ def sphdistance( ... data=coords_array, spacing=[1, 2], region=[82, 87, 22, 24] ... ) """ - if kwargs.get("I") is None or kwargs.get("R") is None: + if kwargs.get("I") is None or kwargs.get("R", region) is None: msg = "Both 'region' and 'spacing' must be specified." raise GMTInvalidInput(msg) aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/sphinterpolate.py b/pygmt/src/sphinterpolate.py index 3aad5e760ae..1c82c741dfc 100644 --- a/pygmt/src/sphinterpolate.py +++ b/pygmt/src/sphinterpolate.py @@ -2,6 +2,7 @@ sphinterpolate - Spherical gridding in tension of data on a sphere. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -14,11 +15,12 @@ @fmt_docstring -@use_alias(I="spacing", R="region") -@kwargs_to_strings(I="sequence", R="sequence") +@use_alias(I="spacing") +@kwargs_to_strings(I="sequence") def sphinterpolate( data: PathLike | TableLike, outgrid: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -35,6 +37,7 @@ def sphinterpolate( Full GMT docs at :gmt-docs:`sphinterpolate.html`. {aliases} + - R = region - V = verbose Parameters @@ -67,6 +70,7 @@ def sphinterpolate( >>> grid = pygmt.sphinterpolate(data=mars_shape, spacing=1, region="g") """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/subplot.py b/pygmt/src/subplot.py index f80d8a2f538..e8f20c8286d 100644 --- a/pygmt/src/subplot.py +++ b/pygmt/src/subplot.py @@ -3,6 +3,7 @@ """ import contextlib +from collections.abc import Sequence from typing import Literal from pygmt.alias import AliasSystem @@ -25,17 +26,17 @@ B="frame", C="clearance", M="margins", - R="region", SC="sharex", SR="sharey", T="title", ) -@kwargs_to_strings(Ff="sequence", Fs="sequence", M="sequence", R="sequence") +@kwargs_to_strings(Ff="sequence", Fs="sequence", M="sequence") def subplot( self, nrows=1, ncols=1, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -53,6 +54,7 @@ def subplot( {aliases} - J = projection + - R = region - V = verbose Parameters @@ -171,6 +173,7 @@ def subplot( aliasdict = AliasSystem().add_common( J=projection, + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/surface.py b/pygmt/src/surface.py index cc351e9d875..fb772cf77c2 100644 --- a/pygmt/src/surface.py +++ b/pygmt/src/surface.py @@ -2,6 +2,7 @@ surface - Grid table data using adjustable tension continuous curvature splines. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -20,7 +21,6 @@ Ll="lower", Lu="upper", M="maxradius", - R="region", T="tension", a="aspatial", b="binary", @@ -32,13 +32,14 @@ r="registration", w="wrap", ) -@kwargs_to_strings(I="sequence", R="sequence") +@kwargs_to_strings(I="sequence") def surface( data: PathLike | TableLike | None = None, x=None, y=None, z=None, outgrid: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -76,6 +77,7 @@ def surface( Full GMT docs at :gmt-docs:`surface.html`. {aliases} + - R = region - V = verbose Parameters @@ -164,6 +166,7 @@ def surface( >>> grid = pygmt.surface(data=topography, spacing=1, region=[0, 4, 0, 8]) """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/ternary.py b/pygmt/src/ternary.py index c58138c0e85..50d7e8f69d9 100644 --- a/pygmt/src/ternary.py +++ b/pygmt/src/ternary.py @@ -2,6 +2,7 @@ ternary - Plot data on ternary diagrams. """ +from collections.abc import Sequence from typing import Literal import pandas as pd @@ -18,18 +19,18 @@ C="cmap", G="fill", JX="width", - R="region", S="style", W="pen", p="perspective", ) -@kwargs_to_strings(R="sequence", p="sequence") +@kwargs_to_strings(p="sequence") def ternary( self, data: PathLike | TableLike, alabel: str | None = None, blabel: str | None = None, clabel: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -51,6 +52,7 @@ def ternary( {aliases} - L = alabel/blabel/clabel + - R = region - V = verbose - c = panel - t = transparency @@ -98,6 +100,7 @@ def ternary( aliasdict = AliasSystem( L=Alias(labels, name="alabel/blabel/clabel", sep="/", size=3), ).add_common( + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/text.py b/pygmt/src/text.py index 5ed30087c56..07027e10f5e 100644 --- a/pygmt/src/text.py +++ b/pygmt/src/text.py @@ -24,7 +24,6 @@ @fmt_docstring @use_alias( - R="region", B="frame", C="clearance", D="offset", @@ -38,7 +37,7 @@ p="perspective", w="wrap", ) -@kwargs_to_strings(R="sequence", p="sequence") +@kwargs_to_strings(p="sequence") def text_( # noqa: PLR0912, PLR0913, PLR0915 self, textfiles: PathLike | TableLike | None = None, @@ -51,6 +50,7 @@ def text_( # noqa: PLR0912, PLR0913, PLR0915 justify: bool | None | AnchorCode | Sequence[AnchorCode] = None, no_clip: bool = False, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -77,6 +77,7 @@ def text_( # noqa: PLR0912, PLR0913, PLR0915 - F = **+a**: angle, **+c**: position, **+j**: justify, **+f**: font - J = projection - N = no_clip + - R = region - V = verbose - c = panel - t = transparency @@ -275,6 +276,7 @@ def text_( # noqa: PLR0912, PLR0913, PLR0915 N=Alias(no_clip, name="no_clip"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/tilemap.py b/pygmt/src/tilemap.py index e6afb6ae0c1..5fa03cfc727 100644 --- a/pygmt/src/tilemap.py +++ b/pygmt/src/tilemap.py @@ -2,6 +2,7 @@ tilemap - Plot XYZ tile maps. """ +from collections.abc import Sequence from typing import Literal from pygmt.alias import Alias, AliasSystem @@ -22,13 +23,12 @@ E="dpi", I="shading", Q="nan_transparent", - # R="region", p="perspective", ) -@kwargs_to_strings(p="sequence") # R="sequence", +@kwargs_to_strings(p="sequence") def tilemap( # noqa: PLR0913 self, - region: list, + region: Sequence[float], zoom: int | Literal["auto"] = "auto", source: TileProvider | str | None = None, lonlat: bool = True, @@ -128,16 +128,17 @@ def tilemap( # noqa: PLR0913 if lonlat: raster.gmt.gtype = GridType.GEOGRAPHIC - # Only set region if no_clip is None or False, so that plot is clipped to exact - # bounding box region - if kwargs.get("N", no_clip) in {None, False}: - kwargs["R"] = "/".join(str(coordinate) for coordinate in region) + # If no_clip is not True, set region to None so that plot is clipped to exact + # bounding box region. + if kwargs.get("N", no_clip) not in {None, False}: + region = None # type: ignore[assignment] aliasdict = AliasSystem( M=Alias(monochrome, name="monochrome"), N=Alias(no_clip, name="no_clip"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/triangulate.py b/pygmt/src/triangulate.py index d0f67488b6a..917b17ee0cf 100644 --- a/pygmt/src/triangulate.py +++ b/pygmt/src/triangulate.py @@ -3,6 +3,7 @@ data. """ +from collections.abc import Sequence from typing import Literal import numpy as np @@ -52,7 +53,6 @@ class triangulate: # noqa: N801 @fmt_docstring @use_alias( I="spacing", - R="region", b="binary", d="nodata", e="find", @@ -63,7 +63,7 @@ class triangulate: # noqa: N801 s="skiprows", w="wrap", ) - @kwargs_to_strings(I="sequence", R="sequence", i="sequence_comma") + @kwargs_to_strings(I="sequence", i="sequence_comma") def regular_grid( data: PathLike | TableLike | None = None, x=None, @@ -71,6 +71,7 @@ def regular_grid( z=None, outgrid: PathLike | None = None, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal[ "quiet", "error", "warning", "timing", "info", "compat", "debug" ] @@ -102,6 +103,7 @@ def regular_grid( {aliases} - J = projection + - R = region - V = verbose Parameters @@ -148,6 +150,7 @@ def regular_grid( unaware of periodic or polar boundary conditions. """ aliasdict = AliasSystem().add_common( + R=region, J=projection, V=verbose, ) @@ -170,7 +173,6 @@ def regular_grid( @fmt_docstring @use_alias( I="spacing", - R="region", b="binary", d="nodata", e="find", @@ -181,7 +183,7 @@ def regular_grid( s="skiprows", w="wrap", ) - @kwargs_to_strings(I="sequence", R="sequence", i="sequence_comma") + @kwargs_to_strings(I="sequence", i="sequence_comma") def delaunay_triples( data: PathLike | TableLike | None = None, x=None, @@ -191,6 +193,7 @@ def delaunay_triples( output_type: Literal["pandas", "numpy", "file"] = "pandas", outfile: PathLike | None = None, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal[ "quiet", "error", "warning", "timing", "info", "compat", "debug" ] @@ -215,6 +218,7 @@ def delaunay_triples( {aliases} - J = projection + - R = region - V = verbose Parameters @@ -260,6 +264,7 @@ def delaunay_triples( aliasdict = AliasSystem().add_common( J=projection, + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/velo.py b/pygmt/src/velo.py index 56e4f46559e..f4fe41d8a7f 100644 --- a/pygmt/src/velo.py +++ b/pygmt/src/velo.py @@ -2,6 +2,7 @@ velo - Plot velocity vectors, crosses, anisotropy bars, and wedges. """ +from collections.abc import Sequence from typing import Literal import numpy as np @@ -24,7 +25,6 @@ H="scale", I="shading", L="line", - R="region", S="spec", W="pen", Z="zvalue", @@ -34,12 +34,13 @@ i="incols", p="perspective", ) -@kwargs_to_strings(R="sequence", i="sequence_comma", p="sequence") +@kwargs_to_strings(i="sequence_comma", p="sequence") def velo( self, data: PathLike | TableLike | None = None, no_clip: bool = False, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -63,6 +64,7 @@ def velo( {aliases} - J = projection - N = no_clip + - R = region - V = verbose - c = panel - t = transparency @@ -267,6 +269,7 @@ def velo( N=Alias(no_clip, name="no_clip"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/wiggle.py b/pygmt/src/wiggle.py index 57521001f97..b0d145a3687 100644 --- a/pygmt/src/wiggle.py +++ b/pygmt/src/wiggle.py @@ -2,6 +2,7 @@ wiggle - Plot z=f(x,y) anomalies along tracks. """ +from collections.abc import Sequence from typing import Literal from pygmt._typing import PathLike, TableLike @@ -41,7 +42,6 @@ def _parse_fills(fillpositive, fillnegative): @use_alias( B="frame", D="position", - R="region", T="track", W="pen", Z="scale", @@ -55,7 +55,7 @@ def _parse_fills(fillpositive, fillnegative): p="perspective", w="wrap", ) -@kwargs_to_strings(R="sequence", i="sequence_comma", p="sequence") +@kwargs_to_strings(i="sequence_comma", p="sequence") def wiggle( # noqa: PLR0913 self, data: PathLike | TableLike | None = None, @@ -65,6 +65,7 @@ def wiggle( # noqa: PLR0913 fillpositive=None, fillnegative=None, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, panel: int | tuple[int, int] | bool = False, @@ -84,6 +85,7 @@ def wiggle( # noqa: PLR0913 {aliases} - G = **+p**: fillpositive, **+n**: fillnegative - J = projection + - R = region - V = verbose - c = panel - t = transparency @@ -140,6 +142,7 @@ def wiggle( # noqa: PLR0913 G=Alias(_fills, name="fillpositive/fillnegative"), ).add_common( J=projection, + R=region, V=verbose, c=panel, t=transparency, diff --git a/pygmt/src/x2sys_cross.py b/pygmt/src/x2sys_cross.py index 355b8a34f21..50f47b36c42 100644 --- a/pygmt/src/x2sys_cross.py +++ b/pygmt/src/x2sys_cross.py @@ -4,6 +4,7 @@ import contextlib import os +from collections.abc import Sequence from pathlib import Path from typing import Any, Literal @@ -16,7 +17,6 @@ build_arg_list, data_kind, fmt_docstring, - kwargs_to_strings, unique_name, use_alias, ) @@ -63,17 +63,16 @@ def tempfile_from_dftrack(track, suffix): C="runtimes", D="override", I="interpolation", - R="region", S="speed", T="tag", Q="coe", W="numpoints", Z="trackvalues", ) -@kwargs_to_strings(R="sequence") def x2sys_cross( tracks=None, outfile: PathLike | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -92,6 +91,7 @@ def x2sys_cross( Full GMT docs at :gmt-docs:`supplements/x2sys/x2sys_cross.html`. {aliases} + - R = region - V = verbose Parameters @@ -219,6 +219,7 @@ def x2sys_cross( raise GMTTypeError(type(track)) aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/x2sys_init.py b/pygmt/src/x2sys_init.py index ff9711eb479..4313ed5e033 100644 --- a/pygmt/src/x2sys_init.py +++ b/pygmt/src/x2sys_init.py @@ -2,6 +2,7 @@ x2sys_init - Initialize a new x2sys track database. """ +from collections.abc import Sequence from typing import Literal from pygmt.alias import AliasSystem @@ -17,13 +18,13 @@ G="discontinuity", I="spacing", N="units", - R="region", W="gap", j="distcalc", ) -@kwargs_to_strings(I="sequence", R="sequence") +@kwargs_to_strings(I="sequence") def x2sys_init( tag, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -44,6 +45,7 @@ def x2sys_init( Full GMT docs at :gmt-docs:`supplements/x2sys/x2sys_init.html`. {aliases} + - R = region - V = verbose Parameters @@ -119,6 +121,7 @@ def x2sys_init( {distcalc} """ aliasdict = AliasSystem().add_common( + R=region, V=verbose, ) aliasdict.merge(kwargs) diff --git a/pygmt/src/xyz2grd.py b/pygmt/src/xyz2grd.py index 15a0fa7920b..b73f3c0b566 100644 --- a/pygmt/src/xyz2grd.py +++ b/pygmt/src/xyz2grd.py @@ -2,6 +2,7 @@ xyz2grd - Convert data table to a grid. """ +from collections.abc import Sequence from typing import Literal import xarray as xr @@ -18,7 +19,6 @@ @use_alias( A="duplicate", I="spacing", - R="region", Z="convention", b="binary", d="nodata", @@ -29,7 +29,7 @@ r="registration", w="wrap", ) -@kwargs_to_strings(I="sequence", R="sequence") +@kwargs_to_strings(I="sequence") def xyz2grd( data: PathLike | TableLike | None = None, x=None, @@ -37,6 +37,7 @@ def xyz2grd( z=None, outgrid: PathLike | None = None, projection: str | None = None, + region: Sequence[float | str] | str | None = None, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | bool = False, **kwargs, @@ -54,6 +55,7 @@ def xyz2grd( {aliases} - J = projection + - R = region - V = verbose Parameters @@ -154,12 +156,13 @@ def xyz2grd( ... x=xx, y=yy, z=zz, spacing=(1.0, 0.5), region=[0, 3, 10, 13] ... ) """ - if kwargs.get("I") is None or kwargs.get("R") is None: + if kwargs.get("I") is None or kwargs.get("R", region) is None: msg = "Both 'region' and 'spacing' must be specified." raise GMTInvalidInput(msg) aliasdict = AliasSystem().add_common( J=projection, + R=region, V=verbose, ) aliasdict.merge(kwargs) From 9378aedb45d0523424df91f210a777c51707a7c8 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 30 Sep 2025 00:20:02 +0800 Subject: [PATCH 24/31] Add an entry for gs 10.06.0 --- doc/changes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changes.md b/doc/changes.md index 8e96bcfd7fa..e2977958934 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -53,6 +53,7 @@ * CI: Bump to macOS 26 in the GMT Dev Tests workflow ([#4084](https://github.com/GenericMappingTools/pygmt/pull/4084)) * CI: Bump to macOS 14 in the GMT Legacy Tests workflow ([#3996](https://github.com/GenericMappingTools/pygmt/pull/3996)) * CI: Access DagsHub repository via an access token ([#4078](https://github.com/GenericMappingTools/pygmt/pull/4078)) +* CI: Bump to Ghostscript 10.06.0 **Full Changelog**: From e948f6dbaa19e5f6b3022730e92b050079d418e1 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 30 Sep 2025 12:15:43 +0800 Subject: [PATCH 25/31] Add more recent entries --- doc/changes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index e2977958934..ff5decee4b1 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -26,6 +26,7 @@ ### Deprecations +* Drop GMT 6.4 support ([#4127](https://github.com/GenericMappingTools/pygmt/pull/4127)) * **BREAKING** Raise GMTValueError exception for invalid values. Previously raise GMTInvalidInput ([#3985](https://github.com/GenericMappingTools/pygmt/pull/3985), [#3998](https://github.com/GenericMappingTools/pygmt/pull/3998)) * **BREAKING** Raise GMTTypeError exception for invalid types. Previously raise GMTInvalidInput ([#3999](https://github.com/GenericMappingTools/pygmt/pull/3999)) * **BREAKING** Figure.grdimage: Raise NotImplementedError instead of GMTInvalidInput for -A option ([#4062](https://github.com/GenericMappingTools/pygmt/pull/4062)) @@ -53,7 +54,8 @@ * CI: Bump to macOS 26 in the GMT Dev Tests workflow ([#4084](https://github.com/GenericMappingTools/pygmt/pull/4084)) * CI: Bump to macOS 14 in the GMT Legacy Tests workflow ([#3996](https://github.com/GenericMappingTools/pygmt/pull/3996)) * CI: Access DagsHub repository via an access token ([#4078](https://github.com/GenericMappingTools/pygmt/pull/4078)) -* CI: Bump to Ghostscript 10.06.0 +* CI: Bump to Ghostscript 10.06.0 ([#4125](https://github.com/GenericMappingTools/pygmt/pull/4125)) +* CI: Bump to GMT 6.6.0 in CI ([#4018](https://github.com/GenericMappingTools/pygmt/pull/4018)) **Full Changelog**: From 4aaa9ef9b6ba92265012926d81defc7387ae3c43 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 30 Sep 2025 12:43:05 +0800 Subject: [PATCH 26/31] Bump minimum supported GMT version to 6.5.0 --- doc/minversions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/minversions.md b/doc/minversions.md index 7f4fd4c7b87..fac4f1f8c1e 100644 --- a/doc/minversions.md +++ b/doc/minversions.md @@ -47,7 +47,7 @@ compatibility reasons. | PyGMT Version | Documentation | GMT | Python | NumPy | pandas | Xarray | |---|---|---|---|---|---|---| | [Dev][]* | , [HTML+ZIP](doc:dev/pygmt-docs.zip), [PDF](doc:dev/pygmt-docs.pdf) | {{ requires.gmt }} | {{ requires.python }} | {{ requires.numpy }} | {{ requires.pandas }} | {{ requires.xarray }} | -| | , , | >=6.4.0 | >=3.11 | >=1.26 | >=2.2 | >=2023.10 | +| | , , | >=6.5.0 | >=3.11 | >=1.26 | >=2.2 | >=2023.10 | | | , , | >=6.4.0 | >=3.11 | >=1.26 | >=2.1 | >=2023.07 | | | , , | >=6.4.0 | >=3.11 | >=1.25 | >=2.0 | >=2023.04 | | | , | >=6.4.0 | >=3.11 | >=1.25 | >=2.0 | >=2023.04 | From d92d298b0c34af2a80434fff910710d41a5c9956 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Thu, 2 Oct 2025 18:53:47 +1300 Subject: [PATCH 27/31] Another changelog entry --- doc/changes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changes.md b/doc/changes.md index ff5decee4b1..f09194a0d2b 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -40,6 +40,7 @@ ### Documentation +* Figure.colorbar: Add note regarding automatic fontsize scaling ([#4126](https://github.com/GenericMappingTools/pygmt/pull/4126)) * Add gallery example to show text formatting ([#3987](https://github.com/GenericMappingTools/pygmt/pull/3987)) * Add gallery example for using EPSG codes ([#3973](https://github.com/GenericMappingTools/pygmt/pull/3973)) * Add Technical Reference page for justification codes ([#4028](https://github.com/GenericMappingTools/pygmt/pull/4028)) From 963465da3345b6b10ac848e4aa3d58276be33583 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Fri, 3 Oct 2025 08:11:25 +1300 Subject: [PATCH 28/31] Highlight GMT 6.4 dropped in favour of GMT 6.6, update release date 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> --- CITATION.cff | 2 +- README.md | 2 +- doc/changes.md | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 2db463c3214..b877dfa87dd 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -76,7 +76,7 @@ authors: family-names: Wessel affiliation: University of Hawaiʻi at Mānoa, USA orcid: https://orcid.org/0000-0001-5708-7336 -date-released: 2025-09-30 +date-released: 2025-10-03 doi: 10.5281/zenodo.17156962 license: BSD-3-Clause repository-code: https://github.com/GenericMappingTools/pygmt diff --git a/README.md b/README.md index ae9a4edf667..dde222fa7cb 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ Feel free to cite our work in your research using the following BibTeX: Uieda, Leonardo and Wessel, Paul}, title = {{PyGMT: A Python interface for the Generic Mapping Tools}}, - month = sep, + month = oct, year = 2025, publisher = {Zenodo}, version = {0.17.0}, diff --git a/doc/changes.md b/doc/changes.md index f09194a0d2b..7d9d452e0c5 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -7,6 +7,7 @@ ### Highlights * 🎉 **Seventeenth minor release of PyGMT** 🎉 +* Drop support for GMT 6.4.0, while adding support for GMT 6.6.0 * Implement the new alias system towards a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) * GMTDataArrayAccessor: Support applying grid operations on the current xarray.DataArray object ([#3854](https://github.com/GenericMappingTools/pygmt/pull/3854)) @@ -26,7 +27,7 @@ ### Deprecations -* Drop GMT 6.4 support ([#4127](https://github.com/GenericMappingTools/pygmt/pull/4127)) +* Drop GMT 6.4.0 support ([#4127](https://github.com/GenericMappingTools/pygmt/pull/4127)) * **BREAKING** Raise GMTValueError exception for invalid values. Previously raise GMTInvalidInput ([#3985](https://github.com/GenericMappingTools/pygmt/pull/3985), [#3998](https://github.com/GenericMappingTools/pygmt/pull/3998)) * **BREAKING** Raise GMTTypeError exception for invalid types. Previously raise GMTInvalidInput ([#3999](https://github.com/GenericMappingTools/pygmt/pull/3999)) * **BREAKING** Figure.grdimage: Raise NotImplementedError instead of GMTInvalidInput for -A option ([#4062](https://github.com/GenericMappingTools/pygmt/pull/4062)) From a3ed5d81f35b368ab6d8cc9f592c8ee1c535134b Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Fri, 3 Oct 2025 08:14:24 +1300 Subject: [PATCH 29/31] Add issue number #4017 --- doc/changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index 7d9d452e0c5..e063ab0dabd 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -7,7 +7,7 @@ ### Highlights * 🎉 **Seventeenth minor release of PyGMT** 🎉 -* Drop support for GMT 6.4.0, while adding support for GMT 6.6.0 +* Drop support for GMT 6.4.0, while adding support for GMT 6.6.0 ([#4017](https://github.com/GenericMappingTools/pygmt/issues/4017)) * Implement the new alias system towards a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) * GMTDataArrayAccessor: Support applying grid operations on the current xarray.DataArray object ([#3854](https://github.com/GenericMappingTools/pygmt/pull/3854)) From 182e86a41163ff174045bb17b487b5c62ae46f5c Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Fri, 3 Oct 2025 08:17:35 +1300 Subject: [PATCH 30/31] Another date change --- doc/changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes.md b/doc/changes.md index e063ab0dabd..8e193e1b89a 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -1,6 +1,6 @@ # Changelog -## Release v0.17.0 (2025/09/30) +## Release v0.17.0 (2025/10/03) [![Digital Object Identifier for PyGMT v0.17.0](https://zenodo.org/badge/DOI/10.5281/zenodo.17156962.svg)](https://doi.org/10.5281/zenodo.17156962) From 33065a09b3f4aa0093a67b76ee6106ea6f371518 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Fri, 3 Oct 2025 11:29:15 +1300 Subject: [PATCH 31/31] Apply suggestions from code review 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> --- doc/changes.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/changes.md b/doc/changes.md index 8e193e1b89a..c367188e4af 100644 --- a/doc/changes.md +++ b/doc/changes.md @@ -7,7 +7,7 @@ ### Highlights * 🎉 **Seventeenth minor release of PyGMT** 🎉 -* Drop support for GMT 6.4.0, while adding support for GMT 6.6.0 ([#4017](https://github.com/GenericMappingTools/pygmt/issues/4017)) +* Add support for GMT 6.6.0, while dropping support for GMT 6.4.0 ([#4017](https://github.com/GenericMappingTools/pygmt/issues/4017)) * Implement the new alias system towards a Pythonic interface ([#3986](https://github.com/GenericMappingTools/pygmt/pull/3986), [#4000](https://github.com/GenericMappingTools/pygmt/pull/4000), [#3993](https://github.com/GenericMappingTools/pygmt/pull/3993)) * GMTDataArrayAccessor: Support applying grid operations on the current xarray.DataArray object ([#3854](https://github.com/GenericMappingTools/pygmt/pull/3854)) @@ -23,11 +23,11 @@ * pygmt.binstats: Let the parameter 'statistic' support descriptive arguments ([#3012](https://github.com/GenericMappingTools/pygmt/pull/3012)) * Figure.logo: Let the 'style' parameter support descriptive arguments ([#4074](https://github.com/GenericMappingTools/pygmt/pull/4074)) * Let the 'verbose' parameter support descriptive arguments ([#4039](https://github.com/GenericMappingTools/pygmt/pull/4039)) -* sequence_join: Correctly join datetime-like values in pd.DataFrame/xr.DataArray objects ([#4097](https://github.com/GenericMappingTools/pygmt/pull/4097)) +* sequence_join: Correctly join datetime-like values in pandas.DataFrame/xarray.DataArray objects ([#4097](https://github.com/GenericMappingTools/pygmt/pull/4097)) ### Deprecations -* Drop GMT 6.4.0 support ([#4127](https://github.com/GenericMappingTools/pygmt/pull/4127)) +* Drop support for GMT 6.4.0 ([#4127](https://github.com/GenericMappingTools/pygmt/pull/4127)) * **BREAKING** Raise GMTValueError exception for invalid values. Previously raise GMTInvalidInput ([#3985](https://github.com/GenericMappingTools/pygmt/pull/3985), [#3998](https://github.com/GenericMappingTools/pygmt/pull/3998)) * **BREAKING** Raise GMTTypeError exception for invalid types. Previously raise GMTInvalidInput ([#3999](https://github.com/GenericMappingTools/pygmt/pull/3999)) * **BREAKING** Figure.grdimage: Raise NotImplementedError instead of GMTInvalidInput for -A option ([#4062](https://github.com/GenericMappingTools/pygmt/pull/4062)) @@ -35,7 +35,7 @@ ### Bug Fixes -* x2sys_cross: Fix IndexError to allow empty DataFrame outputs ([#4060](https://github.com/GenericMappingTools/pygmt/pull/4060)) +* pygmt.x2sys_cross: Fix IndexError to allow empty DataFrame outputs ([#4060](https://github.com/GenericMappingTools/pygmt/pull/4060)) * is_nonstr_iter: 0-D array is now recognized as non-iterable ([#4004](https://github.com/GenericMappingTools/pygmt/pull/4004)) * Fix the bug when passing a sequence that contains True to a parameter ([#3982](https://github.com/GenericMappingTools/pygmt/pull/3982))