@azohra/meteo.station 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/client/climatology.js +1 -1
- package/dist/client/history.js +3 -11
- package/dist/client/live.d.ts +2 -1
- package/dist/client/live.js +7 -4
- package/dist/client/stores.js +10 -2
- package/dist/climatology.d.ts +1 -1
- package/dist/climatology.js +1 -1
- package/dist/contract.d.ts +7 -7
- package/dist/derive.js +5 -4
- package/dist/elements/elements/TrendChartElement.js +12 -31
- package/dist/elements/elements/WindHistoryChartElement.js +12 -31
- package/dist/elements/elements/atoms.d.ts +1 -1
- package/dist/elements/lib/pinned-cursor.js +48 -0
- package/dist/fixtures.d.ts +6 -2
- package/dist/fixtures.js +30 -2
- package/dist/format.js +7 -3
- package/dist/geometry.d.ts +1 -1
- package/dist/geometry.js +21 -9
- package/dist/react/components/Dial.d.ts +1 -2
- package/dist/react/components/TrendChart.js +8 -26
- package/dist/react/components/WindHistoryChart.js +10 -29
- package/dist/react/components/WindSampleStrip.js +9 -27
- package/dist/react/hooks/useStation.js +28 -50
- package/dist/react/hooks/useStationFeed.d.ts +0 -1
- package/dist/react/index.js +2 -2
- package/dist/react/lib/use-pinned-cursor.js +32 -0
- package/dist/samples.js +7 -43
- package/dist/scene/recent-summaries.js +1 -4
- package/dist/server/adapters/windnerd.d.ts +2 -3
- package/dist/server/adapters/windnerd.js +2 -12
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -2
- package/dist/windnerd.d.ts +3 -1
- package/dist/windnerd.js +11 -1
- package/package.json +3 -3
- package/schema/README.md +2 -2
package/dist/geometry.js
CHANGED
|
@@ -28,7 +28,7 @@ function chartFrame(width) {
|
|
|
28
28
|
}
|
|
29
29
|
const DEFAULT_NICE_STEP_MPS = 5 / KMH_PER_MPS;
|
|
30
30
|
const DEFAULT_FLOOR_MPS = 10 / KMH_PER_MPS;
|
|
31
|
-
function
|
|
31
|
+
function chartScalesOf(points, frame, speedOf, options = {}) {
|
|
32
32
|
const niceStepMps = options.niceStepMps ?? DEFAULT_NICE_STEP_MPS;
|
|
33
33
|
const floorMps = options.floorMps ?? DEFAULT_FLOOR_MPS;
|
|
34
34
|
const first = points[0];
|
|
@@ -36,7 +36,7 @@ function chartScales(points, frame, options = {}) {
|
|
|
36
36
|
const last = points[points.length - 1];
|
|
37
37
|
const endMs = last ? Date.parse(last.observedAt) : startMs;
|
|
38
38
|
const durationMs = Math.max(1, endMs - startMs);
|
|
39
|
-
const top = points.reduce((max, point) => Math.max(max, point
|
|
39
|
+
const top = points.reduce((max, point) => Math.max(max, speedOf(point)), 0);
|
|
40
40
|
const scaleMax = Math.max(floorMps, Math.ceil(top / niceStepMps) * niceStepMps);
|
|
41
41
|
const xAtMs = (ms) => frame.left + (ms - startMs) / durationMs * (frame.right - frame.left);
|
|
42
42
|
return {
|
|
@@ -49,6 +49,9 @@ function chartScales(points, frame, options = {}) {
|
|
|
49
49
|
yAt: (speedMps) => frame.plotBottom - speedMps / scaleMax * (frame.plotBottom - frame.plotTop)
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
+
function chartScales(points, frame, options = {}) {
|
|
53
|
+
return chartScalesOf(points, frame, (point) => point.windGustMps ?? point.windAvgMps, options);
|
|
54
|
+
}
|
|
52
55
|
function valueScale(values, frame, options) {
|
|
53
56
|
let low = Infinity;
|
|
54
57
|
let high = -Infinity;
|
|
@@ -77,11 +80,17 @@ function bandPoints(points, scales) {
|
|
|
77
80
|
const lull = [...points].reverse().map((point) => coordinate(scales.xAt(point.observedAt), scales.yAt(point.windLullMps)));
|
|
78
81
|
return [...gust, ...lull].join(" ");
|
|
79
82
|
}
|
|
83
|
+
function tracePointsOf(points, scales, speedOf) {
|
|
84
|
+
return points.map((point) => coordinate(scales.xAt(point.observedAt), scales.yAt(speedOf(point)))).join(" ");
|
|
85
|
+
}
|
|
80
86
|
function averagePoints(points, scales) {
|
|
81
|
-
return points
|
|
87
|
+
return tracePointsOf(points, scales, (point) => point.windAvgMps);
|
|
88
|
+
}
|
|
89
|
+
function meanDirectionDegOf(points, speedOf, directionOf) {
|
|
90
|
+
return meanDirectionDeg(points.filter((point) => !isCalm(speedOf(point)) && directionOf(point) != null).map((point) => directionOf(point)));
|
|
82
91
|
}
|
|
83
92
|
function meanDirectionDeg$1(points) {
|
|
84
|
-
return
|
|
93
|
+
return meanDirectionDegOf(points, (point) => point.windAvgMps, (point) => point.windDirectionDeg);
|
|
85
94
|
}
|
|
86
95
|
function vectorMeanWind(points) {
|
|
87
96
|
if (points.length === 0) return {
|
|
@@ -102,7 +111,7 @@ function vectorMeanWind(points) {
|
|
|
102
111
|
speedMps: mean.speedMps
|
|
103
112
|
};
|
|
104
113
|
}
|
|
105
|
-
function
|
|
114
|
+
function thinVanesOf(points, speedOf, directionOf, target = 13) {
|
|
106
115
|
if (points.length === 0) return [];
|
|
107
116
|
const step = Math.max(1, Math.round(points.length / target));
|
|
108
117
|
return Array.from({ length: Math.ceil(points.length / step) }, (_, index) => {
|
|
@@ -112,14 +121,17 @@ function thinVanes(points, target = 13) {
|
|
|
112
121
|
const first = Date.parse(window[0].observedAt);
|
|
113
122
|
const last = Date.parse(window[window.length - 1].observedAt);
|
|
114
123
|
return {
|
|
115
|
-
windAvgMps: window.reduce((sum, point) => sum + point
|
|
116
|
-
windDirectionDeg:
|
|
124
|
+
windAvgMps: window.reduce((sum, point) => sum + speedOf(point), 0) / window.length,
|
|
125
|
+
windDirectionDeg: meanDirectionDegOf(window, speedOf, directionOf),
|
|
117
126
|
endIndex,
|
|
118
127
|
midMs: first + (last - first) / 2,
|
|
119
128
|
startIndex
|
|
120
129
|
};
|
|
121
130
|
});
|
|
122
131
|
}
|
|
132
|
+
function thinVanes(points, target = 13) {
|
|
133
|
+
return thinVanesOf(points, (point) => point.windAvgMps, (point) => point.windDirectionDeg, target);
|
|
134
|
+
}
|
|
123
135
|
function vanePath(cx, cy, fromBearingDeg, { reach = 7, spread = 3.2 } = {}) {
|
|
124
136
|
const angle = radians(fromBearingDeg + 180);
|
|
125
137
|
const sin = Math.sin(angle);
|
|
@@ -255,7 +267,7 @@ function filterByTimeOfDay(points, fromMinute, toMinute, utcOffsetMinutes = 0) {
|
|
|
255
267
|
});
|
|
256
268
|
}
|
|
257
269
|
/** The share of non-calm history blowing from inside the consumer's arcs;
|
|
258
|
-
* null when nothing non-calm was measured
|
|
270
|
+
* null when nothing non-calm was measured. */
|
|
259
271
|
function favorableShare(points, arcs) {
|
|
260
272
|
let blowing = 0;
|
|
261
273
|
let favorable = 0;
|
|
@@ -368,4 +380,4 @@ function compareTracePoints(comparePoints, scales, offsetDays) {
|
|
|
368
380
|
return comparePoints.map((point) => coordinate(scales.xAtMs(Date.parse(point.observedAt) + shiftMs), scales.yAt(point.windAvgMps))).join(" ");
|
|
369
381
|
}
|
|
370
382
|
//#endregion
|
|
371
|
-
export { CHART_FALLBACK_WIDTH, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, HISTORY_GAP_TOLERANCE_FACTOR, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, favorableShare, filterByMonth, filterByTimeOfDay, historyCoverage, historyGaps, isCalmHistory, meanDirectionDeg$1 as meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, stretchFrame, thinVanes, tickAnchor, trendRuns, trendSeriesPad, trendValueOf, valueScale, vanePath, vaneTicks, vectorMeanWind, windRose, windowPoints };
|
|
383
|
+
export { CHART_FALLBACK_WIDTH, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, HISTORY_GAP_TOLERANCE_FACTOR, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, chartScalesOf, compareTracePoints, compareWindow, dailyPattern, favorableShare, filterByMonth, filterByTimeOfDay, historyCoverage, historyGaps, isCalmHistory, meanDirectionDeg$1 as meanDirectionDeg, meanDirectionDegOf, measuredChartWidth, nearestIndex, speedBand, stretchFrame, thinVanes, thinVanesOf, tickAnchor, tracePointsOf, trendRuns, trendSeriesPad, trendValueOf, valueScale, vanePath, vaneTicks, vectorMeanWind, windRose, windowPoints };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Station } from "../../contract.js";
|
|
2
2
|
import { SpeedThresholds, SpeedUnit } from "../../derive.js";
|
|
3
|
-
import {
|
|
3
|
+
import { StationStringOverrides } from "../../strings.js";
|
|
4
4
|
import { FavorableDirection } from "../../instruments.js";
|
|
5
5
|
import "../../index.js";
|
|
6
6
|
//#region src/react/components/Dial.d.ts
|
|
@@ -13,7 +13,6 @@ declare function Dial({ station: stationProp, stationId, thresholds: thresholdsP
|
|
|
13
13
|
size?: number;
|
|
14
14
|
calmWord?: boolean;
|
|
15
15
|
strings?: StationStringOverrides;
|
|
16
|
-
formatTime?: FormatTime;
|
|
17
16
|
}): import("react").JSX.Element;
|
|
18
17
|
//#endregion
|
|
19
18
|
export { Dial };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
3
|
import { measuredChartWidth } from "../../geometry.js";
|
|
4
|
-
import {
|
|
4
|
+
import { readoutAriaLive } from "../../scene/chart.js";
|
|
5
5
|
import { TREND_CLASS, trendGate, trendScene } from "../../scene/trend.js";
|
|
6
6
|
import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
7
|
+
import { usePinnedCursor } from "../lib/use-pinned-cursor.js";
|
|
7
8
|
import { useEffect, useRef, useState } from "react";
|
|
8
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
//#region src/react/components/TrendChart.tsx
|
|
@@ -50,8 +51,6 @@ function TrendChart({ station: stationProp, stationId, series, strings: stringsP
|
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
function MeasuredTrend({ formatTime, history, series, stationName, width, words }) {
|
|
53
|
-
const [pinnedAt, setPinnedAt] = useState(null);
|
|
54
|
-
const [previewIndex, setPreviewIndex] = useState(null);
|
|
55
54
|
const scene = trendScene({
|
|
56
55
|
formatTime,
|
|
57
56
|
history,
|
|
@@ -60,28 +59,11 @@ function MeasuredTrend({ formatTime, history, series, stationName, width, words
|
|
|
60
59
|
width,
|
|
61
60
|
words
|
|
62
61
|
});
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const svg = hit.ownerSVGElement;
|
|
66
|
-
if (!svg) return null;
|
|
67
|
-
const bounds = svg.getBoundingClientRect();
|
|
68
|
-
return chartIndexAtClient(scene.points, scene.frame, scene.scales, clientX, bounds);
|
|
69
|
-
};
|
|
70
|
-
const handlePointerMove = (event) => {
|
|
71
|
-
if (event.pointerType === "touch") return;
|
|
72
|
-
setPreviewIndex(indexAtPoint(event.clientX, event.currentTarget));
|
|
73
|
-
};
|
|
74
|
-
const handleClick = (event) => {
|
|
75
|
-
const index = indexAtPoint(event.clientX, event.currentTarget);
|
|
76
|
-
if (index == null) return;
|
|
77
|
-
const observedAt = scene.points[index]?.observedAt;
|
|
78
|
-
if (observedAt == null) return;
|
|
79
|
-
setPinnedAt((current) => togglePinnedAt(current, observedAt));
|
|
80
|
-
setPreviewIndex(null);
|
|
81
|
-
};
|
|
62
|
+
const pinned = usePinnedCursor(scene);
|
|
63
|
+
const { readout, cursor } = scene.inspect(pinned.activeIndex);
|
|
82
64
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("output", {
|
|
83
65
|
"aria-label": scene.readout.ariaLabel,
|
|
84
|
-
"aria-live": readoutAriaLive(previewIndex),
|
|
66
|
+
"aria-live": readoutAriaLive(pinned.previewIndex),
|
|
85
67
|
className: scene.readout.className,
|
|
86
68
|
children: [/* @__PURE__ */ jsx("strong", { children: readout.strong }), /* @__PURE__ */ jsx("span", { children: readout.span })]
|
|
87
69
|
}), /* @__PURE__ */ jsxs("svg", {
|
|
@@ -137,9 +119,9 @@ function MeasuredTrend({ formatTime, history, series, stationName, width, words
|
|
|
137
119
|
className: scene.hit.className,
|
|
138
120
|
fill: scene.hit.fill,
|
|
139
121
|
height: scene.hit.height,
|
|
140
|
-
onClick: handleClick,
|
|
141
|
-
onPointerLeave:
|
|
142
|
-
onPointerMove: handlePointerMove,
|
|
122
|
+
onClick: pinned.handleClick,
|
|
123
|
+
onPointerLeave: pinned.handlePointerLeave,
|
|
124
|
+
onPointerMove: pinned.handlePointerMove,
|
|
143
125
|
width: scene.hit.width,
|
|
144
126
|
x: scene.hit.x,
|
|
145
127
|
y: scene.hit.y
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
|
-
import {
|
|
3
|
+
import { readoutAriaLive } from "../../scene/chart.js";
|
|
4
4
|
import { WIND_CHART_CLASS, windChartGate, windChartScene } from "../../scene/wind-history.js";
|
|
5
5
|
import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
6
|
+
import { usePinnedCursor } from "../lib/use-pinned-cursor.js";
|
|
6
7
|
import { Readout } from "./Readout.js";
|
|
7
8
|
import { useMeasuredChartWidth } from "../hooks/useMeasuredChartWidth.js";
|
|
8
|
-
import { useId, useRef
|
|
9
|
+
import { useId, useRef } from "react";
|
|
9
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
//#region src/react/components/WindHistoryChart.tsx
|
|
11
12
|
function WindHistoryChart({ station: stationProp, stationId, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, windowHours, compareOffsetDays, nightShading = false, strings: stringsProp, formatTime: formatTimeProp }) {
|
|
@@ -50,14 +51,11 @@ function WindHistoryChart({ station: stationProp, stationId, thresholds: thresho
|
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
function MeasuredChart({ compareOffsetDays, favorableDirections, formatTime, history, night, plotHeight, stationName, thresholds, unit, width, windowHours, words }) {
|
|
53
|
-
const hatchId = `meteo-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
54
|
-
const [pinnedAt, setPinnedAt] = useState(null);
|
|
55
|
-
const [previewIndex, setPreviewIndex] = useState(null);
|
|
56
54
|
const scene = windChartScene({
|
|
57
55
|
compareOffsetDays,
|
|
58
56
|
favorableDirections,
|
|
59
57
|
formatTime,
|
|
60
|
-
hatchId,
|
|
58
|
+
hatchId: `meteo-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`,
|
|
61
59
|
history,
|
|
62
60
|
night,
|
|
63
61
|
plotHeight,
|
|
@@ -68,28 +66,11 @@ function MeasuredChart({ compareOffsetDays, favorableDirections, formatTime, his
|
|
|
68
66
|
windowHours,
|
|
69
67
|
words
|
|
70
68
|
});
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
const svg = hit.ownerSVGElement;
|
|
74
|
-
if (!svg) return null;
|
|
75
|
-
const bounds = svg.getBoundingClientRect();
|
|
76
|
-
return chartIndexAtClient(scene.points, scene.frame, scene.scales, clientX, bounds);
|
|
77
|
-
};
|
|
78
|
-
const handlePointerMove = (event) => {
|
|
79
|
-
if (event.pointerType === "touch") return;
|
|
80
|
-
setPreviewIndex(indexAtPoint(event.clientX, event.currentTarget));
|
|
81
|
-
};
|
|
82
|
-
const handleClick = (event) => {
|
|
83
|
-
const index = indexAtPoint(event.clientX, event.currentTarget);
|
|
84
|
-
if (index == null) return;
|
|
85
|
-
const observedAt = scene.points[index]?.observedAt;
|
|
86
|
-
if (observedAt == null) return;
|
|
87
|
-
setPinnedAt((current) => togglePinnedAt(current, observedAt));
|
|
88
|
-
setPreviewIndex(null);
|
|
89
|
-
};
|
|
69
|
+
const pinned = usePinnedCursor(scene);
|
|
70
|
+
const { readout, cursor } = scene.inspect(pinned.activeIndex);
|
|
90
71
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Readout, {
|
|
91
72
|
ariaLabel: scene.readout.ariaLabel,
|
|
92
|
-
ariaLive: readoutAriaLive(previewIndex),
|
|
73
|
+
ariaLive: readoutAriaLive(pinned.previewIndex),
|
|
93
74
|
className: scene.readout.className,
|
|
94
75
|
parts: readout.span,
|
|
95
76
|
strong: readout.strong
|
|
@@ -265,9 +246,9 @@ function MeasuredChart({ compareOffsetDays, favorableDirections, formatTime, his
|
|
|
265
246
|
className: scene.hit.className,
|
|
266
247
|
fill: scene.hit.fill,
|
|
267
248
|
height: scene.hit.height,
|
|
268
|
-
onClick: handleClick,
|
|
269
|
-
onPointerLeave:
|
|
270
|
-
onPointerMove: handlePointerMove,
|
|
249
|
+
onClick: pinned.handleClick,
|
|
250
|
+
onPointerLeave: pinned.handlePointerLeave,
|
|
251
|
+
onPointerMove: pinned.handlePointerMove,
|
|
271
252
|
width: scene.hit.width,
|
|
272
253
|
x: scene.hit.x,
|
|
273
254
|
y: scene.hit.y
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
|
-
import {
|
|
3
|
+
import { readoutAriaLive } from "../../scene/chart.js";
|
|
4
4
|
import { SAMPLE_STRIP_CLASS, sampleStripGate, sampleStripScene } from "../../scene/sample-strip.js";
|
|
5
5
|
import { useStationFeedContext } from "./StationFeedProvider.js";
|
|
6
|
+
import { usePinnedCursor } from "../lib/use-pinned-cursor.js";
|
|
6
7
|
import { Readout } from "./Readout.js";
|
|
7
8
|
import { useMeasuredChartWidth } from "../hooks/useMeasuredChartWidth.js";
|
|
8
|
-
import { useRef
|
|
9
|
+
import { useRef } from "react";
|
|
9
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
//#region src/react/components/WindSampleStrip.tsx
|
|
11
12
|
function WindSampleStrip({ samples, stationName, unit: unitProp, favorableDirections: favorableDirectionsProp, plotHeight, strings: stringsProp, formatTime: formatTimeProp }) {
|
|
@@ -39,8 +40,6 @@ function WindSampleStrip({ samples, stationName, unit: unitProp, favorableDirect
|
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
function MeasuredStrip({ favorableDirections, formatTime, plotHeight, samples, stationName, unit, width, words }) {
|
|
42
|
-
const [pinnedAt, setPinnedAt] = useState(null);
|
|
43
|
-
const [previewIndex, setPreviewIndex] = useState(null);
|
|
44
43
|
const scene = sampleStripScene({
|
|
45
44
|
favorableDirections,
|
|
46
45
|
formatTime,
|
|
@@ -51,28 +50,11 @@ function MeasuredStrip({ favorableDirections, formatTime, plotHeight, samples, s
|
|
|
51
50
|
width,
|
|
52
51
|
words
|
|
53
52
|
});
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const svg = hit.ownerSVGElement;
|
|
57
|
-
if (!svg) return null;
|
|
58
|
-
const bounds = svg.getBoundingClientRect();
|
|
59
|
-
return chartIndexAtClient(scene.points, scene.frame, scene.scales, clientX, bounds);
|
|
60
|
-
};
|
|
61
|
-
const handlePointerMove = (event) => {
|
|
62
|
-
if (event.pointerType === "touch") return;
|
|
63
|
-
setPreviewIndex(indexAtPoint(event.clientX, event.currentTarget));
|
|
64
|
-
};
|
|
65
|
-
const handleClick = (event) => {
|
|
66
|
-
const index = indexAtPoint(event.clientX, event.currentTarget);
|
|
67
|
-
if (index == null) return;
|
|
68
|
-
const observedAt = scene.points[index]?.observedAt;
|
|
69
|
-
if (observedAt == null) return;
|
|
70
|
-
setPinnedAt((current) => togglePinnedAt(current, observedAt));
|
|
71
|
-
setPreviewIndex(null);
|
|
72
|
-
};
|
|
53
|
+
const pinned = usePinnedCursor(scene);
|
|
54
|
+
const { readout, cursor } = scene.inspect(pinned.activeIndex);
|
|
73
55
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Readout, {
|
|
74
56
|
ariaLabel: scene.readout.ariaLabel,
|
|
75
|
-
ariaLive: readoutAriaLive(previewIndex),
|
|
57
|
+
ariaLive: readoutAriaLive(pinned.previewIndex),
|
|
76
58
|
className: scene.readout.className,
|
|
77
59
|
parts: readout.span,
|
|
78
60
|
strong: readout.strong
|
|
@@ -181,9 +163,9 @@ function MeasuredStrip({ favorableDirections, formatTime, plotHeight, samples, s
|
|
|
181
163
|
className: scene.hit.className,
|
|
182
164
|
fill: scene.hit.fill,
|
|
183
165
|
height: scene.hit.height,
|
|
184
|
-
onClick: handleClick,
|
|
185
|
-
onPointerLeave:
|
|
186
|
-
onPointerMove: handlePointerMove,
|
|
166
|
+
onClick: pinned.handleClick,
|
|
167
|
+
onPointerLeave: pinned.handlePointerLeave,
|
|
168
|
+
onPointerMove: pinned.handlePointerMove,
|
|
187
169
|
width: scene.hit.width,
|
|
188
170
|
x: scene.hit.x,
|
|
189
171
|
y: scene.hit.y
|
|
@@ -1,61 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useStationCurrent } from "./useStationCurrent.js";
|
|
5
|
-
import { useStationFeed } from "./useStationFeed.js";
|
|
6
|
-
import { useStationLive } from "./useStationLive.js";
|
|
7
|
-
import { useCallback, useMemo } from "react";
|
|
2
|
+
import { createStationStore } from "../../client/stores.js";
|
|
3
|
+
import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
|
|
8
4
|
//#region src/react/hooks/useStation.ts
|
|
9
5
|
function useStation(url, stationId, options = {}) {
|
|
10
6
|
const { pollSeconds, currentPollSeconds, enabled = true, fetchInit, initialData } = options;
|
|
11
7
|
const live = options.live === true;
|
|
12
|
-
const
|
|
8
|
+
const fetchInitRef = useRef(fetchInit);
|
|
9
|
+
fetchInitRef.current = fetchInit;
|
|
10
|
+
const initialRef = useRef(initialData);
|
|
11
|
+
const mountUrlRef = useRef(url);
|
|
12
|
+
const store = useMemo(() => createStationStore(url, stationId, {
|
|
13
13
|
...pollSeconds != null ? { pollSeconds } : {},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
...
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
enabled: enabled && live,
|
|
25
|
-
...fetchInit != null ? { fetchInit } : {}
|
|
26
|
-
});
|
|
27
|
-
const liveCurrent = useMemo(() => live ? liveSnapshotToCurrent({
|
|
28
|
-
station: liveResult.station,
|
|
29
|
-
servedAt: liveResult.servedAt,
|
|
30
|
-
samples: liveResult.samples
|
|
31
|
-
}) : null, [
|
|
32
|
-
live,
|
|
33
|
-
liveResult.station,
|
|
34
|
-
liveResult.servedAt,
|
|
35
|
-
liveResult.samples
|
|
14
|
+
...currentPollSeconds != null ? { currentPollSeconds } : {},
|
|
15
|
+
fetchInit: () => fetchInitRef.current,
|
|
16
|
+
...url === mountUrlRef.current && initialRef.current != null ? { initialData: initialRef.current } : {},
|
|
17
|
+
live
|
|
18
|
+
}), [
|
|
19
|
+
url,
|
|
20
|
+
stationId,
|
|
21
|
+
pollSeconds,
|
|
22
|
+
currentPollSeconds,
|
|
23
|
+
live
|
|
36
24
|
]);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
current,
|
|
44
|
-
currentReceivedAtMs
|
|
45
|
-
]);
|
|
46
|
-
const station = merged.feed?.stations.find((entry) => entry.id === stationId) ?? null;
|
|
47
|
-
const feedRefresh = feedResult.refresh;
|
|
48
|
-
const currentRefresh = currentResult.refresh;
|
|
49
|
-
const refresh = useCallback(() => {
|
|
50
|
-
feedRefresh();
|
|
51
|
-
currentRefresh();
|
|
52
|
-
}, [feedRefresh, currentRefresh]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!enabled) return;
|
|
27
|
+
store.start();
|
|
28
|
+
return () => store.stop();
|
|
29
|
+
}, [store, enabled]);
|
|
30
|
+
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
53
31
|
return {
|
|
54
|
-
feed:
|
|
55
|
-
station,
|
|
56
|
-
receivedAtMs:
|
|
57
|
-
error:
|
|
58
|
-
refresh
|
|
32
|
+
feed: snapshot.feed,
|
|
33
|
+
station: snapshot.station,
|
|
34
|
+
receivedAtMs: snapshot.receivedAtMs,
|
|
35
|
+
error: snapshot.error,
|
|
36
|
+
refresh: () => store.refresh()
|
|
59
37
|
};
|
|
60
38
|
}
|
|
61
39
|
//#endregion
|
package/dist/react/index.js
CHANGED
|
@@ -24,9 +24,9 @@ import { useMeasuredChartWidth } from "./hooks/useMeasuredChartWidth.js";
|
|
|
24
24
|
import { WindHistoryChart } from "./components/WindHistoryChart.js";
|
|
25
25
|
import { WindSampleStrip } from "./components/WindSampleStrip.js";
|
|
26
26
|
import { StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary } from "./components/StationCard.js";
|
|
27
|
+
import { useStation } from "./hooks/useStation.js";
|
|
28
|
+
import { useStationClimatology } from "./hooks/useStationClimatology.js";
|
|
27
29
|
import { useStationCurrent } from "./hooks/useStationCurrent.js";
|
|
28
30
|
import { useStationFeed } from "./hooks/useStationFeed.js";
|
|
29
31
|
import { useStationLive } from "./hooks/useStationLive.js";
|
|
30
|
-
import { useStation } from "./hooks/useStation.js";
|
|
31
|
-
import { useStationClimatology } from "./hooks/useStationClimatology.js";
|
|
32
32
|
export { AirExtremes, AirMatrix, BandChip, ClimatologyDailyPattern, ClimatologyRose, CompassFan, CurrentConditions, DailyPattern, Dial, Direction, FavorableShare, FreshnessBadge, Gust, Lull, Pressure, Readout, RecentSummaries, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, StationFeedProvider, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, WindSampleStrip, useFreshness, useMeasuredChartWidth, useStation, useStationClimatology, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { activeChartIndex, chartIndexAtClient, togglePinnedAt } from "../../scene/chart.js";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
//#region src/react/lib/use-pinned-cursor.ts
|
|
5
|
+
function usePinnedCursor(scene) {
|
|
6
|
+
const [pinnedAt, setPinnedAt] = useState(null);
|
|
7
|
+
const [previewIndex, setPreviewIndex] = useState(null);
|
|
8
|
+
const indexAtPoint = (clientX, hit) => {
|
|
9
|
+
const svg = hit.ownerSVGElement;
|
|
10
|
+
if (!svg) return null;
|
|
11
|
+
return chartIndexAtClient(scene.points, scene.frame, scene.scales, clientX, svg.getBoundingClientRect());
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
activeIndex: activeChartIndex(scene.points, pinnedAt, previewIndex),
|
|
15
|
+
previewIndex,
|
|
16
|
+
handleClick: (event) => {
|
|
17
|
+
const index = indexAtPoint(event.clientX, event.currentTarget);
|
|
18
|
+
if (index == null) return;
|
|
19
|
+
const observedAt = scene.points[index]?.observedAt;
|
|
20
|
+
if (observedAt == null) return;
|
|
21
|
+
setPinnedAt((current) => togglePinnedAt(current, observedAt));
|
|
22
|
+
setPreviewIndex(null);
|
|
23
|
+
},
|
|
24
|
+
handlePointerLeave: () => setPreviewIndex(null),
|
|
25
|
+
handlePointerMove: (event) => {
|
|
26
|
+
if (event.pointerType === "touch") return;
|
|
27
|
+
setPreviewIndex(indexAtPoint(event.clientX, event.currentTarget));
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { usePinnedCursor };
|
package/dist/samples.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HISTORY_GAP_TOLERANCE_FACTOR } from "./geometry.js";
|
|
3
|
-
import { meanDirectionDeg } from "@azohra/meteo.core";
|
|
1
|
+
import { HISTORY_GAP_TOLERANCE_FACTOR, chartScalesOf, meanDirectionDegOf, thinVanesOf, tracePointsOf } from "./geometry.js";
|
|
4
2
|
//#region src/samples.ts
|
|
3
|
+
const speedOf = (sample) => sample.windMps;
|
|
4
|
+
const directionOf = (sample) => sample.windDirectionDeg;
|
|
5
5
|
const SAMPLE_GAP_TOLERANCE_FACTOR = HISTORY_GAP_TOLERANCE_FACTOR;
|
|
6
|
-
const DEFAULT_NICE_STEP_MPS = 5 / KMH_PER_MPS;
|
|
7
|
-
const DEFAULT_FLOOR_MPS = 10 / KMH_PER_MPS;
|
|
8
6
|
function sampleRuns(samples, toleranceFactor = SAMPLE_GAP_TOLERANCE_FACTOR) {
|
|
9
7
|
const limitMs = samples.intervalSeconds * 1e3 * toleranceFactor;
|
|
10
8
|
const runs = [];
|
|
@@ -19,50 +17,16 @@ function sampleRuns(samples, toleranceFactor = SAMPLE_GAP_TOLERANCE_FACTOR) {
|
|
|
19
17
|
return runs;
|
|
20
18
|
}
|
|
21
19
|
function sampleScales(samples, frame, options = {}) {
|
|
22
|
-
|
|
23
|
-
const floorMps = options.floorMps ?? DEFAULT_FLOOR_MPS;
|
|
24
|
-
const points = samples.points;
|
|
25
|
-
const first = points[0];
|
|
26
|
-
const startMs = first ? Date.parse(first.observedAt) : 0;
|
|
27
|
-
const last = points[points.length - 1];
|
|
28
|
-
const endMs = last ? Date.parse(last.observedAt) : startMs;
|
|
29
|
-
const durationMs = Math.max(1, endMs - startMs);
|
|
30
|
-
const top = points.reduce((max, sample) => Math.max(max, sample.windMps), 0);
|
|
31
|
-
const scaleMax = Math.max(floorMps, Math.ceil(top / niceStepMps) * niceStepMps);
|
|
32
|
-
const xAtMs = (ms) => frame.left + (ms - startMs) / durationMs * (frame.right - frame.left);
|
|
33
|
-
return {
|
|
34
|
-
startMs,
|
|
35
|
-
endMs,
|
|
36
|
-
durationMs,
|
|
37
|
-
scaleMax,
|
|
38
|
-
xAtMs,
|
|
39
|
-
xAt: (observedAt) => xAtMs(Date.parse(observedAt)),
|
|
40
|
-
yAt: (speedMps) => frame.plotBottom - speedMps / scaleMax * (frame.plotBottom - frame.plotTop)
|
|
41
|
-
};
|
|
20
|
+
return chartScalesOf(samples.points, frame, speedOf, options);
|
|
42
21
|
}
|
|
43
22
|
function samplePoints(run, scales) {
|
|
44
|
-
return run
|
|
23
|
+
return tracePointsOf(run, scales, speedOf);
|
|
45
24
|
}
|
|
46
25
|
function sampleMeanDirectionDeg(samples) {
|
|
47
|
-
return
|
|
26
|
+
return meanDirectionDegOf(samples, speedOf, directionOf);
|
|
48
27
|
}
|
|
49
28
|
function thinSampleVanes(samples, target = 13) {
|
|
50
|
-
|
|
51
|
-
const step = Math.max(1, Math.round(samples.length / target));
|
|
52
|
-
return Array.from({ length: Math.ceil(samples.length / step) }, (_, index) => {
|
|
53
|
-
const startIndex = index * step;
|
|
54
|
-
const endIndex = startIndex + step;
|
|
55
|
-
const window = samples.slice(startIndex, endIndex);
|
|
56
|
-
const first = Date.parse(window[0].observedAt);
|
|
57
|
-
const last = Date.parse(window[window.length - 1].observedAt);
|
|
58
|
-
return {
|
|
59
|
-
windAvgMps: window.reduce((sum, sample) => sum + sample.windMps, 0) / window.length,
|
|
60
|
-
windDirectionDeg: sampleMeanDirectionDeg(window),
|
|
61
|
-
endIndex,
|
|
62
|
-
midMs: first + (last - first) / 2,
|
|
63
|
-
startIndex
|
|
64
|
-
};
|
|
65
|
-
});
|
|
29
|
+
return thinVanesOf(samples, speedOf, directionOf, target);
|
|
66
30
|
}
|
|
67
31
|
function samplesSummary(samples) {
|
|
68
32
|
const points = samples.points;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { vectorMeanWind } from "../geometry.js";
|
|
2
1
|
import { optionalSpeed, roundSpeed } from "../format.js";
|
|
3
2
|
import { inDirectionArcs } from "@azohra/meteo.core";
|
|
4
3
|
//#region src/scene/recent-summaries.ts
|
|
@@ -29,7 +28,6 @@ function recentSummariesScene(input) {
|
|
|
29
28
|
const avgMps = points.length === 0 ? null : points.reduce((sum, point) => sum + point.windAvgMps, 0) / points.length;
|
|
30
29
|
const gusts = points.map((point) => point.windGustMps).filter((gust) => gust != null);
|
|
31
30
|
const lulls = points.map((point) => point.windLullMps).filter((lull) => lull != null);
|
|
32
|
-
const mean = vectorMeanWind(points);
|
|
33
31
|
return {
|
|
34
32
|
key: block.windowMinutes,
|
|
35
33
|
className: "meteo-recent-summary",
|
|
@@ -65,8 +63,7 @@ function recentSummariesScene(input) {
|
|
|
65
63
|
className: `meteo-recent-summary-ghost${verdict}`,
|
|
66
64
|
deg: point.windDirectionDeg
|
|
67
65
|
}];
|
|
68
|
-
})
|
|
69
|
-
meanDirectionDeg: mean.windDirectionDeg
|
|
66
|
+
})
|
|
70
67
|
};
|
|
71
68
|
})
|
|
72
69
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { History, HistoryPoint, LiveSamples, Reading, RecentSummary, StationMeta, StationTelemetry } from "../../contract.js";
|
|
2
|
+
import { WindnerdRecordPeriodMinutes } from "../../windnerd.js";
|
|
2
3
|
import "../environment.js";
|
|
3
4
|
import { WindnerdStationConfig } from "../config.js";
|
|
4
5
|
import { StationAdapter, StationAdapterOptions } from "../adapter.js";
|
|
5
6
|
import { DirectionArc } from "@azohra/meteo.core";
|
|
6
7
|
//#region src/server/adapters/windnerd.d.ts
|
|
7
|
-
declare const WINDNERD_RECORD_PERIODS_MINUTES: readonly [1, 5, 10, 15, 30, 60, 180, 360];
|
|
8
|
-
type WindnerdRecordPeriodMinutes = (typeof WINDNERD_RECORD_PERIODS_MINUTES)[number];
|
|
9
8
|
declare const WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS = 3;
|
|
10
9
|
type WindnerdAdapterOptions = StationAdapterOptions & {
|
|
11
10
|
recordsUrl?: string;
|
|
@@ -94,4 +93,4 @@ declare function windnerdLiveSamples(records: WindnerdLiveSampleRecord[]): LiveS
|
|
|
94
93
|
declare function windnerdEnrichedMeta(config: Pick<WindnerdStationConfig, "latitude" | "longitude" | "timeZone" | "elevationM">, location: WindnerdLiveLocation | null, broadcastDelaySeconds: number | null): Partial<StationMeta>;
|
|
95
94
|
declare function parseWindnerdRecords(value: string, locationId: number, hasPressure?: boolean): WindnerdRecords;
|
|
96
95
|
//#endregion
|
|
97
|
-
export { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS,
|
|
96
|
+
export { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, WindnerdAdapterOptions, WindnerdHistoryQuery, WindnerdLiveDigest, WindnerdLiveInit, WindnerdLiveLocation, WindnerdLiveSampleRecord, WindnerdRecords, loadWindnerdHistory, loadWindnerdStation, parseStandardTimeOffset, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveLocation, parseWindnerdLiveSampleRecords, parseWindnerdRecentSummaries, parseWindnerdRecords, windnerdEnrichedMeta, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { emptyConditions } from "../../contract.js";
|
|
2
2
|
import { isCalm, normalizeDegrees, pressureTendency, seaLevelPressureHpa } from "../../derive.js";
|
|
3
|
-
import { windnerdStationUrl } from "../../windnerd.js";
|
|
3
|
+
import { WINDNERD_RECORD_PERIODS_MINUTES, windnerdStationUrl } from "../../windnerd.js";
|
|
4
4
|
import { sseEvents } from "../../sse.js";
|
|
5
5
|
import { coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, resolveEnvironment } from "../environment.js";
|
|
6
6
|
import { defineStationAdapter } from "../adapter.js";
|
|
@@ -9,16 +9,6 @@ import { UpstreamError } from "@azohra/meteo.core";
|
|
|
9
9
|
const WINDNERD_RECORDS_URL = "https://windnerd.net/api/records";
|
|
10
10
|
const WINDNERD_LIVE_URL = "https://windnerd.net/api/live-url";
|
|
11
11
|
const RECORD_PERIOD_MINUTES = 1;
|
|
12
|
-
const WINDNERD_RECORD_PERIODS_MINUTES = [
|
|
13
|
-
1,
|
|
14
|
-
5,
|
|
15
|
-
10,
|
|
16
|
-
15,
|
|
17
|
-
30,
|
|
18
|
-
60,
|
|
19
|
-
180,
|
|
20
|
-
360
|
|
21
|
-
];
|
|
22
12
|
const CACHE_TTL_SECONDS = 60;
|
|
23
13
|
const AGGREGATE_CACHE_TTL_SECONDS = 900;
|
|
24
14
|
const LIVE_CACHE_TTL_SECONDS = 15;
|
|
@@ -495,4 +485,4 @@ function isRecord(value) {
|
|
|
495
485
|
return typeof value === "object" && value !== null;
|
|
496
486
|
}
|
|
497
487
|
//#endregion
|
|
498
|
-
export { WINDNERD_LIVE_INIT_TIMEOUT_MS, WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, WINDNERD_RECORDS_URL,
|
|
488
|
+
export { WINDNERD_LIVE_INIT_TIMEOUT_MS, WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, WINDNERD_RECORDS_URL, loadWindnerdHistory, loadWindnerdLocation, loadWindnerdStation, parseStandardTimeOffset, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveLocation, parseWindnerdLiveSampleRecords, parseWindnerdRecentSummaries, parseWindnerdRecords, windnerdEnrichedMeta, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl, windnerdStationMeta };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
|
|
1
|
+
import { WINDNERD_RECORD_PERIODS_MINUTES, WindnerdRecordPeriodMinutes, normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
|
|
2
2
|
import { DEFAULT_USER_AGENT, FeedCache, LogEvent, LogEventCode, ResolvedEnvironment, ServerEnvironment, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError, UpstreamErrorReason, UpstreamFailureReason, UpstreamStreamRequest, UpstreamTextRequest, boundedResponseText, coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError, workersCache } from "./environment.js";
|
|
3
3
|
import { CampbellStationConfig, CustomStationConfig, CustomStationContext, CustomStationIdentity, CustomStationLoader, EcowittStationConfig, StationConfig, StationConfigInput, TempestStationConfig, WindnerdStationConfig, campbellStationConfigSchema, customStationConfigSchema, ecowittStationConfigSchema, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema } from "./config.js";
|
|
4
4
|
import { StationAdapter, StationAdapterContext, StationAdapterDefinition, StationAdapterMode, StationAdapterOptions, StationAdapterResult, defineStationAdapter } from "./adapter.js";
|
|
@@ -7,7 +7,7 @@ import { StationFeedHandler, StationFeedHandlerOptions, StationFeedHandlerRoute,
|
|
|
7
7
|
import { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse } from "./live.js";
|
|
8
8
|
import { WindnerdLiveOptions, openWindnerdLive } from "./adapters/windnerd-live.js";
|
|
9
9
|
import { CLIMATOLOGY_DEFAULT_SECTOR_COUNT, CLIMATOLOGY_DEFAULT_YEARS, CLIMATOLOGY_RECORD_PERIOD_MINUTES, WindnerdClimatologyOptions, loadWindnerdClimatology } from "./adapters/windnerd-climatology.js";
|
|
10
|
-
import { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS,
|
|
10
|
+
import { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, WindnerdAdapterOptions, WindnerdHistoryQuery, WindnerdLiveDigest, WindnerdLiveInit, WindnerdLiveLocation, WindnerdLiveSampleRecord, WindnerdRecords, loadWindnerdHistory, loadWindnerdStation, parseStandardTimeOffset, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveLocation, parseWindnerdLiveSampleRecords, parseWindnerdRecentSummaries, parseWindnerdRecords, windnerdEnrichedMeta, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl } from "./adapters/windnerd.js";
|
|
11
11
|
import { HOLOGRAM_API_BASE, HologramConnectivityConfig, HologramConnectivityOptions, TRIAL_HOLOGRAM_CACHE_TTL_SECONDS, hologramConnectivityConfigSchema, hologramServiceState, hologramTimeToIso, loadHologramConnectivity, parseHologramConnectivity } from "./hologram.js";
|
|
12
12
|
import { TempestAdapterOptions, TempestObservation, loadTempestStation, parseTempestWind } from "./adapters/tempest.js";
|
|
13
13
|
import { EcowittAdapterOptions, EcowittObservation, loadEcowittStation, parseEcowittRealTime } from "./adapters/ecowitt.js";
|
package/dist/server/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
|
|
1
|
+
import { WINDNERD_RECORD_PERIODS_MINUTES, normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
|
|
2
2
|
import { DEFAULT_USER_AGENT, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError, boundedResponseText, coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError, workersCache } from "./environment.js";
|
|
3
3
|
import { campbellStationConfigSchema, customStationConfigSchema, ecowittStationConfigSchema, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema } from "./config.js";
|
|
4
4
|
import { CAMPBELL_FIELD_CONTRACTS, loadCampbellCurrent, loadCampbellStation, naiveLocalToIso, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable } from "./adapters/campbell.js";
|
|
5
5
|
import { loadEcowittStation, parseEcowittRealTime } from "./adapters/ecowitt.js";
|
|
6
6
|
import { loadTempestStation, parseTempestWind } from "./adapters/tempest.js";
|
|
7
|
-
import { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS,
|
|
7
|
+
import { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, loadWindnerdHistory, loadWindnerdStation, parseStandardTimeOffset, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveLocation, parseWindnerdLiveSampleRecords, parseWindnerdRecentSummaries, parseWindnerdRecords, windnerdEnrichedMeta, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl } from "./adapters/windnerd.js";
|
|
8
8
|
import { CLIMATOLOGY_DEFAULT_SECTOR_COUNT, CLIMATOLOGY_DEFAULT_YEARS, CLIMATOLOGY_RECORD_PERIOD_MINUTES, loadWindnerdClimatology } from "./adapters/windnerd-climatology.js";
|
|
9
9
|
import { openWindnerdLive } from "./adapters/windnerd-live.js";
|
|
10
10
|
import { DEFAULT_HISTORY_HOURS, StationClimatologyUnsupportedError, StationHistoryUnsupportedError, StationLiveUnsupportedError, UnknownStationError, assembleStations, loadStationClimatology, loadStationCurrent, loadStationFeed, loadStationHistory, openStationLive } from "./feed.js";
|