-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
✨ A read_geotiff function for reading GeoTIFF into ndarray #3
Conversation
TIFF decoding and encoding library in pure Rust!
An n-dimensional array for general elements and for numerics!
PyO3-based Rust bindings of the NumPy C-API!
Rust-based function for reading GeoTIFF files! Uses the `tiff` crate for the I/O, `ndarray` crate to store the 2D array in Rust, and `numpy` crate to convert to numpy.ndarray in Python.
Needed to prevent `error while loading shared libraries: libpython3.12.so.1.0: cannot open shared object file` error when running `cargo test`.
A library for managing temporary files and directories!
Allow passing anything that implements Read + Seek into the `read_geotiff` function, such as in-memory stream buffer. The `read_geotiff_py` function still accepts an &str reference to a filepath.
Not exactly a GeoTIFF file, but at least it's something!
Test reading an actual single-band float32 GeoTIFF file downloaded from the internet. Done in Python.
NumPy is the fundamental package for array computing with Python! Setting minimum pin of 1.23 following SPEC 0. Prevent error like `pyo3_runtime.PanicException: Failed to access NumPy array API capsule: PyErr { type: <class 'ModuleNotFoundError'>, value: ModuleNotFoundError("No module named 'numpy'"), traceback: None }`.
.github/workflows/ci.yml
Outdated
@@ -57,6 +57,7 @@ jobs: | |||
install: | | |||
apt-get update | |||
apt-get install -y --no-install-recommends python3 python3-pip | |||
apt build-dep numpy |
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.
Original error on s390x
build at https://github.com/weiji14/cog3pio/actions/runs/8071580043/job/22051501437#step:7:410 before this line was added:
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
+ /usr/bin/python3 /tmp/pip-install-6l_88pqi/numpy_281cd73ebd0a445c8bd7bbbb7479992b/vendored-meson/meson/meson.py setup /tmp/pip-install-6l_88pqi/numpy_281cd73ebd0a445c8bd7bbbb7479992b /tmp/pip-install-6l_88pqi/numpy_281cd73ebd0a445c8bd7bbbb7479992b/.mesonpy-q6jzljl7 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/tmp/pip-install-6l_88pqi/numpy_281cd73ebd0a445c8bd7bbbb7479992b/.mesonpy-q6jzljl7/meson-python-native-file.ini
The Meson build system
Version: 1.2.99
Source dir: /tmp/pip-install-6l_88pqi/numpy_281cd73ebd0a445c8bd7bbbb7479992b
Build dir: /tmp/pip-install-6l_88pqi/numpy_281cd73ebd0a445c8bd7bbbb7479992b/.mesonpy-q6jzljl7
Build type: native build
Project name: NumPy
Project version: 1.26.4
../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"
A full log can be found at /tmp/pip-install-6l_88pqi/numpy_281cd73ebd0a445c8bd7bbbb7479992b/.mesonpy-q6jzljl7/meson-logs/meson-log.txt
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
25h::error::The process '/home/runner/work/_actions/uraimo/run-on-arch-action/517085f0367c8256bcfa753e3e13e1550af09954/src/run-on-arch.sh' failed with exit code 1
So at b54ab26, I added this apt build-dep numpy
line following https://numpy.org/devdocs/building/#system-level-dependencies, but got E: You must put some 'deb-src' URIs in your sources.list
at https://github.com/weiji14/cog3pio/actions/runs/8071955898/job/22052723659?pr=3#step:7:330.
Maybe best to just install the compilers individually instead of messing with /etc/apt/sources.list
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.
Manually specifying GCC and other build libraries to install with `apt` instead of using `apt build-dep numpy`, following https://numpy.org/devdocs/building/#system-level-dependencies.
Try to get build dependencies to compile ninja and prevent `ERROR: Failed building wheel for ninja`.
Add a title/heading for the crate docs, and some extra descriptions on what the crate does. Added the missing_doc lint to warn when docs are missing. Also improved docs on the module level, and made some minor rustfmt fixes.
Rust-based function for reading GeoTIFF files!
Uses the
tiff
crate for the I/O,ndarray
crate to store the 2D array in Rust, andnumpy
crate to convert to numpy.ndarray in Python.Note: This only works on single-band GeoTIFF files with float32 dtype for now
Usage:
In Rust:
In Python:
TODO:
TODO in future:
References: