-
Notifications
You must be signed in to change notification settings - Fork 224
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
Add enums GridFormat for GMT grid format ID #3449
Conversation
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. |
a93272b
to
0607d68
Compare
0607d68
to
1640e6c
Compare
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 |
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. |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#:
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 <[email protected]>
Description of proposed changes
This PR is a subset of PR #3128.
This PR adds the
pygmt.enums
module 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: