Skip to main content

Python wrapper for the libtinyhtm library.

Project description

PynyHTM

PynyHTM is a Cython based Python wrapper for libtinyhtm, the minimalistic hierarchal triangular mesh library. libtinyhtm, developed by Serge Monkewitz and Walter Landry is based on prior work from Alex Szalay, Gyorgy Fekete and Jim Gray in Searchable Sky Coverage of Astronomical Observations: Footprints and Exposures and Indexing the Sphere with the Hierarchical Triangular Mesh.

Hierarchal triangular meshes(HTM) use the sub-division of triangles, which are projected onto a sphere, to elegantly and efficiently partition the earth or the sky into regions with different identifiers.

Usage sample

The code snippets below are available in this example file. Classes SphericalCoordinate and V3 cover basic functionality for expressing points in 3D space.

from pynyhtm import HTM, SphericalCoordinate, Triangle, V3

# Retrieve HTM ID for a spherical coordinate
sc_1 = SphericalCoordinate(10.1234, -20.1234)
id = sc_1.get_htm_id(level=14)
print(f"HTM-ID for sc_1: {id} at level 14")
# >>> HTM-ID for sc_1: 3278525534 at level 14

# Convert spherical coordinate to vector
v_1 = sc_1.to_v3()

# Retrieve HTM ID for a V3 vector
v_2 = V3(0.1,0.2,0.3)
id = v_2.get_htm_id(level=3)
print(f"HTM-ID for v_2: {id} at level 3")
# >>> HTM-ID for v_2: 986 at level 3

# Conversion from vector to spherical coordinate
sc_2 = v_2.to_sc()

diff = sc_1.angle_separation(sc_2)
print(f"Angle between sc_1 and sc_2 (v2): {diff}")
# >>> Angle between sc_1 and sc_2 (v2): 78.05738774142326

Triangles, instantiated from the Triangle class provide additional information about a trixel within the HTM. They contain the three vertices which make up a Trixel as well as the center and more additional information.

# Retrieve additional information about a triangle within the HTM
triangle = Triangle.from_id(id)
print(f"This triangle is in level {triangle.level}")
# >>> This triangle is in level 3

sc_center = triangle.center.to_sc()
print(f"The center is located at {sc_center}")
# >>> The center is located at SphericalCoordinate({'_latitude': 57.03662706265828, '_longitude': 59.20954536171413})

The HTM class contains more helpers to manage HTM identifiers.

print(f"The Triangle with id {id} is located at level {HTM.get_level(id)}")
# >>> The Triangle with id 986 is located at level 3

print(f"The ID can also be expressed in it's subdivision form: {HTM.id_to_dec(id)}")
# >>> The ID can also be expressed in it's subdivision form: 23122

# Determine the children of a given triangle
children = HTM.children(id)
print(f"Children of {id}: {children}")
# >>> Children of 986: [3944, 3945, 3946, 3947]

# Determine the parent of a given id
parent = HTM.parent(id)
print(f"Parent of {id}: {parent}")
# >>> Parent of 986: 246

# Determine neighbors of a given triangle
neighbors = HTM.neighbors(id)
print(f"The neighbors of {id} are: {neighbors}")
# >>> The neighbors of 986 are: [987, 988, 1017]

# Search IDs within a circle around a given point
ids = HTM.circle_search(center=v_1, radius=0.5, level=7)
print(f"{ids} are located near center with radius 0.5")
# >>> [200104, 200105, 200106, 200107, 200108, 200134] are located near center with radius 0.5

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

pynyhtm-0.1.0.tar.gz (496.8 kB view details)

Uploaded Source

Built Distributions

pynyhtm-0.1.0-cp312-cp312-musllinux_1_2_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

pynyhtm-0.1.0-cp312-cp312-musllinux_1_2_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.2+ ARM64

pynyhtm-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (912.4 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pynyhtm-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (875.1 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

pynyhtm-0.1.0-cp311-cp311-musllinux_1_2_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

pynyhtm-0.1.0-cp311-cp311-musllinux_1_2_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.2+ ARM64

pynyhtm-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (927.7 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pynyhtm-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (901.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

pynyhtm-0.1.0-cp310-cp310-musllinux_1_2_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

pynyhtm-0.1.0-cp310-cp310-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.2+ ARM64

pynyhtm-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (847.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pynyhtm-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (818.1 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

pynyhtm-0.1.0-cp39-cp39-musllinux_1_2_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

pynyhtm-0.1.0-cp39-cp39-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.2+ ARM64

pynyhtm-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (847.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pynyhtm-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (817.7 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

pynyhtm-0.1.0-cp38-cp38-musllinux_1_2_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.8 musllinux: musl 1.2+ x86-64

pynyhtm-0.1.0-cp38-cp38-musllinux_1_2_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.8 musllinux: musl 1.2+ ARM64

pynyhtm-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (866.9 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pynyhtm-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (835.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

File details

Details for the file pynyhtm-0.1.0.tar.gz.

File metadata

  • Download URL: pynyhtm-0.1.0.tar.gz
  • Upload date:
  • Size: 496.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for pynyhtm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e9fea5ce0156b5945e0f46abec17f1c4b4d1e30f6df2f356b5688b5c315d3fb
MD5 3edb986a6b2e26b176ff18a2b2ec2c8b
BLAKE2b-256 ef34fe83e7fc4c288d97e961246582e705523a5a339c8ab80924ad6eb8e281bb

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5e54107bf0234f86af645f66a8ead95802703f3bfc76c84aea770c1e1d88f19a
MD5 fb26b27efbec45c50b512eade8063ac4
BLAKE2b-256 e1193cd386a9d8205f3a5df1249b1f9c57895bec387dba7b721642916ea74c2b

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp312-cp312-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4694e204b5821ba5a83abc7fc0e5cd583a246ed99d9bc8d0117671ff15072398
MD5 ad8e44c2f10f77fa5b7eb62537581e87
BLAKE2b-256 107770497d5c907a2f391eeb979a4bea2330db978f86577d3387f4667efa3a75

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0951510d50f51dae4bcdef11f9f3736afb59bdd78f4967e2c18111dea220db80
MD5 e4689234f1a9b28dfb3b86d8db70bf5e
BLAKE2b-256 f0e2fdb35de9083ca6ca7c3270de2cdb61f2a3e8ae5b4558ae1b3c3da1068e5c

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a0ae4bf793b5d35fb11aee6fea2aec28d16ce597d09e568743bf0a59f8a9dffc
MD5 d482eaa90b04facc124125c1a238eaf7
BLAKE2b-256 b2bcbde86ab6dad3f8c2e080014ae73523b365dc94ec00b4bee355fa56957582

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 43e404064d3c3b6291a6cea7b5a0484fe1fc00629b58d0e0f01ce29e0c47d565
MD5 65eb3238d41b753bb817d34b5b6f44b1
BLAKE2b-256 701b7bc9afbbf4ae5b95f5a0af5663246d22d69b5b8335a5571f68ef72c0a803

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp311-cp311-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp311-cp311-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 800362a4529d937fd70491d0334233e6b50ca4033b4547280083c4375f60f36e
MD5 957a57bcf222a1f55ca16f0b9478be3a
BLAKE2b-256 290506381b59db06f4589974fb742685ab967fbda9e506329603e1641b9b8760

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d1d02038ce2e7218b4b7008a10fed1711702192dc06fa5136e3860dbfa93fb66
MD5 f89248f719094114d6e42799d05b531e
BLAKE2b-256 85fb8b09c0306f70002d1a3fdd932dcc132b33d235e54925f65dbdc23aaa3844

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1d46adb5fd5cea99b64bc43cfdbc3ab47a10eaed8c5e5ea6a6ffe1cf5d3a3abe
MD5 92b1c1010623cceaa4f2320e7e93f621
BLAKE2b-256 2b1fded3aafe50fdd326f5e926e1f13d72b8dbf38d51338d368263d3c7b14080

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7607134d14d646baf8a61983e16eca219ddef0963c0b743691c7d3811bd8a345
MD5 7aaa34e94702eb83bea0cbe0e3ed516b
BLAKE2b-256 5e09088c5b36c5e6dea878912e2afb538a2ed5caa4df9a94f2d8a58a87140697

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp310-cp310-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp310-cp310-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8a3cad32ddfdea6dbe3700829f747cd0d374f3a5926482f35d4a7fd0333e5898
MD5 8b386c62b753fffeadceb0ddb1332d33
BLAKE2b-256 ac25bfeb3891b708de227d36606b85154fcc6bb0c5134deccbc1061363fded46

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 87906d3dc0f20bd7fec56f4109cd187cef2eff5b7d47f098384f4543e09046db
MD5 2211d0edf9fec966bd225dcc01ef4468
BLAKE2b-256 a578b17871f48f10ec6b5f7016e5ab28a2074cb74aed278028eb1c9b98680397

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 aca263562d55d0aaf0434f460605327dd78a71c73271fd4fbcb1f664a5c5bcb8
MD5 8c8fef26320391828f21de64496e6ec1
BLAKE2b-256 122f7d14980774835c5c5a00568b75405d74142c8be7fa4bbd81ae9ef8f5ceb7

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e909a5d6f988337f1c99938f06dfe029c77e42bdd091c10522e3d3f97a19c344
MD5 c973ba4d7ef176931feec833eabf7da9
BLAKE2b-256 e1a06d885c2c8528910207109cbc9046f473fea33c0de2a1d57183eb216f9fe0

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp39-cp39-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp39-cp39-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f1351b59f429d4c8de7575db565683610afb171b085605d98340e6553b28dc92
MD5 74c45b5c121e9d6e499f2e80ba68f213
BLAKE2b-256 61331611ccc6a6b4d0a21be4641579593c2e59fa5d827cf34b2c10f649fe2db3

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 05186d5f77090c9579fe4d48e474a3bcdcf845bdda059371526529cca8ca2eca
MD5 692761dd7e5ba591b1e163412ce7bca1
BLAKE2b-256 179fcd2e3bb0d4efa4dc714f4b0eb09d6088179c3eab449e534300874ace3ca9

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4718e84557da8ef814b6cc42118bbbede3a73d21212b862a95fdd3a400a42e52
MD5 68d834d2040645a0e9c296c88f7258a2
BLAKE2b-256 07bc73b614548380c9b9f9e55b89e9215ffc85f119b8fc43633318def901b457

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp38-cp38-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ffec7ddcfbe4654ec3b67e018d0a0f95ff27a7a3d3016e41d2a5a54902bcb757
MD5 6e89f32e5b20688b43a00fee4ddf5671
BLAKE2b-256 6a1f316231812fbb95476adeb6a7de9f5ca2a4e75c5ea6ab43785ffe63b4ef0c

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp38-cp38-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp38-cp38-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6a1b14767fc4ec7b9b13e17ff5148e0627fdd592ddecc295382dd79b005d4b8f
MD5 af022c96506ba4d7b6a2e073254dc0a6
BLAKE2b-256 d81771dfa45d873711410bb008fd8c92c2a7991857a95f1729bfb005e1a61b40

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ea8676cbb18ee7e7e33d24581a5243646814bd1594902bf523cd2d5eef555d4
MD5 04f28852b9fc23967549f444b6727573
BLAKE2b-256 6a934ac643ffcc12139d383af0b6e353de118a3eb5fe0aeb1a967d58b9bcbb2c

See more details on using hashes here.

File details

Details for the file pynyhtm-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pynyhtm-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fd8fb6921778f82243677fe67f924a77a3e1f6061511875bb7d6a2fd982dc57d
MD5 a3e45ca24d0aeca6011bd23386b0e0b2
BLAKE2b-256 3c7a1cf39fe3da8c226cc56c3eb9612724adf788bbeacb567ad2f1d7fdf59632

See more details on using hashes here.

Supported by

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