h3-py
Use Uber's h3 Python bindings for hierarchical hexagonal geospatial indexing, cell/grid/edge operations, polygon and GeoJSON conversion, and string/integer/NumPy API selection.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- h3-py
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Uber's h3 Python bindings for hierarchical hexagonal geospatial indexing, cell/grid/edge operations, polygon and GeoJSON conversion, and string/integer/NumPy API selection.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/installation.md1.9 KB
- 参考文档references/repo-provenance.md1.7 KB
- 参考文档references/repo-routing-metadata.json308 B
- 参考文档references/troubleshooting.md3.5 KB
- 脚本scripts/check_h3_environment.py2.4 KB
03 SKILL.md 正文
h3-py
Use this skill when a task needs H3 geospatial indexing from Python: map a latitude/longitude to a cell, inspect or navigate cells, measure spherical quantities, index polygons, convert GeoJSON-like objects, or choose between H3's string, integer, memoryview, and NumPy interfaces.
Install and verify
The public distribution is h3 and requires Python 3.10 or newer. It has no
runtime dependency for the default string or memoryview APIs:
python -m pip install h3
python -c "import h3; print(h3.versions())"
Install the optional NumPy API explicitly when downstream code needs
h3.api.numpy_int:
python -m pip install 'h3[numpy]'
For a fuller deterministic check, run the bundled helper check_h3_environment.py. Read installation.md for source-build, version, and optional-dependency details. Read troubleshooting.md before treating an import or input error as an H3 algorithm failure.
Route the task
- Point, cell, hierarchy, grid, measurement, edge, vertex, or local-IJ work: read core-indexing.
- Polygon, hole, multipolygon, GeoJSON,
__geo_interface__, or CRS work: read polygon-geospatial. - String versus integer indexes, NumPy arrays, memoryview buffers, conversions, or API performance trade-offs: read api-variants.
A task can use multiple routes. For example, index a polygon with
polygon-geospatial, then use core-indexing to inspect or compact the
returned cells; choose api-variants only at a representation boundary.
Shared operating contract
- Treat geographic pairs as
(lat, lng)in degrees for H3 calls. GeoJSON positions are(lng, lat)and must be swapped exactly once at the boundary. - Make the resolution explicit. H3 resolutions are integers
0..15; larger values represent finer cells. - Validate the kind of every index before passing it to an operation. A cell, directed edge, and vertex are different H3 index types.
- Do not assume enumeration order. Normalize unordered cell, edge, vertex, or pentagon results before comparison or serialization.
- Record package version, API variant, resolution, coordinate order, units, and containment mode when a result must be reproducible.
- Keep the original repository out of runtime workflows; use only the references and safe helpers bundled in this skill.
High-value entry points
h3.latlng_to_cell(lat, lng, res)creates a cell from a point.h3.cell_to_latlng,cell_to_boundary,cell_area, andgreat_circle_distancerecover geometry or measurements.h3.cell_to_parent,cell_to_children,compact_cells, anduncompact_cellshandle hierarchy.h3.grid_disk,grid_ring,grid_distance, andgrid_path_cellshandle neighborhood and path operations.h3.LatLngPoly,h3.h3shape_to_cells,h3.geo_to_cells, andh3.cells_to_geohandle polygon workflows.h3.versions()reports the Python wrapper and wrapped C library versions; their major and minor versions should match.
The route-specific references contain signatures, output types, recipes, and failure recovery. Do not infer a missing argument or unit from a neighboring H3 language binding.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).