-
Notifications
You must be signed in to change notification settings - Fork 33
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 minimal Python bindings #53
Conversation
Thank you for all the hard work, Dan. |
Thanks for the credit @dbaston! I'm happy to see this work come into fruition. I'll find some time to review today/tomorrow in case I might have any insight for you. 🙂 |
8b4ef1b
to
045c46f
Compare
Co-authored-by: Jon Dalrymple <j_dalrym2@hotmail.com>
7beb4dc
to
4c61a9e
Compare
4c61a9e
to
6e62988
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #53 +/- ##
==========================================
+ Coverage 50.37% 50.77% +0.39%
==========================================
Files 72 72
Lines 11614 11643 +29
==========================================
+ Hits 5851 5912 +61
+ Misses 5763 5731 -32 ☔ View full report in Codecov by Sentry. |
I'm excited to have had some availability to work on the Python bindings. Talking to some users at FOSS4G-NA, I would say the enthusiasm for moving exactextract directly into the GDAL Python bindings was not universal -- there was more interest in using exactextract with other libraries like rasterio and xarray. So I decided to stick to the original plan and use pybind11. I began with the bindings put together by @jdalrym2 as a starting point and made the following changes:
Feature
)Cell
,Coordinate
, etc.)GDALRasterWrapper
, etc.) so that we do not have GDAL as a build or runtime requirementFeatureSource
andRasterSource
objects in Python. As examples, theGDALFeatureSource
andGDALRasterSource
classes use the GDAL Python bindings to read vector and raster data. You can also stick an arbitrary NumPy array into aNumPyRasterSource
and a list of GeoJSON features into aJSONFeatureSource
if you're not using GDAL. It should be straightforward to write adapters for inputs associated with other common libraries.Some components of @jdalrym2's effort are completely missing here, such as documentation and a
setup.py
configuration. There are clearly needed but I wanted to keep the scope of this PR manageable and, for documentation, I think it makes sense to let the interfaces settle down a bit first. In particular, I plan to implement support for efficiently processing multi-band rasters, like we have inexactextractr
. It's possible that this will force some C++ API changes that impact Python bindings.Because the commit history got messy, I've squashed the bindings work down to a single commit with me and @jdalrym2 as co-authors.