Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update failing doctests with upstream dataset changes #2988

Merged
merged 9 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_doctests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Doctests
on:
# push:
# branches: [ main ]
# pull_request:
pull_request:
seisman marked this conversation as resolved.
Show resolved Hide resolved
# Schedule weekly tests on Sunday
schedule:
- cron: '0 0 * * 0'
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/grd2xyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion pygmt/src/grdclip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
10 changes: 5 additions & 5 deletions pygmt/src/grdhisteq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------
Expand Down
11 changes: 4 additions & 7 deletions pygmt/src/grdproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,10 @@ 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]
... )
>>> # 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)
>>> region = [10, 30, 15, 25]
>>> grid = pygmt.datasets.load_earth_relief(resolution="30m", region=region)
>>> # Project the geographic gridded data onto a rectangular grid
>>> new_grid = pygmt.grdproject(grid=grid, projection="M10c", region=region)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, did we write the wrong description before. Default (when inverse=False) should have been "geographic" to "rectangular" 😅

"""
if kwargs.get("J") is None:
raise GMTInvalidInput("The projection must be specified.")
Expand Down
10 changes: 5 additions & 5 deletions pygmt/src/grdvolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading