Mortie is a library for applying morton indexing to healpix grids. Morton numbering (also called z-ordering) facilitates several geospatial operators such as buffering and neighborhood look-ups, and can generally be thought of as a type of geohashing.
This particular implementation focuses on hierarchical healpix maps, and is mostly inspired from this paper.
Mortie uses Rust-accelerated morton indexing functions for high performance, with an automatic fallback to pure Python if Rust is unavailable. The Rust implementation provides dramatic speedups:
| Dataset Size | Rust | Pure Python | Speedup |
|---|---|---|---|
| 1,000 values | 1.93 ms | 4.14 ms | 2.1x |
| 100,000 values | 1.85 ms | 410.59 ms | 222x |
| 1.2M coordinates | 102.51 ms | 5.1 sec | 50x |
Pre-built wheels are available for Linux, macOS, and Windows. If a wheel is unavailable for your platform, mortie will automatically use the pure Python fallback.
pip install mortieFor development builds with Rust, see BUILDING.md.
TODO:
- add paper reference
- add funding information
- add tests
- remove / prune dead code
- add example(s)
- fix north / south bug
- remove numba dependency
- update documentation
- publish to pypi
Dependencies are numpy and healpy. The Rust-accelerated functions are optional - if unavailable, mortie will automatically fall back to a pure Python implementation. Although not a dependency, there are several functions that have been written to interface with the vaex project.
Initial funding of this work was supported by the ICESat-2 project science office, at the Laboratory for Cryospheric Sciences (NASA Goddard, Section 615).
[1] Youngren, Robert W., and Mikel D. Petty. "A multi-resolution HEALPix data structure for spherically mapped point data." Heliyon 3.6 (2017): e00332. doi: 10.1016/j.heliyon.2017.e00332
