-
Notifications
You must be signed in to change notification settings - Fork 234
Add inline example for grdvolume #1726
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5f2a4b9
add inline example to grdvolume.py
willschlitzer 8a1f5d1
Update pygmt/src/grdvolume.py
willschlitzer 3855b1a
Update pygmt/src/grdvolume.py
willschlitzer 4564a05
update doctest skip format
willschlitzer 0e58a82
Merge remote-tracking branch 'origin/inline-example/grdvolume' into i…
willschlitzer 6de69d3
Merge branch 'main' into inline-example/grdvolume
willschlitzer ed458d9
Fix formatting
seisman f87c99b
Merge branch 'main' into inline-example/grdvolume
seisman 4f69b86
Update pygmt/src/grdvolume.py
willschlitzer 56dc7c6
Update pygmt/src/grdvolume.py
willschlitzer a022c11
Update pygmt/src/grdvolume.py
willschlitzer cc4b56f
Update pygmt/src/grdvolume.py
willschlitzer 65703b3
Merge branch 'main' into inline-example/grdvolume
willschlitzer 2f70141
Merge branch 'main' into inline-example/grdvolume
willschlitzer c3596ff
run make format
willschlitzer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,8 @@ | |||||||||||||||||||||||||||||||||||||
| use_alias, | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| __doctest_skip__ = ["grdvolume"] | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @fmt_docstring | ||||||||||||||||||||||||||||||||||||||
| @use_alias( | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -74,7 +76,23 @@ def grdvolume(grid, output_type="pandas", outfile=None, **kwargs): | |||||||||||||||||||||||||||||||||||||
| ``outfile``) | ||||||||||||||||||||||||||||||||||||||
| - :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` | ||||||||||||||||||||||||||||||||||||||
| is not set (depends on ``output_type`` [Default is | ||||||||||||||||||||||||||||||||||||||
| class:`pandas.DataFrame`]) | ||||||||||||||||||||||||||||||||||||||
| :class:`pandas.DataFrame`]) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Example | ||||||||||||||||||||||||||||||||||||||
| ------- | ||||||||||||||||||||||||||||||||||||||
| >>> import pygmt | ||||||||||||||||||||||||||||||||||||||
| >>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to 30 | ||||||||||||||||||||||||||||||||||||||
| >>> # degrees, and a y-range of 15 to 25 degrees | ||||||||||||||||||||||||||||||||||||||
| >>> grid = pygmt.datasets.load_earth_relief( | ||||||||||||||||||||||||||||||||||||||
| ... resolution="30m", region=[10, 30, 15, 25] | ||||||||||||||||||||||||||||||||||||||
| ... ) | ||||||||||||||||||||||||||||||||||||||
| >>> # Create a numpy ndarray that contains the contour, area, volume, and | ||||||||||||||||||||||||||||||||||||||
| >>> # maximum mean height above the plane specified by the given contour | ||||||||||||||||||||||||||||||||||||||
| >>> # and below the surface; set the minimum contour z-value to 200, the | ||||||||||||||||||||||||||||||||||||||
| >>> # maximum to 400, and the interval to 50. | ||||||||||||||||||||||||||||||||||||||
| >>> output_array = pygmt.grdvolume( | ||||||||||||||||||||||||||||||||||||||
| ... grid=grid, contour=[200, 400, 50], output_type="numpy" | ||||||||||||||||||||||||||||||||||||||
| ... ) | ||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, we would have nice column names like in Lines 301 to 309 in d85bfdf
But for the sake of time, and just finish this inline example, let's go with this:
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| if output_type not in ["numpy", "pandas", "file"]: | ||||||||||||||||||||||||||||||||||||||
| raise GMTInvalidInput( | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.