Skip to content

Commit

Permalink
✨ A read_geotiff function for reading GeoTIFF into ndarray (#3)
Browse files Browse the repository at this point in the history
* ➕ Add tiff

TIFF decoding and encoding library in pure Rust!

* ➕ Add ndarray

An n-dimensional array for general elements and for numerics!

* ➕ Add numpy

PyO3-based Rust bindings of the NumPy C-API!

* ✨ A read_geotiff function for reading GeoTIFF into ndarray

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.

* 🚩 Add pyo3 extension-module feature

Needed to prevent `error while loading shared libraries: libpython3.12.so.1.0: cannot open shared object file` error when running `cargo test`.

* ➕ Add tempfile

A library for managing temporary files and directories!

* ♻️ Refactor to allow read_geotiff Rust fn to read from buffer

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.

* ✅ Add unit test for reading a BigTIFF file

Not exactly a GeoTIFF file, but at least it's something!

* ✅ Add unit test for reading a single-band GeoTIFF file

Test reading an actual single-band float32 GeoTIFF file downloaded from the internet. Done in Python.

* ➕ Add numpy as a python dependency

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 }`.

* 💚 Install NumPy build requirements

Xref https://github.com/numpy/numpy/blob/a53b0b3777a966554add1313e22b625638282192/doc/source/building/index.rst#system-level-dependencies

* 💚 Install compilers and build libraries needed for NumPy

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.

* 💚 Install ninja-build

Try to get build dependencies to compile ninja and prevent `ERROR: Failed building wheel for ninja`.

* 📝 Add more crate and module level docs

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.
  • Loading branch information
weiji14 authored Feb 28, 2024
1 parent 856a15e commit ab83aa6
Show file tree
Hide file tree
Showing 9 changed files with 426 additions and 15 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ jobs:
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-pip
apt update
apt install -y --no-install-recommends \
gcc g++ gfortran libopenblas-dev liblapack-dev ninja-build \
pkg-config python3-pip python3-dev
pip3 install -U pip pytest
run: |
set -e
Expand Down
Loading

0 comments on commit ab83aa6

Please sign in to comment.