Skip to content

Add conditions classifiers: wind, swell and tide relative to a spot - #29

Merged
xquantize merged 1 commit into
feature/conditionsfrom
agent/conditions-classifiers-abec
Oct 14, 2026
Merged

xquantize merged 1 commit into
feature/conditionsfrom
agent/conditions-classifiers-abec

Conversation

@xquantize

Copy link
Copy Markdown
Owner

Part of Stage 3 (#21). Implements #28. Targets feature/conditions.

Pure functions that judge one aspect of conditions for a spot. No combined score yet.

  • angle_diff is the short compass step (350° and 10° are 20° apart). in_window treats an arc that crosses north, such as 330° to 60°, as one window.
  • Wind relation is measured from offshore, (facing_deg + 180) % 360. Boundaries stay with the more offshore side: 45° is offshore, 135° is cross-onshore. Strength boundaries belong to the stronger class: 5 kn is light, 25 kn is very strong. Under 5 kn, quality is glassy and relation still records the direction.
  • Swell in_window is in, marginal within 15° outside the window, or outside. Period: under 8 s windswell, 8 s to under 12 s mixed, 12 s and over groundswell. Size uses open-ocean height, not breaking-wave height: under 0.3 m flat, 0.3 m small, 0.8 m fun, 1.5 m solid, 2.5 m big.
  • Tide suits when the phase is one of best_tides, and is also rising when tide_rising_better is true. False and none do not require a falling tide. uncertain is true unless tide_confidence is agreed. A missing tide is unknown, not a failed tide.
  • A missing direction, speed, height, period or tide returns an unknown judgement and a reason, and does not raise.

Thresholds are named constants in src/swellsense/conditions/thresholds.py.

bash scripts/check.sh passed (206 tests). Against the real profiles and the Tauranga tide fixture at 08:00 NZDT on 2026-01-01: Mount Main Beach was "12 kn from 225°, offshore for a beach facing 45°", a 3 kn onshore wind was glassy, and the mid falling tide suited Mount but was uncertain. The same tide did not suit Waihi Beach, whose profile wants a rising mid.

Open in Web Open in Cursor 

Pure judgements compare a spot profile with one set of numbers. Thresholds
live in one module so they can be tuned without rewriting the rules.

Co-authored-by: Zane <xquantize@users.noreply.github.com>
@xquantize
xquantize marked this pull request as ready for review October 14, 2026 22:16
@xquantize
xquantize merged commit aa00e4a into feature/conditions Oct 14, 2026
1 check passed
@xquantize
xquantize deleted the agent/conditions-classifiers-abec branch October 27, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants