Skip to main content

majortom

PyPI - Version PyPI - Python Version


An implementation of the ESA Major Tom Grid.

The hot path (generate_grid_cells, cell_from_id, migrate_cell_id) is implemented in Rust via majortom-rs and exposed through a PyO3 extension (majortom_eg._native). The public Python API (shapely polygons, generators) is unchanged.

Installation

Pre-built wheels (manylinux / macOS / Windows):

pip install majortom_eg

From a source checkout (requires a Rust toolchain). Clone or symlink majortom-rs to vendor/majortom-rs:

mkdir -p vendor
ln -sfn ../../majortom-rs vendor/majortom-rs   # sibling checkout under ../majortom-rs
uv sync
uv run maturin develop --release

Usage

import shapely.geometry
from shapely.io import to_geojson
from majortom_eg import MajorTomGrid, GridCell

# generate an overlapping grid with cells of 320m square
grid = MajorTomGrid(d=320, overlap=True)

# polygon 1/10 of a degree square
my_aoi = shapely.geometry.Polygon(((0., 0.), (0., 0.1), (0.1, 0.1), (0.1, 0.), (0., 0.)))

# iterate of cells returned from generator
for cell in grid.generate_grid_cells(my_aoi):
    # do something with cells
    print(f'cell id is {cell.id()}')
    print(f'cell geom is {to_geojson(cell.geom)}')

Performance

Benchmarks in benches/grid_bench.py (same AOIs as majortom-rs), after switching the core to Rust (shapely polygons are built lazily on .geom access):

AOI Cells (overlap) Pure Python (before) Rust-backed Python
Southampton 225 ~7.1 ms ~0.15 ms (~45×)
1° × 1° Maryland 187,626 ~5.7 s ~135 ms (~40×)
cell_from_id ~315 µs ~0.5 µs

Raw Rust (majortom-rs criterion) is still faster (~12 ms for the 1° case) because it never crosses the FFI / Python object boundary; the wrap is the right default for Python callers.

uv run python benches/grid_bench.py

License

majortom is distributed under the terms of the MIT license.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

majortom_eg-1.1.0-cp38-abi3-win_amd64.whl (203.5 kB view details)

Uploaded CPython 3.8+Windows x86-64

majortom_eg-1.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (366.1 kB view details)

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

majortom_eg-1.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (364.2 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

majortom_eg-1.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (626.5 kB view details)

Uploaded CPython 3.8+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file majortom_eg-1.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: majortom_eg-1.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 203.5 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for majortom_eg-1.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 739a45d4c5c5535967770c40f780e76970ce6c7f1c9ed25b33a18e3d4d9607dc
MD5 e810df110ffd159e4e6a1726431537a1
BLAKE2b-256 6c40ec14ef173eb9b9b77b0fa0ab0c038bdfb24c02a79624c89801e72a8e5e88

See more details on using hashes here.

Provenance

The following attestation bundles were made for majortom_eg-1.1.0-cp38-abi3-win_amd64.whl:

Publisher: publish.yaml on earth-genome/majortom

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

File details

Details for the file majortom_eg-1.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for majortom_eg-1.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 47f351cbef08ce57be85448dbe37d4d7954082eafa894aadac9103f7382cad81
MD5 a8dfaf5df4456d26630c4cbcc77fc590
BLAKE2b-256 b1969a8181e0725cffaacb12e38e81f2844168b37c3671f7947af11ae396c462

See more details on using hashes here.

Provenance

The following attestation bundles were made for majortom_eg-1.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yaml on earth-genome/majortom

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

File details

Details for the file majortom_eg-1.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for majortom_eg-1.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 78ed76ba96495734a3f91bd7d637fbd3f7e5aa895260a294dbc066f480c5da1b
MD5 c2fbad818d45ff2dc12f185b304b9dcd
BLAKE2b-256 c3316a49811b6df824440fc3f4caff88af626959c493b327c5ebda023af1dec5

See more details on using hashes here.

Provenance

The following attestation bundles were made for majortom_eg-1.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yaml on earth-genome/majortom

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

File details

Details for the file majortom_eg-1.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for majortom_eg-1.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 9792b11c77579e16d709199920c8f164bd323275300f7b80f57988702faec4e5
MD5 1745c7f5f88e6b44d627b460ffad7df0
BLAKE2b-256 d650e08ba7778f413bde3f15510bf68caf677155d03dadf437dbd0d2442765d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for majortom_eg-1.1.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: publish.yaml on earth-genome/majortom

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

Release history Release notifications | RSS feed

This release

1.1.0 This release

4 files

1.0.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page