Skip to content
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

Doc: Add docstrings for Python functions #11916

Open
dbaston opened this issue Mar 4, 2025 · 1 comment
Open

Doc: Add docstrings for Python functions #11916

dbaston opened this issue Mar 4, 2025 · 1 comment
Labels
documentation Issues and contributions to the documentation content enhancement python bindings

Comments

@dbaston
Copy link
Member

dbaston commented Mar 4, 2025

Feature description

Many Python functions lack API documentation, e.g. the entire multidimensional API.

Ideally, we'd have documentation and at least one example for each function (this was requested by some respondents to the 2024 user survey.)

Some of our current docstrings are are essentially a single sentence, with a reference to the corresponding C or C++ docs:

Image

Others duplicate more content from the C/C++ documentation. This brings some future maintenance burden (we could need to make same changes in multiple places) although on the whole I don't think this content changes very often.

Image

Additional context

The edit/build/review cycle for these docstrings is unfortunately rather complicated. It is documented at https://gdal.org/en/latest/development/dev_documentation.html#python-api-documentation

@dbaston dbaston added documentation Issues and contributions to the documentation content enhancement python bindings labels Mar 4, 2025
@ctoney
Copy link
Contributor

ctoney commented Mar 7, 2025

@dbaston, this is minor and I wanted to attempt an edit by PR rather than open an issue.

The edit/build/review cycle for these docstrings is unfortunately rather complicated.

In the examples under the CoordinateTransformation topic at https://gdal.org/en/latest/api/python/spatial_ref_api.html#coordinatetransformation, I believe the order of the input coordinates should be reversed for 4326, i.e., given as lat/lon instead (or add calls to SetAxisMappingStrategy()). It seems like the output coordinates are not right for 5646 in VT? And under TransformPoint() Examples:

ct = osr.CoordinateTransformation(wgs84, ps)

the ps should be changed to vt_sp.

I mention it because I was looking at those examples while troubleshooting some code and it had me confused for a bit. I started the edits for a PR but I struggled some with the edit/build/review cycle and did not complete. Will try to get there in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issues and contributions to the documentation content enhancement python bindings
Projects
None yet
Development

No branches or pull requests

2 participants