-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Implement PyCogReader struct with new and to_numpy methods (#12)
* ✨ Implement PyCogReader struct with new and data methods A (Py)CogReader class for Python that wraps around the CogReader struct! Have implemented the new (i.e. __init__) and data methods, and used them in the read_geotiff_py function. Needed to set CogReader struct visibility to pub(crate). Renamed vec_data to array_data since they contain arrays, not Vec. Also updated the regex match for one of the unit tests. * 📝 Add Python docstrings for CogReader class and methods Numpydoc style docstrings for the CogReader class and .data method. Included some example code on how to use the class and methods to read a sample GeoTIFF too. * ✅ Add unit test for CogReader's data method Ensure that the `.data()` method returns a numpy.ndarray output with the correct shape and values. * 🚚 Rename data method as to_numpy Originally went with `.data()` to match https://docs.xarray.dev/en/v2024.02.0/generated/xarray.DataArray.data.html, but realized that xarray's `.data` is a property, not a method. Now going with `.to_numpy()` instead, following what's used by xarray, pandas and pyarrow.
- Loading branch information
Showing
4 changed files
with
100 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters