Repository navigation
Closed
Labels
feature requestNew feature wanted
Description
This issue serves as the central place for discussing and tracking the implementation of the pygmt.grdvolume function in PyGMT. The issue will be closed when the initial implementation is complete. Progress is tracked at PyGMT: Wrapping GMT modules.
Documentation
- GMT: https://docs.generic-mapping-tools.org/dev/grdvolume.html
- GMT.jl: https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/grdvolume
- PyGMT: https://www.pygmt.org/dev/api/generated/pygmt.grdvolume.html
GMT Option Flags and Modifiers
☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.
- ☑️
-C(contour): Contour level(s) defining the integration surface; accepts a single value, a low/high/delta range, or an"r"prefix to compute the outside volume between two planes. - ⬜
-L(base_level): Integrate below the grid and above base, setting grid NaN nodes to base first. - ☑️
-R(region): Subsample the grid to this subregion before computing. - ⬜
-T(mode): Find the contour that maximises enclosed volume ("c") or the contour at the median height ("h"). - ☑️
-V(verbose): Verbosity level. : Use-X/-YFigure.shift_origininstead.- ☑️
-S(unit): Convert areas from internal square degrees to km² ("k") or miles² ("M"). - ⬜
-Z(scale): Multiply all heights by factor and optionally add shift before integration (useful for unit conversion of z-values). : Use--PAR=valuepygmt.configinstead.
Notes on Input Formats
grid: Accepts a file path orxarray.DataArray.output_type:"pandas"(default),"numpy", or"file". Use"file"together withoutfile.- The output table has four columns: contour level, area, volume, and maximum mean height (volume/area).
- When no
contouris specified, the entire grid is integrated and the contour column reports0. contourwith the"r"prefix computes the volume below the lower plane and above the upper plane (outside volume), useful for computing the volume of water between two depth contours.
Linked Pull Requests
- Initial feature implementation – Change non-ASCII quotes “ to ASCII quotes " #1130
- Add inline docstring example – Use the Ubuntu 22.04 docker image for readthedocs #2086
- Implement
-L(base_level) option - Implement
-T(mode) option for contour optimisation - Implement
-Z(scale) option for z-value scaling - Add a gallery or tutorial example (e.g., computing the volume of a seamount above a reference contour, or estimating ice-sheet volume above sea level)
Related Issues and Discussions
- Works naturally after
pygmt.grdcutto restrict the integration to a geographic sub-domain. - Commonly used together with
pygmt.grdinfoto first inspect the z-range before choosing contour levels. - The
-T(optimisation) option is particularly useful for finding the topographic divide contour that separates a basin into two drainage areas.
Metadata
Metadata
Assignees
Labels
feature requestNew feature wanted
Type
Projects
- StatusShow more project fieldsNo status
Activity