Uh oh!
There was an error while loading. Please reload this page.
Add enums GridFormat for GMT grid format ID - #3449
Conversation
seisman
commented
Sep 24, 2024
Ready for review although the documentation doesn't look correct. Maybe we need to follow https://github.com/rasterio/rasterio/blob/9953b28225db3b01193c94b1442d34b828d374aa/docs/api/rasterio.enums.rst. Will explore it later. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
seisman
commented
Sep 28, 2024
Still, I wouldn't say I like how the enums are documented at https://pygmt-dev--3449.org.readthedocs.build/en/3449/api/generated/pygmt.enums.GridFormat.html |
weiji14
commented
Sep 28, 2024
Do we need to have this I'm also ok with keeping it as is right now, and improving the style/layout later. It doesn't look too bad to me. |
Uh oh!
There was an error while loading. Please reload this page.
seisman
commented
Sep 28, 2024
Yes for I'll revert the changes for docs now and explore how to make it better later. I also prefer to splitting this PR into two smaller PRs, one for adding the GridFormat enums and one for fix the CF-Convention attribute, so that we can have two separate entries in the changelog. |
| These enums are defined in 'gmt_grdio.h'. | ||
| """ | ||
| UNKNOWN = 0 #: Unknown grid format |
There was a problem hiding this comment.
#: is the special way to document attributes, following https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#directive-autoproperty.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Description of proposed changes
This PR is a subset of PR #3128.
This PR adds the
pygmt.enumsmodule to defined enumerations that can be used in PyGMT. The source layout is inspired by the rasterio package (https://github.com/rasterio/rasterio/blob/main/rasterio/enums.py).Currently, only enums for GMT grid format IDs are added. They're originally defined at https://github.com/GenericMappingTools/gmt/blob/7809736ba32d87a4a96b15444419eb176c6a35f3/src/gmt_grdio.h#L70. Enums for grid registrations and gtypes are likely to be added when addressing #499 (comment).
This PR also fixes the issue originally pointed by 5888e10.
Preview: https://pygmt-dev--3449.org.readthedocs.build/en/3449/api/generated/pygmt.enums.GridFormat.html
After ea1cc79, the docs look like below:
After ac6239f, the docs look like below:
