From 7fa3c3f1d2ba549ba65a1e818518a4417d778de1 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 11 Jan 2024 18:34:07 +0800 Subject: [PATCH 1/7] Fix failing inline doctests --- pygmt/src/grd2xyz.py | 4 ++-- pygmt/src/grdclip.py | 2 +- pygmt/src/grdhisteq.py | 10 +++++----- pygmt/src/grdvolume.py | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pygmt/src/grd2xyz.py b/pygmt/src/grd2xyz.py index 0ff26af6298..f7b70ea8c58 100644 --- a/pygmt/src/grd2xyz.py +++ b/pygmt/src/grd2xyz.py @@ -138,8 +138,8 @@ def grd2xyz(grid, output_type="pandas", outfile=None, **kwargs): >>> xyz_dataframe = pygmt.grd2xyz(grid=grid, output_type="pandas") >>> xyz_dataframe.head(n=2) lon lat elevation - 0 10.0 25.0 863.0 - 1 10.5 25.0 985.5 + 0 10.0 25.0 965.5 + 1 10.5 25.0 876.5 """ output_type = validate_output_table_type(output_type, outfile=outfile) diff --git a/pygmt/src/grdclip.py b/pygmt/src/grdclip.py index 87f635d0487..878d9db3af2 100644 --- a/pygmt/src/grdclip.py +++ b/pygmt/src/grdclip.py @@ -87,7 +87,7 @@ def grdclip(grid, **kwargs): ... ) >>> # Report the minimum and maximum data values >>> [grid.data.min(), grid.data.max()] - [170.0, 2275.5] + [183.5, 1807.0] >>> # Create a new grid from an input grid. Set all values below 1,000 to >>> # 0 and all values above 1,500 to 10,000 >>> new_grid = pygmt.grdclip(grid=grid, below=[1000, 0], above=[1500, 10000]) diff --git a/pygmt/src/grdhisteq.py b/pygmt/src/grdhisteq.py index c804d8f8f28..c9524aa1ab4 100644 --- a/pygmt/src/grdhisteq.py +++ b/pygmt/src/grdhisteq.py @@ -299,11 +299,11 @@ def compute_bins( >>> print(bins) start stop bin_id - 0 170.0 389.0 - 1 389.0 470.5 - 2 470.5 571.0 - 3 571.0 705.0 - 4 705.0 2275.5 + 0 183.5 395.0 + 1 395.0 472.0 + 2 472.0 575.0 + 3 575.0 709.5 + 4 709.5 1807.0 See Also -------- diff --git a/pygmt/src/grdvolume.py b/pygmt/src/grdvolume.py index a4c7d3937f6..70d99e19b82 100644 --- a/pygmt/src/grdvolume.py +++ b/pygmt/src/grdvolume.py @@ -94,11 +94,11 @@ def grdvolume(grid, output_type="pandas", outfile=None, **kwargs): ... ) >>> print(output_dataframe) 0 1 2 3 - 0 200 2.318187e+12 8.533727e+14 368.120722 - 1 250 2.272471e+12 7.383936e+14 324.929840 - 2 300 2.162074e+12 6.273066e+14 290.141086 - 3 350 2.018302e+12 5.222640e+14 258.764032 - 4 400 1.857370e+12 4.252699e+14 228.963499 + 0 200 2.323600e+12 8.523815e+14 366.836554 + 1 250 2.275864e+12 7.371655e+14 323.905736 + 2 300 2.166707e+12 6.258570e+14 288.851699 + 3 350 2.019284e+12 5.207732e+14 257.899955 + 4 400 1.870441e+12 4.236191e+14 226.480847 """ output_type = validate_output_table_type(output_type, outfile=outfile) From ab207a6e02f29b6a7a71f4f4e7c4db57c2f6b7dd Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 11 Jan 2024 18:35:35 +0800 Subject: [PATCH 2/7] Temporarily enable full tests in this PR --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index d145ccd5796..5bfa3d2c17e 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -148,7 +148,7 @@ jobs: # Run the regular tests - name: Run tests - run: make test PYTEST_EXTRA="-r P" + run: make fulltest PYTEST_EXTRA="-r P" # Upload diff images on test failure - name: Upload diff images if any test fails From 6db960b15d1ce44f20a4805c9331baf3fb0ec4fc Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 11 Jan 2024 22:07:05 +0800 Subject: [PATCH 3/7] Fix the grdproject doctest --- pygmt/src/grdproject.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pygmt/src/grdproject.py b/pygmt/src/grdproject.py index 68e75636164..6a83103636f 100644 --- a/pygmt/src/grdproject.py +++ b/pygmt/src/grdproject.py @@ -103,13 +103,12 @@ def grdproject(grid, **kwargs): >>> import pygmt >>> # Load a grid of @earth_relief_30m data, with a longitude range of >>> # 10° E to 30° E, and a latitude range of 15° N to 25° N - >>> grid = pygmt.datasets.load_earth_relief( - ... resolution="30m", region=[10, 30, 15, 25] - ... ) + >>> region = [10, 30, 15, 25] + >>> grid = pygmt.datasets.load_earth_relief(resolution="30m", region=region) >>> # Create a new grid from the input grid, set the projection to >>> # Mercator, and set inverse to "True" to change from "geographic" >>> # to "rectangular" - >>> new_grid = pygmt.grdproject(grid=grid, projection="M10c", inverse=True) + >>> new_grid = pygmt.grdproject(grid=grid, projection="M10c", region=region) """ if kwargs.get("J") is None: raise GMTInvalidInput("The projection must be specified.") From c8152134e97779be0d511caa9b69c5fba9b25263 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 11 Jan 2024 22:12:04 +0800 Subject: [PATCH 4/7] Improve the docstrings --- pygmt/src/grdproject.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pygmt/src/grdproject.py b/pygmt/src/grdproject.py index 6a83103636f..c934bea2e02 100644 --- a/pygmt/src/grdproject.py +++ b/pygmt/src/grdproject.py @@ -105,9 +105,7 @@ def grdproject(grid, **kwargs): >>> # 10° E to 30° E, and a latitude range of 15° N to 25° N >>> region = [10, 30, 15, 25] >>> grid = pygmt.datasets.load_earth_relief(resolution="30m", region=region) - >>> # Create a new grid from the input grid, set the projection to - >>> # Mercator, and set inverse to "True" to change from "geographic" - >>> # to "rectangular" + >>> # Project the geographic gridded data onto a rectangular grid >>> new_grid = pygmt.grdproject(grid=grid, projection="M10c", region=region) """ if kwargs.get("J") is None: From 1b912a9b3ad1ed76db2478140b43d612ce51537e Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 12 Jan 2024 21:08:29 +0800 Subject: [PATCH 5/7] Update .github/workflows/ci_tests.yaml --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 5bfa3d2c17e..d145ccd5796 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -148,7 +148,7 @@ jobs: # Run the regular tests - name: Run tests - run: make fulltest PYTEST_EXTRA="-r P" + run: make test PYTEST_EXTRA="-r P" # Upload diff images on test failure - name: Upload diff images if any test fails From e42f9492a5297e3549da610abade3a2db5b34e5f Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 15 Jan 2024 13:15:49 +0800 Subject: [PATCH 6/7] Temporarily trigger docstest in PR --- .github/workflows/ci_doctests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index b353f8f47f5..188f57b735f 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -8,7 +8,7 @@ name: Doctests on: # push: # branches: [ main ] - # pull_request: + pull_request: # Schedule weekly tests on Sunday schedule: - cron: '0 0 * * 0' From 4446a09891398985d49f4cf52ee5c7f08fe13080 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 15 Jan 2024 13:29:25 +0800 Subject: [PATCH 7/7] Disable workflow in PR --- .github/workflows/ci_doctests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index 188f57b735f..b353f8f47f5 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -8,7 +8,7 @@ name: Doctests on: # push: # branches: [ main ] - pull_request: + # pull_request: # Schedule weekly tests on Sunday schedule: - cron: '0 0 * * 0'