Morton numbering and indexing for healpix grids
Project description
mortie
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.
Performance
Mortie uses Rust-accelerated morton indexing functions for high performance. The Rust implementation provides dramatic speedups:
| Dataset Size | Rust | Python (reference) | 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. The Rust extension is required and is included in all pip-installed wheels.
Installation
pip install mortie
For development builds with Rust, see BUILDING.md.
Spatial Buffer
Mortie provides a morton_buffer function for expanding a set of morton cells by a configurable border ring. This is useful for... well, buffering.
import numpy as np
import mortie
# Convert coordinates to morton cells at order 6
cells = np.unique(mortie.geo2mort(lats, lons, order=6))
# Expand by 1-cell ring (8-connected neighbors)
border = mortie.morton_buffer(cells, k=1)
expanded = np.union1d(cells, border)
All input indices must be at the same order. The function returns only the new border cells, not the input cells themselves.
Polygon Coverage
morton_coverage computes the set of morton indices that completely cover a polygon defined by lat/lon vertices. The algorithm builds a contiguous boundary via great-circle interpolation, classifies inner/outer buffer cells using connected components + point-in-polygon testing, then recursively fills the interior.
import mortie
# Define polygon vertices (lat, lon in degrees)
lats = [40.0, 40.0, 50.0, 50.0]
lons = [-125.0, -115.0, -115.0, -125.0]
# Get all morton cells covering the polygon at order 6
cells = mortie.morton_coverage(lats, lons, order=6)
The function handles concave polygons, antimeridian-crossing polygons, and polar regions. Polygon 'donut' holes are not yet supported.
Dependencies
numpy. All HEALPix operations use the Rust-native healpix crate bundled in the compiled extension — no external HEALPix library is needed.
Funding
Initial funding of this work was supported by the ICESat-2 project science office, at the Laboratory for Cryospheric Sciences (NASA Goddard, Section 615).
References
[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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mortie-0.6.5.tar.gz.
File metadata
- Download URL: mortie-0.6.5.tar.gz
- Upload date:
- Size: 16.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f6196b5708321718fffbc455b3ec108e3b541d084a98c1e2981d5e75f2947a8
|
|
| MD5 |
485d671746de40a898142c3b68dbe501
|
|
| BLAKE2b-256 |
792c766bc28bd7706647bc827b8a0b8b90cab38299ede064ba32bd8e0df1b5ad
|
Provenance
The following attestation bundles were made for mortie-0.6.5.tar.gz:
Publisher:
build-wheels.yml on espg/mortie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mortie-0.6.5.tar.gz -
Subject digest:
3f6196b5708321718fffbc455b3ec108e3b541d084a98c1e2981d5e75f2947a8 - Sigstore transparency entry: 1312152648
- Sigstore integration time:
-
Permalink:
espg/mortie@86683a0f58390f984decec5d0c61083189aeda70 -
Branch / Tag:
refs/tags/0.6.5 - Owner: https://github.com/espg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-wheels.yml@86683a0f58390f984decec5d0c61083189aeda70 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mortie-0.6.5-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: mortie-0.6.5-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 15.1 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d8396272c977e47b1f184f0876b7f19183a9eb47787db023b5b77c70f3d4823
|
|
| MD5 |
03dfd29d58e231b654733defe535029a
|
|
| BLAKE2b-256 |
c8f27f14f83aff5e8ad61376fe8d4cbd978852c22c04306cb5b00cc07016b2bc
|
Provenance
The following attestation bundles were made for mortie-0.6.5-cp310-abi3-win_amd64.whl:
Publisher:
build-wheels.yml on espg/mortie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mortie-0.6.5-cp310-abi3-win_amd64.whl -
Subject digest:
1d8396272c977e47b1f184f0876b7f19183a9eb47787db023b5b77c70f3d4823 - Sigstore transparency entry: 1312153316
- Sigstore integration time:
-
Permalink:
espg/mortie@86683a0f58390f984decec5d0c61083189aeda70 -
Branch / Tag:
refs/tags/0.6.5 - Owner: https://github.com/espg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-wheels.yml@86683a0f58390f984decec5d0c61083189aeda70 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mortie-0.6.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: mortie-0.6.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 15.1 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcf781912e06ebb3a756e47a137aef71997f6fe73e14d5661f7747099a8b6042
|
|
| MD5 |
c4abfb6e20c5ac5aaa38ea512a70d503
|
|
| BLAKE2b-256 |
016a9c2e59f8ab5d4b43c5aed87e2965b6d43fb233f9a2082e66ab4be21a7638
|
Provenance
The following attestation bundles were made for mortie-0.6.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
build-wheels.yml on espg/mortie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mortie-0.6.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
dcf781912e06ebb3a756e47a137aef71997f6fe73e14d5661f7747099a8b6042 - Sigstore transparency entry: 1312152797
- Sigstore integration time:
-
Permalink:
espg/mortie@86683a0f58390f984decec5d0c61083189aeda70 -
Branch / Tag:
refs/tags/0.6.5 - Owner: https://github.com/espg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-wheels.yml@86683a0f58390f984decec5d0c61083189aeda70 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mortie-0.6.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: mortie-0.6.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 15.1 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49ca4af7d60e4bf7ecda19db19a625b53fddd402282f566eb093a379c7720aec
|
|
| MD5 |
535c28ee546449b20854edcb184c0440
|
|
| BLAKE2b-256 |
a762e92f508811632bcd7be29344de2725b56eb3b0bd9b18e62ee25f815ed9f7
|
Provenance
The following attestation bundles were made for mortie-0.6.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
build-wheels.yml on espg/mortie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mortie-0.6.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
49ca4af7d60e4bf7ecda19db19a625b53fddd402282f566eb093a379c7720aec - Sigstore transparency entry: 1312152915
- Sigstore integration time:
-
Permalink:
espg/mortie@86683a0f58390f984decec5d0c61083189aeda70 -
Branch / Tag:
refs/tags/0.6.5 - Owner: https://github.com/espg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-wheels.yml@86683a0f58390f984decec5d0c61083189aeda70 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mortie-0.6.5-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: mortie-0.6.5-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 15.1 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e76c579d44c2d3ab051edb28cddb61e8b4a5758e86d092b16a24cc23715cb373
|
|
| MD5 |
d015c77a952d6c00ec50c04415cee79b
|
|
| BLAKE2b-256 |
7a64d3768d051526af3a2317e5023f623a0249f635a034f01f3f0e7e2dbbbd58
|
Provenance
The following attestation bundles were made for mortie-0.6.5-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
build-wheels.yml on espg/mortie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mortie-0.6.5-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
e76c579d44c2d3ab051edb28cddb61e8b4a5758e86d092b16a24cc23715cb373 - Sigstore transparency entry: 1312153165
- Sigstore integration time:
-
Permalink:
espg/mortie@86683a0f58390f984decec5d0c61083189aeda70 -
Branch / Tag:
refs/tags/0.6.5 - Owner: https://github.com/espg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-wheels.yml@86683a0f58390f984decec5d0c61083189aeda70 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mortie-0.6.5-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: mortie-0.6.5-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 15.1 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10bd755a1ad4d77375332c6b7c326ad35c3bfb1a33ef56316e520eb423c71976
|
|
| MD5 |
591ad18ed4c5451d3e4f2c93ba921891
|
|
| BLAKE2b-256 |
6874b022463559c8a49023c91ada68ca45e3aa0ca21ae9d572004fe907a97840
|
Provenance
The following attestation bundles were made for mortie-0.6.5-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
build-wheels.yml on espg/mortie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mortie-0.6.5-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
10bd755a1ad4d77375332c6b7c326ad35c3bfb1a33ef56316e520eb423c71976 - Sigstore transparency entry: 1312153035
- Sigstore integration time:
-
Permalink:
espg/mortie@86683a0f58390f984decec5d0c61083189aeda70 -
Branch / Tag:
refs/tags/0.6.5 - Owner: https://github.com/espg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-wheels.yml@86683a0f58390f984decec5d0c61083189aeda70 -
Trigger Event:
push
-
Statement type: