Skip to main content

Morton numbering and indexing for healpix grids

Project description

mortie

Tests CodSpeed codecov PyPI version Python 3.10+ CodSpeed Badge

Morty using 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, 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.

Installation

# With healpy (default HEALPix backend)
pip install mortie[healpy]

# With cdshealpix (Rust-backed, better ARM64 support)
pip install mortie[cdshealpix]

# Both backends
pip install mortie[all]

For development builds with Rust, see BUILDING.md.

HEALPix Backend

Mortie supports two HEALPix backends — healpy (C/Fortran) and cdshealpix (Rust). By default, mortie auto-detects whichever is installed (preferring cdshealpix). You can force a specific backend:

export MORTIE_HEALPIX_BACKEND=healpy      # or cdshealpix

Spatial Buffer

Mortie provides a morton_buffer function for expanding a set of morton cells by a configurable border ring. This is useful for capturing edge cells missed by sparse vertex sampling (e.g., near HEALPix pole holes).

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.

Dependencies

numpy and one of healpy or cdshealpix. The Rust-accelerated morton functions are optional — if unavailable, mortie will automatically fall back to a pure Python implementation.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mortie-0.6.1.tar.gz (15.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mortie-0.6.1-cp310-abi3-win_amd64.whl (15.1 MB view details)

Uploaded CPython 3.10+Windows x86-64

mortie-0.6.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

mortie-0.6.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (15.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

mortie-0.6.1-cp310-abi3-macosx_11_0_arm64.whl (15.0 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

mortie-0.6.1-cp310-abi3-macosx_10_12_x86_64.whl (15.1 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file mortie-0.6.1.tar.gz.

File metadata

  • Download URL: mortie-0.6.1.tar.gz
  • Upload date:
  • Size: 15.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mortie-0.6.1.tar.gz
Algorithm Hash digest
SHA256 d32738843583390a0fcce93734c68d0009d0e32dc696cadb5311e091329687d8
MD5 a8bf11a390c44e5ce75f7a747fb3ea26
BLAKE2b-256 c165e2b20dae28693ac8e0d98e1923cda3477572a2df3e45063d734e005e9628

See more details on using hashes here.

Provenance

The following attestation bundles were made for mortie-0.6.1.tar.gz:

Publisher: build-wheels.yml on espg/mortie

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mortie-0.6.1-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: mortie-0.6.1-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.7

File hashes

Hashes for mortie-0.6.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1b8da6c8df89e040e62e629b73a2a45e0d1c0c778596af2c2cd963f52b93a679
MD5 e55b7b317380697314cba5129c231666
BLAKE2b-256 20d1481ced6da4de3a011ce666785f44572bf748fca6c80c8d0dd3a671082a28

See more details on using hashes here.

Provenance

The following attestation bundles were made for mortie-0.6.1-cp310-abi3-win_amd64.whl:

Publisher: build-wheels.yml on espg/mortie

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mortie-0.6.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mortie-0.6.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d6af00650637baf94e517da65c7c714eeb645909b059fbe861f9f5301afba99b
MD5 0fc7e7c1bb130b3fe3454ae35c4bdf52
BLAKE2b-256 99911a128dc574c2881c22f2d4390958d0bae1922d4a230df99475f2aa58234d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mortie-0.6.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-wheels.yml on espg/mortie

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mortie-0.6.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mortie-0.6.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f6df34522924cb6a4d00d247ef64b608ebf2e2b4581151b1c5a2ae1a9c27bb69
MD5 706c9bca10609243f904f819462b56a5
BLAKE2b-256 cf2c28c007746a103518f922fc3d48d5bfba271f58c5d74373b6b899346e19c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mortie-0.6.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: build-wheels.yml on espg/mortie

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mortie-0.6.1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mortie-0.6.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d0cf556cd019fd17ee6850513ff972e310c7728b8752bd4f2e3a9c2bdd1c5f3
MD5 c5763c34d422b881d03e16ff3bdc9fe3
BLAKE2b-256 fbf2cec12e88040d07c7beabe69bc1b20062571a82425991f52ee6aeaa175892

See more details on using hashes here.

Provenance

The following attestation bundles were made for mortie-0.6.1-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: build-wheels.yml on espg/mortie

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mortie-0.6.1-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mortie-0.6.1-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 96fb7aaa057eb609034f84475e04bbc9bce87409380ab73d25ba8f48ad8c6347
MD5 0e9191255725fbe8b4d839f7795b00a8
BLAKE2b-256 5f763295c54fa20666111b3a38d1abc09329e52b575500651870fb0a2f02d455

See more details on using hashes here.

Provenance

The following attestation bundles were made for mortie-0.6.1-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: build-wheels.yml on espg/mortie

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page