|
12 | 12 | use_alias,
|
13 | 13 | )
|
14 | 14 |
|
| 15 | +__doctest_skip__ = ["grdvolume"] |
| 16 | + |
15 | 17 |
|
16 | 18 | @fmt_docstring
|
17 | 19 | @use_alias(
|
@@ -74,7 +76,30 @@ def grdvolume(grid, output_type="pandas", outfile=None, **kwargs):
|
74 | 76 | ``outfile``)
|
75 | 77 | - :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile``
|
76 | 78 | is not set (depends on ``output_type`` [Default is
|
77 |
| - class:`pandas.DataFrame`]) |
| 79 | + :class:`pandas.DataFrame`]) |
| 80 | +
|
| 81 | + Example |
| 82 | + ------- |
| 83 | + >>> import pygmt |
| 84 | + >>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to 30 |
| 85 | + >>> # degrees, and a y-range of 15 to 25 degrees |
| 86 | + >>> grid = pygmt.datasets.load_earth_relief( |
| 87 | + ... resolution="30m", region=[10, 30, 15, 25] |
| 88 | + ... ) |
| 89 | + >>> # Create a pandas dataframe that contains the contour, area, volume, |
| 90 | + >>> # and maximum mean height above the plane specified by the given |
| 91 | + >>> # contour and below the surface; set the minimum contour z-value to |
| 92 | + >>> # 200, the maximum to 400, and the interval to 50. |
| 93 | + >>> output_dataframe = pygmt.grdvolume( |
| 94 | + ... grid=grid, contour=[200, 400, 50], output_type="pandas" |
| 95 | + ... ) |
| 96 | + >>> print(output_dataframe) |
| 97 | + 0 1 2 3 |
| 98 | + 0 200 2.144285e+12 7.972228e+14 371.789489 |
| 99 | + 1 250 2.104042e+12 6.908183e+14 328.329232 |
| 100 | + 2 300 2.014978e+12 5.877195e+14 291.675420 |
| 101 | + 3 350 1.892109e+12 4.897545e+14 258.840510 |
| 102 | + 4 400 1.744792e+12 3.988316e+14 228.584026 |
78 | 103 | """
|
79 | 104 | if output_type not in ["numpy", "pandas", "file"]:
|
80 | 105 | raise GMTInvalidInput(
|
|
0 commit comments