TypeScript, with a line wider than a phone
// Read a station's last hour, and keep the gusts worth an alarm.
export async function gusts(id: string, limit = 60): Promise<Reading[]> {
const res = await fetch(`/stations/${id}/readings?limit=${limit}`);
if (!res.ok) throw new Error("station " + id + " answered " + res.status + ", and its readings were left where they were");
const rows: Reading[] = await res.json();
return rows.filter((r) => r.gust >= 40 && /^RL-\d+$/.test(r.station));
}a prompt session
$ ridge sync RL-14 --since 2h
RL-14 118 readings 0 dropped
$ ridge state RL-14
RL-14 online last 09:42 battery 81%shell
for id in RL-14 RL-22; do
ridge sync "$id" --since 2h 2>&1 | tee -a "$HOME/sync.log"
doneJSON
{
"station": "RL-14",
"elevation": 2184,
"online": true,
"battery": null
}Python
@dataclass
class Reading:
station: str
gust: float = 0.0
def is_storm(self) -> bool:
return self.gust >= 40 and self.station.startswith("RL-") # km/hSQL
SELECT station, max(gust) AS peak
FROM readings
WHERE taken_at > :since
GROUP BY station
ORDER BY peak DESC;Objective-C
#import "RLStation.h"
- (BOOL)isStorm {
return [self.lastReading gust] >= 40.0;
}a diff
@@ -6,3 +6,3 @@ class Reading:
def is_storm(self) -> bool:
- return self.gust > 40
+ return self.gust >= 40Markdown
## Calibrating a vane
- Point it **north** first, then run `ridge cal`.
> A vane off by ten degrees reads [every gust](https://example.org/vanes) wrong.no language: drawn plain, never guessed
RL-14 online last 09:42 battery 81%
RL-22 maintenance last 07:15 battery 64%a language no tokenizer reads: plain, its name kept
station: RL-14
alarm:
gust: 40
unit: km/h