core-indexing
Use the default h3 string API for point indexing, cell inspection, hierarchy, grid navigation, edges, vertices, local IJ coordinates, measurements, and H3 index validation.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- core-indexing
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use the default h3 string API for point indexing, cell inspection, hierarchy, grid navigation, edges, vertices, local IJ coordinates, measurements, and H3 index validation.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md8.7 KB
- 参考文档references/troubleshooting.md7.7 KB
- 参考文档references/workflows.md6.7 KB
- 脚本scripts/smoke_core.py2.0 KB
03 SKILL.md 正文
Core H3 indexing
Use this route when a user needs to turn a latitude/longitude into an H3 cell,
inspect a cell or index, move through the hierarchy or neighboring grid, create
edges or vertices, use local IJ coordinates, measure spherical quantities, or
validate inputs. The public default is the h3 string API: scalar indexes are
canonical lowercase hexadecimal strings and collections are ordinary Python
lists unless a function documents an unordered result.
- Coordinate order is always
(lat, lng)(latitude first, in degrees). - H3 resolutions are integers
0..15; a larger resolution is finer. - Validate a cell/index before expensive navigation or measurement. Predicates
return
Falsefor malformed or wrong-kind values; operational functions raise an H3 exception instead of silently accepting them. - Outputs from grid, child, compact, pentagon, and edge enumerations have no guaranteed order unless stated otherwise. Compare them as sets when order is not part of the task.
- For representation, performance, NumPy/memoryview choices, or integer API calls, use api-variants; this route stays with default string behavior.
- For polygon/GeoJSON shape construction or shape-to-cells, use polygon-geospatial.
- See the root h3-py route for installation and global routing guidance.
Standard operating procedure
- Normalize the task: point(s), target resolution, cell(s), requested relation, measurement unit, and expected output shape.
- Use
latlng_to_cell(lat, lng, res)for a point, then checkis_valid_cell(cell)andget_resolution(cell). - Before hierarchy/grid calls, require cells at the intended resolution and
verify that requested parent/child resolutions are legal. For a collection,
inspect every member;
compact_cellsrequires one common resolution. - Use the smallest operation that matches the task:
grid_diskfor filled neighborhoods,grid_ringfor an exact shell,grid_path_cellsfor an ordered shortest path, andgrid_distancefor a scalar distance. - For a directed edge, confirm
are_neighbor_cells(origin, destination)or catchH3NotNeighborsError; validate the resulting edge separately. - For vertices, use
cell_to_vertexesrather than assuming six vertices; pentagons have five. For local IJ, keep one origin and the same resolution. - Measure with explicit units (
km,m,rads; areas usekm^2,m^2,rads^2) when output leaves the immediate call site. - Record the API call, resolution, coordinate order, unit, and any caught exception so a result can be reproduced without the source checkout.
Quick checks
import h3
cell = h3.latlng_to_cell(37.7752702151959, -122.418307270836, 9)
assert cell == "8928308280fffff"
assert h3.is_valid_index(cell) and h3.is_valid_cell(cell)
assert h3.get_resolution(cell) == 9
assert h3.cell_to_latlng(cell)[0] == 37.77670234943567
For a deterministic package check, run the bundled helper:
python scripts/smoke_core.py --help
python scripts/smoke_core.py check
Read api-reference.md for the supported surface, workflows.md for copyable recipes, and troubleshooting.md before retrying a failure.
Acceptance checklist
- [ ] The input uses
(lat, lng), not(lng, lat). - [ ] Every cell/edge/vertex passed to an operation has the correct kind and
passes its corresponding
is_valid_*predicate. - [ ] Resolution transitions are monotonic and within
0..15. - [ ] Grid/path operations use same-resolution cells and an affordable
k. - [ ] Collections are not accidentally supplied as one string.
- [ ] A unit is valid for the requested quantity and is stated in the result.
- [ ] Pentagon behavior is accounted for where a fixed six-neighbor or six-vertex assumption would be unsafe.
- [ ] Unordered output is normalized before comparison or serialization.
Failure recovery
H3CellInvalidError,H3IndexInvalidError, or aFalsepredicate result: stop and repair the index source; do not coerce a random hexadecimal string.H3ResDomainErrororH3ResMismatchError: inspect both resolutions and choose a parent/child target in range; grid paths and local IJ require the same resolution.H3NotNeighborsError: test adjacency and reverse the edge direction only when the requested direction is actually intended.H3FailedErrorduring distance/local IJ/path: reduce the geographic span or choose a known same-face neighborhood; the operation can be undefined or too far to compute, not evidence that the indexes are invalid.ValueErrorfor a unit: use only the documented units in api-reference.md.- Import or missing-package failures: follow the root installation route, then
rerun
smoke_core.py checkbefore diagnosing H3 data.
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).