Skip to content

RIMKEEP

check

For a rim check when you have two points and their elevations.

Width and grade come from those points. The distance is a haversine on a sphere of radius 1,737,400 m. Overlap uses the same sphere. It is not a geodesic survey.

Ok is not a road.

Install

pip install -e .
PYTHONPATH=src python -m unittest tests.test_kernel

First command

PYTHONPATH=src python -m rimkeep examples/span.csv

The rest of this file is the rule that command prints.

Record

--json prints one object. The process exit code is that object's exit. 0 is a pass word (ok, pass, scored, path). 1 is a refusal. 2 means the file could not be read. keep is false. absent is what this output does not contain: a stamp, measured basin months, and the points inside a .laz file.

This object is not WaterML and it is not a USGS response.

{
  "absent": [
    "stamp",
    "measured_months",
    "laz_points"
  ],
  "desk": "rimkeep",
  "exit": 0,
  "formula": "On the rim is not a road.",
  "keep": false,
  "rows": [
    {
      "line": "ok on_rim=false slope=1.888809177 setback=80 width=303.2335042",
      "word": "ok"
    }
  ],
  "word": "ok"
}

For a traverse planner who wants to drive a crater rim.

Owner: Digital Currensy Inc. Copyright: 2026 Digital Currensy Inc. License: Apache-2.0. The file named LICENSE is the standard license and is not edited.

What it decides

A crater-rim keep-out from on-rim, shadow setback, slope, and width. Ok is not a road. examples/span.csv computes the width as a haversine on the 1,737,400 m sphere and the slope as the grade of the two elevations over that width.

The rule

keep returns the first gate that trips, in this order:

  1. on_rim is missing → missing
  2. on_rim is true → on_rim
  3. slope, width, or PSR setback is present and negative → missing
  4. PSR setback is not missing and is under 50 m → psr
  5. slope or width is missing → missing
  6. slope is over 15 degrees → slope
  7. width is under 30 m → thin
  8. otherwise → ok

Ok is not a road. A missing on_rim, slope, or width is not ok. The line prints on_rim, slope, setback, and width next to the word. A non-finite number is missing. A missing PSR setback does not fail by itself. A negative slope, width, or setback is missing. A non-finite overlap coordinate raises ValueError ("bad number") and is not treated as separate.

Overlap

The overlap is a haversine on a 1,737,400 m sphere. It is not a surveyed control network. Disks overlap when that distance is less than the sum of the radii. A negative radius does not overlap. Ok is not a road.

Worked rows

examples/rim.csv uses the header on_rim,slope_deg,psr_m,width_m. It includes one on-rim row and one ok row. Empty fields mean missing. Worked rows are not a traverse plan and no elevation model is fetched.

Run

git clone <this repo>
cd rimkeep
PYTHONPATH=src python -m unittest tests.test_kernel
PYTHONPATH=src python -m rimkeep examples/rim.csv

Python 3.11 or newer. No third-party packages.

Copyright 2026 Digital Currensy Inc. Apache-2.0.

About

For a rim check. Computes width and grade between two points on a sphere of radius 1,737,400 m. Overlap uses the same haversine. Ok is not a road and not a surveyed centerline.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages