Move docs/ package mirror into document-navigator plugin
Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# physics
|
||||
|
||||
<!-- begin:auto-docs -->
|
||||
_(no submodules)_
|
||||
<!-- end:auto-docs -->
|
||||
## Purpose
|
||||
|
||||
A simplified equilibrium-tide model that estimates ocean-surface height from latitude, longitude, and UTC time without requiring station data, harmonic constituents, or network access. It superposes a semi-diurnal lunar (M2) and solar (S2) cosine with a latitude- and declination-dependent amplitude factor, giving a useful first-order estimate for any coordinate on Earth. The module is the engine behind `createPhysicsBasedProvider` and is the recommended fallback when no gauge data exists.
|
||||
|
||||
## Features
|
||||
|
||||
- `equilibriumTideHeight(latitude, longitude, time)` returning a metre-scale height value.
|
||||
- Latitude-modulated amplitude via `cos(lat) · cos(declination)` so polar points correctly attenuate.
|
||||
- `findEquilibriumExtremes(latitude, longitude, date, scanMinutes?)` scanning a 24-hour window for local maxima and minima.
|
||||
- Three-sample local-max/local-min detector with millimetre rounding.
|
||||
- Pure functions — no closures, no I/O, no allocation beyond the result array.
|
||||
|
||||
## Usage: Basic Example
|
||||
|
||||
```ts
|
||||
import { createPhysicsBasedProvider } from "@suaveplan/tides";
|
||||
|
||||
const provider = createPhysicsBasedProvider();
|
||||
const height = await provider.predictHeight(
|
||||
{ name: "Earth", radius: 6_371_000, rotationPeriod: 86_164 },
|
||||
{ latitude: 51.5074, longitude: -0.1278 },
|
||||
new Date("2024-06-15T12:00:00Z")
|
||||
);
|
||||
```
|
||||
|
||||
## Usage: Advanced Example
|
||||
|
||||
```ts
|
||||
import { createPhysicsBasedProvider } from "@suaveplan/tides";
|
||||
|
||||
const provider = createPhysicsBasedProvider();
|
||||
const earth = { name: "Earth", radius: 6_371_000, rotationPeriod: 86_164 };
|
||||
const coord = { latitude: 51.5074, longitude: -0.1278 };
|
||||
|
||||
const extremes = await provider.getExtremes(
|
||||
earth,
|
||||
coord,
|
||||
new Date("2024-06-15T00:00:00Z")
|
||||
);
|
||||
const highs = extremes.filter((e) => e.type === "high");
|
||||
const lows = extremes.filter((e) => e.type === "low");
|
||||
console.log(`${highs.length} highs, ${lows.length} lows`);
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
- `equilibriumTideHeight(latitude: number, _longitude: number, time: Date): number` — predicted height in metres. Longitude is unused but preserved in the signature for parity with station-based providers.
|
||||
- `findEquilibriumExtremes(latitude: number, longitude: number, date: Date, scanMinutes?: number): TideExtreme[]` — high/low water events found within the UTC day containing `date`. Default `scanMinutes` is 15.
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
The model uses J2000.0 as the reference epoch and combines two cosines (lunar at 28.984104°/h, solar at 30°/h) with a slowly varying solar declination term. It deliberately omits node factors, equilibrium arguments, and shallow-water constituents — for accurate predictions, prefer `createTiconProvider` with a real harmonic catalogue or `createAdmiraltyProvider` for UK waters. The `findEquilibriumExtremes` scanner uses a coarse three-point local-extremum test rather than bisection; when adjacent samples are equal the test rejects the candidate, so very flat sections of the curve will not produce spurious extremes. Output is rounded to millimetre precision.
|
||||
Reference in New Issue
Block a user