@azohra/meteo.station 0.3.1 → 0.5.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/dist/client/climatology.d.ts +27 -0
- package/dist/client/climatology.js +83 -0
- package/dist/client/history.d.ts +47 -0
- package/dist/client/history.js +112 -0
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.js +3 -1
- package/dist/client/live.js +15 -0
- package/dist/climatology.d.ts +66 -0
- package/dist/climatology.js +230 -0
- package/dist/contract-climatology.d.ts +73 -0
- package/dist/contract-climatology.js +52 -0
- package/dist/contract.d.ts +234 -1
- package/dist/contract.js +52 -4
- package/dist/derive.d.ts +23 -1
- package/dist/derive.js +43 -4
- package/dist/display.d.ts +4 -0
- package/dist/display.js +2 -1
- package/dist/elements/elements/AirExtremesElement.d.ts +8 -0
- package/dist/elements/elements/AirExtremesElement.js +33 -0
- package/dist/elements/elements/ClimatologyDailyPatternElement.d.ts +15 -0
- package/dist/elements/elements/ClimatologyDailyPatternElement.js +84 -0
- package/dist/elements/elements/ClimatologyRoseElement.d.ts +14 -0
- package/dist/elements/elements/ClimatologyRoseElement.js +51 -0
- package/dist/elements/elements/CompassFanElement.d.ts +14 -0
- package/dist/elements/elements/CompassFanElement.js +92 -0
- package/dist/elements/elements/DailyPatternElement.d.ts +1 -0
- package/dist/elements/elements/DailyPatternElement.js +24 -16
- package/dist/elements/elements/DialElement.js +14 -3
- package/dist/elements/elements/FavorableShareElement.d.ts +14 -0
- package/dist/elements/elements/FavorableShareElement.js +47 -0
- package/dist/elements/elements/RecentSummariesElement.d.ts +14 -0
- package/dist/elements/elements/RecentSummariesElement.js +54 -0
- package/dist/elements/elements/StationFeedElement.d.ts +3 -0
- package/dist/elements/elements/StationFeedElement.js +13 -2
- package/dist/elements/elements/WindHistoryChartElement.js +20 -7
- package/dist/elements/elements/WindRoseElement.d.ts +1 -3
- package/dist/elements/elements/WindRoseElement.js +60 -62
- package/dist/elements/elements/atoms.js +3 -3
- package/dist/elements/index.d.ts +13 -1
- package/dist/elements/index.js +15 -3
- package/dist/elements/lib/ambient.d.ts +2 -0
- package/dist/elements/lib/attributes.js +24 -1
- package/dist/elements/lib/base.d.ts +3 -0
- package/dist/elements/lib/base.js +14 -2
- package/dist/endpoints.d.ts +7 -1
- package/dist/endpoints.js +13 -1
- package/dist/geometry.d.ts +23 -4
- package/dist/geometry.js +44 -13
- package/dist/index.d.ts +8 -6
- package/dist/index.js +8 -6
- package/dist/instruments.d.ts +7 -5
- package/dist/instruments.js +20 -7
- package/dist/merge-current.js +2 -1
- package/dist/react/components/AirExtremes.d.ts +16 -0
- package/dist/react/components/AirExtremes.js +38 -0
- package/dist/react/components/ClimatologyDailyPattern.d.ts +20 -0
- package/dist/react/components/ClimatologyDailyPattern.js +59 -0
- package/dist/react/components/ClimatologyRose.d.ts +18 -0
- package/dist/react/components/ClimatologyRose.js +45 -0
- package/dist/react/components/CompassFan.d.ts +17 -0
- package/dist/react/components/CompassFan.js +93 -0
- package/dist/react/components/DailyPattern.d.ts +4 -1
- package/dist/react/components/DailyPattern.js +15 -8
- package/dist/react/components/Dial.d.ts +3 -1
- package/dist/react/components/Dial.js +13 -2
- package/dist/react/components/FavorableShare.d.ts +14 -0
- package/dist/react/components/FavorableShare.js +43 -0
- package/dist/react/components/RecentSummaries.d.ts +18 -0
- package/dist/react/components/RecentSummaries.js +64 -0
- package/dist/react/components/StationFeedProvider.d.ts +4 -1
- package/dist/react/components/StationFeedProvider.js +5 -3
- package/dist/react/components/WindHistoryChart.d.ts +6 -1
- package/dist/react/components/WindHistoryChart.js +20 -5
- package/dist/react/components/WindRose.d.ts +4 -2
- package/dist/react/components/WindRose.js +80 -71
- package/dist/react/components/WindSampleStrip.d.ts +3 -1
- package/dist/react/components/WindSampleStrip.js +8 -5
- package/dist/react/components/atoms.d.ts +4 -1
- package/dist/react/components/atoms.js +6 -3
- package/dist/react/hooks/useStationClimatology.d.ts +18 -0
- package/dist/react/hooks/useStationClimatology.js +25 -0
- package/dist/react/index.d.ts +10 -3
- package/dist/react/index.js +9 -2
- package/dist/scene/air-extremes.d.ts +2 -0
- package/dist/scene/air-extremes.js +42 -0
- package/dist/scene/atoms.d.ts +2 -1
- package/dist/scene/atoms.js +6 -4
- package/dist/scene/climatology-pattern.d.ts +6 -0
- package/dist/scene/climatology-pattern.js +35 -0
- package/dist/scene/climatology-rose.d.ts +5 -0
- package/dist/scene/climatology-rose.js +49 -0
- package/dist/scene/compass-fan.d.ts +3 -0
- package/dist/scene/compass-fan.js +115 -0
- package/dist/scene/daily-pattern.d.ts +1 -0
- package/dist/scene/daily-pattern.js +21 -7
- package/dist/scene/dial.d.ts +1 -0
- package/dist/scene/dial.js +16 -3
- package/dist/scene/favorable-share.d.ts +3 -0
- package/dist/scene/favorable-share.js +41 -0
- package/dist/scene/index.d.ts +9 -3
- package/dist/scene/recent-summaries.d.ts +4 -0
- package/dist/scene/recent-summaries.js +75 -0
- package/dist/scene/rose.d.ts +2 -1
- package/dist/scene/rose.js +18 -3
- package/dist/scene/sample-strip.d.ts +1 -0
- package/dist/scene/sample-strip.js +1 -1
- package/dist/scene/trend.js +2 -7
- package/dist/scene/wind-history.d.ts +1 -0
- package/dist/scene/wind-history.js +4 -3
- package/dist/scene/wind-plot.d.ts +1 -0
- package/dist/scene/wind-plot.js +44 -9
- package/dist/server/adapter.d.ts +2 -1
- package/dist/server/adapter.js +2 -1
- package/dist/server/adapters/windnerd-climatology.d.ts +30 -0
- package/dist/server/adapters/windnerd-climatology.js +82 -0
- package/dist/server/adapters/windnerd-live.d.ts +5 -8
- package/dist/server/adapters/windnerd-live.js +26 -21
- package/dist/server/adapters/windnerd.d.ts +31 -4
- package/dist/server/adapters/windnerd.js +196 -19
- package/dist/server/environment.d.ts +4 -10
- package/dist/server/environment.js +4 -10
- package/dist/server/feed.d.ts +44 -2
- package/dist/server/feed.js +63 -2
- package/dist/server/handler.d.ts +11 -1
- package/dist/server/handler.js +83 -2
- package/dist/server/index.d.ts +4 -3
- package/dist/server/index.js +4 -3
- package/dist/strings.d.ts +13 -1
- package/dist/strings.js +13 -1
- package/package.json +2 -2
- package/schema/example-climatology.json +86 -0
- package/schema/example-history.json +38 -0
- package/schema/stationclimatology.schema.json +221 -0
- package/schema/stationcurrent.schema.json +173 -0
- package/schema/stationfeed.schema.json +173 -0
- package/schema/stationhistory.schema.json +186 -0
- package/schema/stationlive.schema.json +202 -0
- package/styles.css +232 -19
package/dist/elements/index.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { BandChipElement, DirectionElement, GustElement, LullElement, PressureElement, SpeedElement, TemperatureElement, UpdatedAtElement } from "./elements/atoms.js";
|
|
2
|
+
import { AirExtremesElement } from "./elements/AirExtremesElement.js";
|
|
2
3
|
import { AirMatrixElement } from "./elements/AirMatrixElement.js";
|
|
4
|
+
import { DailyPatternElement } from "./elements/DailyPatternElement.js";
|
|
5
|
+
import { ClimatologyDailyPatternElement } from "./elements/ClimatologyDailyPatternElement.js";
|
|
6
|
+
import { CompassFanElement } from "./elements/CompassFanElement.js";
|
|
7
|
+
import { RecentSummariesElement } from "./elements/RecentSummariesElement.js";
|
|
8
|
+
import { WindRoseElement } from "./elements/WindRoseElement.js";
|
|
9
|
+
import { ClimatologyRoseElement } from "./elements/ClimatologyRoseElement.js";
|
|
3
10
|
import { DialElement } from "./elements/DialElement.js";
|
|
4
11
|
import { CurrentConditionsElement } from "./elements/CurrentConditionsElement.js";
|
|
5
|
-
import {
|
|
12
|
+
import { FavorableShareElement } from "./elements/FavorableShareElement.js";
|
|
6
13
|
import { FreshnessBadgeElement } from "./elements/FreshnessBadgeElement.js";
|
|
7
14
|
import { SparklineElement } from "./elements/SparklineElement.js";
|
|
8
15
|
import { StationFeedElement } from "./elements/StationFeedElement.js";
|
|
@@ -11,22 +18,27 @@ import { StationTableElement } from "./elements/StationTableElement.js";
|
|
|
11
18
|
import { TrendChartElement } from "./elements/TrendChartElement.js";
|
|
12
19
|
import { WindArrowElement } from "./elements/WindArrowElement.js";
|
|
13
20
|
import { WindHistoryChartElement } from "./elements/WindHistoryChartElement.js";
|
|
14
|
-
import { WindRoseElement } from "./elements/WindRoseElement.js";
|
|
15
21
|
import { StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement } from "./elements/StationCardElement.js";
|
|
16
22
|
//#region src/elements/index.ts
|
|
17
23
|
const meteoElementTags = {
|
|
18
24
|
"meteo-station-feed": StationFeedElement,
|
|
19
25
|
"meteo-station-card": StationCardElement,
|
|
26
|
+
"meteo-air-extremes": AirExtremesElement,
|
|
20
27
|
"meteo-air-matrix": AirMatrixElement,
|
|
21
28
|
"meteo-band-chip": BandChipElement,
|
|
29
|
+
"meteo-compass-fan": CompassFanElement,
|
|
30
|
+
"meteo-climatology-daily-pattern": ClimatologyDailyPatternElement,
|
|
31
|
+
"meteo-climatology-rose": ClimatologyRoseElement,
|
|
22
32
|
"meteo-current-conditions": CurrentConditionsElement,
|
|
23
33
|
"meteo-daily-pattern": DailyPatternElement,
|
|
24
34
|
"meteo-dial": DialElement,
|
|
25
35
|
"meteo-direction": DirectionElement,
|
|
36
|
+
"meteo-favorable-share": FavorableShareElement,
|
|
26
37
|
"meteo-freshness-badge": FreshnessBadgeElement,
|
|
27
38
|
"meteo-gust": GustElement,
|
|
28
39
|
"meteo-lull": LullElement,
|
|
29
40
|
"meteo-pressure": PressureElement,
|
|
41
|
+
"meteo-recent-summaries": RecentSummariesElement,
|
|
30
42
|
"meteo-sparkline": SparklineElement,
|
|
31
43
|
"meteo-speed": SpeedElement,
|
|
32
44
|
"meteo-station-strip": StationStripElement,
|
|
@@ -54,4 +66,4 @@ function defineMeteoElements(registry = customElements) {
|
|
|
54
66
|
}
|
|
55
67
|
}
|
|
56
68
|
//#endregion
|
|
57
|
-
export { AirMatrixElement, BandChipElement, CurrentConditionsElement, DailyPatternElement, DialElement, DirectionElement, FreshnessBadgeElement, GustElement, LullElement, PressureElement, SparklineElement, SpeedElement, StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement, StationFeedElement, StationStripElement, StationTableElement, TemperatureElement, TrendChartElement, UpdatedAtElement, WindArrowElement, WindHistoryChartElement, WindRoseElement, defineMeteoElements, meteoElementTags };
|
|
69
|
+
export { AirExtremesElement, AirMatrixElement, BandChipElement, ClimatologyDailyPatternElement, ClimatologyRoseElement, CompassFanElement, CurrentConditionsElement, DailyPatternElement, DialElement, DirectionElement, FavorableShareElement, FreshnessBadgeElement, GustElement, LullElement, PressureElement, RecentSummariesElement, SparklineElement, SpeedElement, StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement, StationFeedElement, StationStripElement, StationTableElement, TemperatureElement, TrendChartElement, UpdatedAtElement, WindArrowElement, WindHistoryChartElement, WindRoseElement, defineMeteoElements, meteoElementTags };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StationFeed } from "../../contract.js";
|
|
2
2
|
import { SpeedThresholds, SpeedUnit } from "../../derive.js";
|
|
3
3
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
4
|
+
import { FavorableDirection } from "../../instruments.js";
|
|
4
5
|
import "../../index.js";
|
|
5
6
|
//#region src/elements/lib/ambient.d.ts
|
|
6
7
|
type AmbientStationFeed = {
|
|
@@ -10,6 +11,7 @@ type AmbientStationFeed = {
|
|
|
10
11
|
unit: SpeedUnit | undefined;
|
|
11
12
|
formatTime: FormatTime | undefined;
|
|
12
13
|
thresholds: SpeedThresholds | undefined;
|
|
14
|
+
favorableDirections: FavorableDirection[] | undefined;
|
|
13
15
|
};
|
|
14
16
|
//#endregion
|
|
15
17
|
export { AmbientStationFeed };
|
|
@@ -17,5 +17,28 @@ function parseThresholdsAttribute(value) {
|
|
|
17
17
|
} catch {}
|
|
18
18
|
console.warn(`meteo: invalid thresholds attribute ${JSON.stringify(value)} — expected '{"unit":"kmh","values":[12,20,28]}' or "none"; treating as absent.`);
|
|
19
19
|
}
|
|
20
|
+
function parseIntegerListAttribute(value, name, minimum, maximum) {
|
|
21
|
+
if (value == null || value.trim() === "") return void 0;
|
|
22
|
+
try {
|
|
23
|
+
const parsed = JSON.parse(value);
|
|
24
|
+
if (Array.isArray(parsed) && parsed.every((entry) => typeof entry === "number" && Number.isInteger(entry) && entry >= minimum && entry <= maximum)) return parsed;
|
|
25
|
+
} catch {}
|
|
26
|
+
console.warn(`meteo: invalid ${name} attribute ${JSON.stringify(value)} — expected a JSON list of integers in [${minimum}, ${maximum}]; treating as absent.`);
|
|
27
|
+
}
|
|
28
|
+
function parseMonthsAttribute(value) {
|
|
29
|
+
return parseIntegerListAttribute(value, "months", 1, 12);
|
|
30
|
+
}
|
|
31
|
+
function parseSlotsAttribute(value) {
|
|
32
|
+
return parseIntegerListAttribute(value, "slots", 0, 1439);
|
|
33
|
+
}
|
|
34
|
+
function parseArcsAttribute(value) {
|
|
35
|
+
if (value == null) return void 0;
|
|
36
|
+
if (value.trim() === "none") return null;
|
|
37
|
+
try {
|
|
38
|
+
const parsed = JSON.parse(value);
|
|
39
|
+
if (Array.isArray(parsed) && parsed.every((arc) => typeof arc === "object" && arc != null && typeof arc.fromDeg === "number" && Number.isFinite(arc.fromDeg) && typeof arc.toDeg === "number" && Number.isFinite(arc.toDeg))) return parsed;
|
|
40
|
+
} catch {}
|
|
41
|
+
console.warn(`meteo: invalid favorable-directions attribute ${JSON.stringify(value)} — expected '[{"fromDeg":260,"toDeg":340}]' or "none"; treating as absent.`);
|
|
42
|
+
}
|
|
20
43
|
//#endregion
|
|
21
|
-
export { numberAttribute, parseThresholdsAttribute, unitAttribute };
|
|
44
|
+
export { numberAttribute, parseArcsAttribute, parseMonthsAttribute, parseSlotsAttribute, parseThresholdsAttribute, unitAttribute };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Station } from "../../contract.js";
|
|
2
2
|
import { FreshnessStatus, SpeedThresholds } from "../../derive.js";
|
|
3
3
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
4
|
+
import { FavorableDirection } from "../../instruments.js";
|
|
4
5
|
import { ResolvedDisplay } from "../../display.js";
|
|
5
6
|
import "../../index.js";
|
|
6
7
|
import { AmbientStationFeed } from "./ambient.js";
|
|
@@ -30,6 +31,8 @@ declare abstract class MeteoStationElement extends MeteoElement {
|
|
|
30
31
|
set formatTime(value: FormatTime | undefined);
|
|
31
32
|
get thresholds(): SpeedThresholds | null | undefined;
|
|
32
33
|
set thresholds(value: SpeedThresholds | null | undefined);
|
|
34
|
+
get favorableDirections(): FavorableDirection[] | null | undefined;
|
|
35
|
+
set favorableDirections(value: FavorableDirection[] | null | undefined);
|
|
33
36
|
protected display(): ResolvedDisplay;
|
|
34
37
|
protected requiredStation(component: string): Station;
|
|
35
38
|
get servedAt(): string | null | undefined;
|
|
@@ -2,7 +2,7 @@ import { freshness, stationFreshnessThresholds } from "../../derive.js";
|
|
|
2
2
|
import { requireResolved, resolveDisplay, resolveStation } from "../../display.js";
|
|
3
3
|
import { subscribeTicker } from "../../client/ticker.js";
|
|
4
4
|
import { ELEMENTS_AMBIENT_HINT, STATION_FEED_CONTEXT_KEY } from "./ambient.js";
|
|
5
|
-
import { numberAttribute, parseThresholdsAttribute, unitAttribute } from "./attributes.js";
|
|
5
|
+
import { numberAttribute, parseArcsAttribute, parseThresholdsAttribute, unitAttribute } from "./attributes.js";
|
|
6
6
|
import { requestContext } from "./context.js";
|
|
7
7
|
//#region src/elements/lib/base.ts
|
|
8
8
|
var MeteoElement = class extends HTMLElement {
|
|
@@ -56,6 +56,8 @@ var MeteoStationElement = class extends MeteoElement {
|
|
|
56
56
|
#formatTime;
|
|
57
57
|
#thresholds = void 0;
|
|
58
58
|
#thresholdsSet = false;
|
|
59
|
+
#favorableDirections = void 0;
|
|
60
|
+
#favorableDirectionsSet = false;
|
|
59
61
|
#servedAt = void 0;
|
|
60
62
|
#receivedAtMs = void 0;
|
|
61
63
|
constructor() {
|
|
@@ -65,6 +67,7 @@ var MeteoStationElement = class extends MeteoElement {
|
|
|
65
67
|
"strings",
|
|
66
68
|
"formatTime",
|
|
67
69
|
"thresholds",
|
|
70
|
+
"favorableDirections",
|
|
68
71
|
"servedAt",
|
|
69
72
|
"receivedAtMs"
|
|
70
73
|
]) this.upgradeProperty(name);
|
|
@@ -98,12 +101,21 @@ var MeteoStationElement = class extends MeteoElement {
|
|
|
98
101
|
this.#thresholdsSet = value !== void 0;
|
|
99
102
|
this.requestRender();
|
|
100
103
|
}
|
|
104
|
+
get favorableDirections() {
|
|
105
|
+
return this.#favorableDirections;
|
|
106
|
+
}
|
|
107
|
+
set favorableDirections(value) {
|
|
108
|
+
this.#favorableDirections = value;
|
|
109
|
+
this.#favorableDirectionsSet = value !== void 0;
|
|
110
|
+
this.requestRender();
|
|
111
|
+
}
|
|
101
112
|
display() {
|
|
102
113
|
return resolveDisplay(this.ambient(), {
|
|
103
114
|
strings: this.#strings,
|
|
104
115
|
unit: unitAttribute(this.getAttribute("unit")),
|
|
105
116
|
formatTime: this.#formatTime,
|
|
106
|
-
thresholds: this.#thresholdsSet ? this.#thresholds : parseThresholdsAttribute(this.getAttribute("thresholds"))
|
|
117
|
+
thresholds: this.#thresholdsSet ? this.#thresholds : parseThresholdsAttribute(this.getAttribute("thresholds")),
|
|
118
|
+
favorableDirections: this.#favorableDirectionsSet ? this.#favorableDirections : parseArcsAttribute(this.getAttribute("favorable-directions"))
|
|
107
119
|
});
|
|
108
120
|
}
|
|
109
121
|
requiredStation(component) {
|
package/dist/endpoints.d.ts
CHANGED
|
@@ -2,5 +2,11 @@
|
|
|
2
2
|
declare function feedEndpoint(base: string): string;
|
|
3
3
|
declare function currentEndpoint(base: string, stationId: string): string;
|
|
4
4
|
declare function liveEndpoint(base: string, stationId: string): string;
|
|
5
|
+
declare function climatologyEndpoint(base: string, stationId: string): string;
|
|
6
|
+
declare function historyEndpoint(base: string, stationId: string, query: {
|
|
7
|
+
fromMs: number;
|
|
8
|
+
toMs: number;
|
|
9
|
+
periodMinutes: number;
|
|
10
|
+
}): string;
|
|
5
11
|
//#endregion
|
|
6
|
-
export { currentEndpoint, feedEndpoint, liveEndpoint };
|
|
12
|
+
export { climatologyEndpoint, currentEndpoint, feedEndpoint, historyEndpoint, liveEndpoint };
|
package/dist/endpoints.js
CHANGED
|
@@ -9,5 +9,17 @@ function currentEndpoint(base, stationId) {
|
|
|
9
9
|
function liveEndpoint(base, stationId) {
|
|
10
10
|
return `${trimBase(base)}/live?station=${encodeURIComponent(stationId)}`;
|
|
11
11
|
}
|
|
12
|
+
function climatologyEndpoint(base, stationId) {
|
|
13
|
+
return `${trimBase(base)}/climatology?station=${encodeURIComponent(stationId)}`;
|
|
14
|
+
}
|
|
15
|
+
function historyEndpoint(base, stationId, query) {
|
|
16
|
+
const params = new URLSearchParams({
|
|
17
|
+
station: stationId,
|
|
18
|
+
from: new Date(query.fromMs).toISOString(),
|
|
19
|
+
to: new Date(query.toMs).toISOString(),
|
|
20
|
+
period: String(query.periodMinutes)
|
|
21
|
+
});
|
|
22
|
+
return `${trimBase(base)}/history?${params.toString()}`;
|
|
23
|
+
}
|
|
12
24
|
//#endregion
|
|
13
|
-
export { currentEndpoint, feedEndpoint, liveEndpoint };
|
|
25
|
+
export { climatologyEndpoint, currentEndpoint, feedEndpoint, historyEndpoint, liveEndpoint };
|
package/dist/geometry.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { History, HistoryPoint } from "./contract.js";
|
|
2
|
+
import { DirectionArc } from "@azohra/meteo.core";
|
|
2
3
|
//#region src/geometry.d.ts
|
|
3
4
|
type ChartFrame = {
|
|
4
5
|
height: number;
|
|
@@ -33,7 +34,7 @@ type ChartScaleOptions = {
|
|
|
33
34
|
declare function chartScales(points: ReadonlyArray<HistoryPoint>, frame: ChartFrame, options?: ChartScaleOptions): ChartScales;
|
|
34
35
|
declare function bandPoints(points: ReadonlyArray<HistoryPoint>, scales: ChartScales): string | null;
|
|
35
36
|
declare function averagePoints(points: ReadonlyArray<HistoryPoint>, scales: ChartScales): string;
|
|
36
|
-
declare function meanDirectionDeg(points: ReadonlyArray<HistoryPoint>): number | null;
|
|
37
|
+
declare function meanDirectionDeg$1(points: ReadonlyArray<HistoryPoint>): number | null;
|
|
37
38
|
type Vane = {
|
|
38
39
|
windAvgMps: number;
|
|
39
40
|
windDirectionDeg: number | null;
|
|
@@ -51,7 +52,7 @@ type ChartTick = {
|
|
|
51
52
|
timeMs: number;
|
|
52
53
|
x: number;
|
|
53
54
|
};
|
|
54
|
-
declare function vaneTicks(vanes: ReadonlyArray<Vane>, scales: ChartScales): ChartTick[];
|
|
55
|
+
declare function vaneTicks(vanes: ReadonlyArray<Vane>, scales: ChartScales, labelCount?: number): ChartTick[];
|
|
55
56
|
declare function nearestIndex(points: ReadonlyArray<{
|
|
56
57
|
observedAt: string;
|
|
57
58
|
}>, chartX: number, frame: ChartFrame, scales: ChartScales): number | null;
|
|
@@ -62,13 +63,18 @@ type RoseSector = {
|
|
|
62
63
|
meanSpeedMps: number | null;
|
|
63
64
|
maxGustMps: number | null;
|
|
64
65
|
count: number;
|
|
66
|
+
/** Non-calm records per speed band, present only when the caller passed
|
|
67
|
+
* bandThresholdsMps — stacking is a judgment the consumer supplies. */
|
|
68
|
+
bandCounts?: number[] | undefined;
|
|
65
69
|
};
|
|
66
70
|
type WindRoseSummary = {
|
|
67
71
|
sectors: RoseSector[];
|
|
68
72
|
calmFraction: number;
|
|
69
73
|
sampleCount: number;
|
|
70
74
|
};
|
|
71
|
-
declare function windRose(points: ReadonlyArray<HistoryPoint>, sectorCount?: number
|
|
75
|
+
declare function windRose(points: ReadonlyArray<HistoryPoint>, sectorCount?: number, options?: {
|
|
76
|
+
bandThresholdsMps?: ReadonlyArray<number>;
|
|
77
|
+
}): WindRoseSummary;
|
|
72
78
|
declare const DAILY_PATTERN_DEFAULT_SLOT_MINUTES = 180;
|
|
73
79
|
type DailyPatternSlot = {
|
|
74
80
|
startMinuteOfDay: number;
|
|
@@ -83,10 +89,23 @@ declare function dailyPattern(points: ReadonlyArray<HistoryPoint>, options?: {
|
|
|
83
89
|
declare const METEOROLOGICAL_SEASON_MONTHS: Record<"fall" | "spring" | "summer" | "winter", number[]>;
|
|
84
90
|
declare function filterByMonth(points: ReadonlyArray<HistoryPoint>, months: ReadonlyArray<number>, utcOffsetMinutes?: number): HistoryPoint[];
|
|
85
91
|
declare function filterByTimeOfDay(points: ReadonlyArray<HistoryPoint>, fromMinute: number, toMinute: number, utcOffsetMinutes?: number): HistoryPoint[];
|
|
92
|
+
/** The share of non-calm history blowing from inside the consumer's arcs;
|
|
93
|
+
* null when nothing non-calm was measured — absence over a fabricated zero. */
|
|
94
|
+
declare function favorableShare(points: ReadonlyArray<HistoryPoint>, arcs: ReadonlyArray<DirectionArc>): number | null;
|
|
95
|
+
type HistoryCoverage = {
|
|
96
|
+
actualCount: number;
|
|
97
|
+
expectedCount: number;
|
|
98
|
+
ratio: number;
|
|
99
|
+
};
|
|
100
|
+
/** Coverage of a requested window: points held against the count the period
|
|
101
|
+
* implies for [fromMs, toMs). Expected comes from the request, never from the
|
|
102
|
+
* first-to-last point span, so leading and trailing dropouts lower the ratio
|
|
103
|
+
* instead of hiding. */
|
|
104
|
+
declare function historyCoverage(points: ReadonlyArray<HistoryPoint>, periodMinutes: number, fromMs: number, toMs: number): HistoryCoverage;
|
|
86
105
|
declare function historyGaps(history: History, toleranceFactor?: number): Array<[number, number]>;
|
|
87
106
|
type TrendSeries = "temperature" | "pressure";
|
|
88
107
|
declare function windowPoints(points: ReadonlyArray<HistoryPoint>, hours?: number): ReadonlyArray<HistoryPoint>;
|
|
89
108
|
declare function compareWindow(points: ReadonlyArray<HistoryPoint>, offsetDays: number, windowHours?: number): HistoryPoint[] | null;
|
|
90
109
|
declare function compareTracePoints(comparePoints: ReadonlyArray<HistoryPoint>, scales: ChartScales, offsetDays: number): string;
|
|
91
110
|
//#endregion
|
|
92
|
-
export { CHART_FALLBACK_WIDTH, ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, METEOROLOGICAL_SEASON_MONTHS, RoseSector, TickAnchor, TrendSeries, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints };
|
|
111
|
+
export { CHART_FALLBACK_WIDTH, ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, HistoryCoverage, METEOROLOGICAL_SEASON_MONTHS, RoseSector, TickAnchor, TrendSeries, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, favorableShare, filterByMonth, filterByTimeOfDay, historyCoverage, historyGaps, meanDirectionDeg$1 as meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints };
|
package/dist/geometry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { KMH_PER_MPS, isCalm, normalizeDegrees, radians } from "./derive.js";
|
|
2
|
-
import { componentsToWind, meanDirectionDeg, windToComponents } from "@azohra/meteo.core";
|
|
2
|
+
import { componentsToWind, inDirectionArcs, meanDirectionDeg, windToComponents } from "@azohra/meteo.core";
|
|
3
3
|
//#region src/geometry.ts
|
|
4
4
|
const CHART_FALLBACK_WIDTH = 360;
|
|
5
5
|
const CHART_AXIS_GUTTER = 46;
|
|
@@ -131,15 +131,10 @@ function vanePath(cx, cy, fromBearingDeg, { reach = 7, spread = 3.2 } = {}) {
|
|
|
131
131
|
const at = ([px, py]) => `${px.toFixed(1)} ${py.toFixed(1)}`;
|
|
132
132
|
return `M ${at(tail)} L ${at(tip)} M ${at(left)} L ${at(tip)} L ${at(right)}`;
|
|
133
133
|
}
|
|
134
|
-
function vaneTicks(vanes, scales) {
|
|
134
|
+
function vaneTicks(vanes, scales, labelCount = 5) {
|
|
135
135
|
if (vanes.length === 0) return [];
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
.25,
|
|
139
|
-
.5,
|
|
140
|
-
.75,
|
|
141
|
-
1
|
|
142
|
-
].map((fraction, index) => {
|
|
136
|
+
const count = Math.max(2, Math.min(5, Math.floor(labelCount)));
|
|
137
|
+
return Array.from({ length: count }, (_, index) => index / (count - 1)).map((fraction, index) => {
|
|
143
138
|
const vane = vanes[Math.round(fraction * (vanes.length - 1))];
|
|
144
139
|
return {
|
|
145
140
|
index,
|
|
@@ -164,12 +159,14 @@ function speedBand(speedMps, thresholdsMps) {
|
|
|
164
159
|
}
|
|
165
160
|
return band;
|
|
166
161
|
}
|
|
167
|
-
function windRose(points, sectorCount = 16) {
|
|
162
|
+
function windRose(points, sectorCount = 16, options = {}) {
|
|
168
163
|
const sectorWidth = 360 / sectorCount;
|
|
164
|
+
const bounds = options.bandThresholdsMps ?? null;
|
|
169
165
|
const sectors = Array.from({ length: sectorCount }, (_, index) => ({
|
|
170
166
|
bearingDeg: index * sectorWidth,
|
|
171
167
|
speeds: [],
|
|
172
|
-
gusts: []
|
|
168
|
+
gusts: [],
|
|
169
|
+
bandCounts: bounds == null ? null : Array.from({ length: bounds.length + 1 }, () => 0)
|
|
173
170
|
}));
|
|
174
171
|
let calm = 0;
|
|
175
172
|
let counted = 0;
|
|
@@ -182,6 +179,10 @@ function windRose(points, sectorCount = 16) {
|
|
|
182
179
|
const sector = sectors[Math.round(normalizeDegrees(point.windDirectionDeg) / sectorWidth) % sectorCount];
|
|
183
180
|
sector.speeds.push(point.windAvgMps);
|
|
184
181
|
if (point.windGustMps != null) sector.gusts.push(point.windGustMps);
|
|
182
|
+
if (bounds != null && sector.bandCounts != null) {
|
|
183
|
+
const band = speedBand(point.windAvgMps, bounds);
|
|
184
|
+
sector.bandCounts[band] = (sector.bandCounts[band] ?? 0) + 1;
|
|
185
|
+
}
|
|
185
186
|
}
|
|
186
187
|
const blowing = counted - calm;
|
|
187
188
|
return {
|
|
@@ -192,7 +193,8 @@ function windRose(points, sectorCount = 16) {
|
|
|
192
193
|
count: sector.speeds.length,
|
|
193
194
|
frequency: blowing === 0 ? 0 : sector.speeds.length / blowing,
|
|
194
195
|
meanSpeedMps: sector.speeds.length === 0 ? null : sector.speeds.reduce((sum, speed) => sum + speed, 0) / sector.speeds.length,
|
|
195
|
-
maxGustMps: sector.gusts.length === 0 ? null : Math.max(...sector.gusts)
|
|
196
|
+
maxGustMps: sector.gusts.length === 0 ? null : Math.max(...sector.gusts),
|
|
197
|
+
...sector.bandCounts == null ? {} : { bandCounts: sector.bandCounts }
|
|
196
198
|
}))
|
|
197
199
|
};
|
|
198
200
|
}
|
|
@@ -252,6 +254,35 @@ function filterByTimeOfDay(points, fromMinute, toMinute, utcOffsetMinutes = 0) {
|
|
|
252
254
|
return wraps ? minute >= fromMinute || minute < toMinute : minute >= fromMinute && minute < toMinute;
|
|
253
255
|
});
|
|
254
256
|
}
|
|
257
|
+
/** The share of non-calm history blowing from inside the consumer's arcs;
|
|
258
|
+
* null when nothing non-calm was measured — absence over a fabricated zero. */
|
|
259
|
+
function favorableShare(points, arcs) {
|
|
260
|
+
let blowing = 0;
|
|
261
|
+
let favorable = 0;
|
|
262
|
+
for (const point of points) {
|
|
263
|
+
if (isCalm(point.windAvgMps) || point.windDirectionDeg == null) continue;
|
|
264
|
+
blowing += 1;
|
|
265
|
+
if (inDirectionArcs(point.windDirectionDeg, arcs)) favorable += 1;
|
|
266
|
+
}
|
|
267
|
+
return blowing === 0 ? null : favorable / blowing;
|
|
268
|
+
}
|
|
269
|
+
/** Coverage of a requested window: points held against the count the period
|
|
270
|
+
* implies for [fromMs, toMs). Expected comes from the request, never from the
|
|
271
|
+
* first-to-last point span, so leading and trailing dropouts lower the ratio
|
|
272
|
+
* instead of hiding. */
|
|
273
|
+
function historyCoverage(points, periodMinutes, fromMs, toMs) {
|
|
274
|
+
const expectedCount = Math.max(0, Math.floor((toMs - fromMs) / (periodMinutes * 6e4)));
|
|
275
|
+
let actualCount = 0;
|
|
276
|
+
for (const point of points) {
|
|
277
|
+
const observedMs = Date.parse(point.observedAt);
|
|
278
|
+
if (observedMs >= fromMs && observedMs < toMs) actualCount += 1;
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
actualCount,
|
|
282
|
+
expectedCount,
|
|
283
|
+
ratio: expectedCount === 0 ? 0 : actualCount / expectedCount
|
|
284
|
+
};
|
|
285
|
+
}
|
|
255
286
|
const HISTORY_GAP_TOLERANCE_FACTOR = 2.5;
|
|
256
287
|
function historyGaps(history, toleranceFactor = HISTORY_GAP_TOLERANCE_FACTOR) {
|
|
257
288
|
const gaps = [];
|
|
@@ -337,4 +368,4 @@ function compareTracePoints(comparePoints, scales, offsetDays) {
|
|
|
337
368
|
return comparePoints.map((point) => coordinate(scales.xAtMs(Date.parse(point.observedAt) + shiftMs), scales.yAt(point.windAvgMps))).join(" ");
|
|
338
369
|
}
|
|
339
370
|
//#endregion
|
|
340
|
-
export { CHART_FALLBACK_WIDTH, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, HISTORY_GAP_TOLERANCE_FACTOR, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, isCalmHistory, meanDirectionDeg$1 as meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, stretchFrame, thinVanes, tickAnchor, trendRuns, trendSeriesPad, trendValueOf, valueScale, vanePath, vaneTicks, vectorMeanWind, windRose, windowPoints };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { AirConditions, History, HistoryPoint, LiveSample, LiveSamples, Reading, STATION_SCHEMA_VERSION, Station, StationCapabilities, StationCurrent, StationFeed, StationLiveFrame, StationMeta, StationTelemetry, UNAVAILABLE_REASONS, UnavailableReason, airConditionsSchema, capabilitiesSchema, emptyConditions, historyPointSchema, historySchema, liveSampleSchema, liveSamplesSchema, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, readingSchema, stationCurrentSchema, stationFeedSchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, telemetrySchema, unavailableStation } from "./contract.js";
|
|
2
|
-
import {
|
|
1
|
+
import { AirConditions, History, HistoryPoint, LiveSample, LiveSamples, Reading, RecentSummary, STATION_SCHEMA_VERSION, Station, StationCapabilities, StationCurrent, StationFeed, StationHistory, StationLiveFrame, StationMeta, StationTelemetry, UNAVAILABLE_REASONS, UnavailableReason, airConditionsSchema, capabilitiesSchema, declaredFavorableDirections, directionArcSchema, emptyConditions, historyPointSchema, historySchema, liveSampleSchema, liveSamplesSchema, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationHistory, parseStationHistoryJson, parseStationLiveFrame, parseStationLiveFrameJson, readingSchema, recentSummarySchema, stationCurrentSchema, stationFeedSchema, stationHistorySchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, telemetrySchema, unavailableStation } from "./contract.js";
|
|
2
|
+
import { ClimatologyCell, ClimatologySector, ClimatologyYear, STATION_CLIMATOLOGY_SCHEMA_VERSION, StationClimatology, climatologyCellSchema, climatologySectorSchema, climatologyYearSchema, parseStationClimatology, parseStationClimatologyJson, stationClimatologySchema } from "./contract-climatology.js";
|
|
3
|
+
import { CALM_THRESHOLD_MPS, COMPASS_POINTS, CompassPoint, FreshnessStatus, FreshnessThresholds, PeriodSummary, PressureTendency, SpeedThresholds, SpeedUnit, compassDirection, freshness, isCalm, lastNightLowC, normalizeDegrees, periodSummary, pressureDeltaHpa, pressureTendency, seaLevelPressureHpa, speedFromMps, speedToMps, speedUnitLabel, stationFreshnessThresholds, thresholdsToMps } from "./derive.js";
|
|
3
4
|
import { FormatTime, StationStringOverrides, StationStrings, defaultFormatTime, defaultStrings, localeFormatTime, mergeStringOverrides, resolveStrings } from "./strings.js";
|
|
4
5
|
import { DirectionCellData, SummaryEntry, directionCell, optionalSpeed, roundSpeed, summaryEntries, temperatureText, temperatureValue, updatedAtText } from "./format.js";
|
|
5
6
|
import { CONNECTIVITY_SERVICE_STATES, ConnectivityServiceState, ConnectivitySession, StationConnectivity, connectivitySessionSchema, parseStationConnectivity, stationConnectivitySchema } from "./connectivity.js";
|
|
7
|
+
import { DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, FavorableDirection, HistoryRun, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, bandStrips, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, historyRuns, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale } from "./instruments.js";
|
|
6
8
|
import { DisplayDefaults, DisplayProps, ResolvedDisplay, requireResolved, resolveDisplay, resolveStation } from "./display.js";
|
|
7
|
-
import { currentEndpoint, feedEndpoint, liveEndpoint } from "./endpoints.js";
|
|
8
|
-
import { CHART_FALLBACK_WIDTH, ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, METEOROLOGICAL_SEASON_MONTHS, RoseSector, TickAnchor, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints } from "./geometry.js";
|
|
9
|
-
import {
|
|
9
|
+
import { climatologyEndpoint, currentEndpoint, feedEndpoint, historyEndpoint, liveEndpoint } from "./endpoints.js";
|
|
10
|
+
import { CHART_FALLBACK_WIDTH, ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, HistoryCoverage, METEOROLOGICAL_SEASON_MONTHS, RoseSector, TickAnchor, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, favorableShare, filterByMonth, filterByTimeOfDay, historyCoverage, historyGaps, meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints } from "./geometry.js";
|
|
11
|
+
import { ClimatologyAccumulator, ClimatologyCoverage, ClimatologyFilters, ClimatologyFoldParams, accumulatedCells, climatologyCoverage, climatologyFavorableShare, climatologyPattern, climatologyRose, coveredSlotCountByYear, createClimatologyAccumulator, foldClimatologyPoints } from "./climatology.js";
|
|
10
12
|
import { MergeResult, foldCurrent, mergeCurrent } from "./merge-current.js";
|
|
11
13
|
import { SAMPLE_GAP_TOLERANCE_FACTOR, SamplesSummary, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes } from "./samples.js";
|
|
12
14
|
import { AirRow, airRows, airSummary, lastStrikeWords } from "./air.js";
|
|
13
15
|
import { normalizeWindnerdStationKey, windnerdStationUrl } from "./windnerd.js";
|
|
14
|
-
export { type AirConditions, type AirRow, CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, CONNECTIVITY_SERVICE_STATES, type ChartFrame, type ChartScaleOptions, type ChartScales, type ChartTick, type CompassPoint, type ConnectivityServiceState, type ConnectivitySession, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, type DailyPatternSlot, type DirectionCellData, type DisplayDefaults, type DisplayProps, type FavorableDirection, type FormatTime, type FreshnessStatus, type FreshnessThresholds, type History, type HistoryPoint, type HistoryRun, type LiveSample, type LiveSamples, METEOROLOGICAL_SEASON_MONTHS, type MergeResult, type PeriodSummary, type PressureTendency, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, type Reading, type ResolvedDisplay, type RoseSector, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_SCHEMA_VERSION, type SamplesSummary, type SpeedThresholds, type SpeedUnit, type Station, type StationCapabilities, type StationConnectivity, type StationCurrent, type StationFeed, type StationLiveFrame, type StationMeta, type StationStringOverrides, type StationStrings, type StationTelemetry, type SummaryEntry, type TickAnchor, UNAVAILABLE_REASONS, type UnavailableReason, type Vane, type WindRoseSummary, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, compareTracePoints, compareWindow, compassDirection, connectivitySessionSchema, currentEndpoint, dailyPattern, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionCell, emptyConditions, feedEndpoint, filterByMonth, filterByTimeOfDay, foldCurrent, freshness, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationConnectivity, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureTendency, readingSchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationConnectivitySchema, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
|
|
16
|
+
export { type AirConditions, type AirRow, CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, CONNECTIVITY_SERVICE_STATES, type ChartFrame, type ChartScaleOptions, type ChartScales, type ChartTick, type ClimatologyAccumulator, type ClimatologyCell, type ClimatologyCoverage, type ClimatologyFilters, type ClimatologyFoldParams, type ClimatologySector, type ClimatologyYear, type CompassPoint, type ConnectivityServiceState, type ConnectivitySession, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, type DailyPatternSlot, type DirectionCellData, type DisplayDefaults, type DisplayProps, type FavorableDirection, type FormatTime, type FreshnessStatus, type FreshnessThresholds, type History, type HistoryCoverage, type HistoryPoint, type HistoryRun, type LiveSample, type LiveSamples, METEOROLOGICAL_SEASON_MONTHS, type MergeResult, type PeriodSummary, type PressureTendency, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, type Reading, type RecentSummary, type ResolvedDisplay, type RoseSector, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_CLIMATOLOGY_SCHEMA_VERSION, STATION_SCHEMA_VERSION, type SamplesSummary, type SpeedThresholds, type SpeedUnit, type Station, type StationCapabilities, type StationClimatology, type StationConnectivity, type StationCurrent, type StationFeed, type StationHistory, type StationLiveFrame, type StationMeta, type StationStringOverrides, type StationStrings, type StationTelemetry, type SummaryEntry, type TickAnchor, UNAVAILABLE_REASONS, type UnavailableReason, type Vane, type WindRoseSummary, accumulatedCells, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, climatologyCellSchema, climatologyCoverage, climatologyEndpoint, climatologyFavorableShare, climatologyPattern, climatologyRose, climatologySectorSchema, climatologyYearSchema, compareTracePoints, compareWindow, compassDirection, connectivitySessionSchema, coveredSlotCountByYear, createClimatologyAccumulator, currentEndpoint, dailyPattern, declaredFavorableDirections, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionArcSchema, directionCell, emptyConditions, favorableShare, feedEndpoint, filterByMonth, filterByTimeOfDay, foldClimatologyPoints, foldCurrent, freshness, historyCoverage, historyEndpoint, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastNightLowC, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationClimatology, parseStationClimatologyJson, parseStationConnectivity, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationHistory, parseStationHistoryJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureDeltaHpa, pressureTendency, readingSchema, recentSummarySchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationClimatologySchema, stationConnectivitySchema, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationHistorySchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, airConditionsSchema, capabilitiesSchema, emptyConditions, historyPointSchema, historySchema, liveSampleSchema, liveSamplesSchema, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, readingSchema, stationCurrentSchema, stationFeedSchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, telemetrySchema, unavailableStation } from "./contract.js";
|
|
1
|
+
import { STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, airConditionsSchema, capabilitiesSchema, declaredFavorableDirections, directionArcSchema, emptyConditions, historyPointSchema, historySchema, liveSampleSchema, liveSamplesSchema, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationHistory, parseStationHistoryJson, parseStationLiveFrame, parseStationLiveFrameJson, readingSchema, recentSummarySchema, stationCurrentSchema, stationFeedSchema, stationHistorySchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, telemetrySchema, unavailableStation } from "./contract.js";
|
|
2
2
|
import { CONNECTIVITY_SERVICE_STATES, connectivitySessionSchema, parseStationConnectivity, stationConnectivitySchema } from "./connectivity.js";
|
|
3
|
-
import { CALM_THRESHOLD_MPS, COMPASS_POINTS, compassDirection, freshness, isCalm, normalizeDegrees, periodSummary, pressureTendency, seaLevelPressureHpa, speedFromMps, speedToMps, speedUnitLabel, stationFreshnessThresholds, thresholdsToMps } from "./derive.js";
|
|
3
|
+
import { CALM_THRESHOLD_MPS, COMPASS_POINTS, compassDirection, freshness, isCalm, lastNightLowC, normalizeDegrees, periodSummary, pressureDeltaHpa, pressureTendency, seaLevelPressureHpa, speedFromMps, speedToMps, speedUnitLabel, stationFreshnessThresholds, thresholdsToMps } from "./derive.js";
|
|
4
4
|
import { defaultFormatTime, defaultStrings, localeFormatTime, mergeStringOverrides, resolveStrings } from "./strings.js";
|
|
5
5
|
import { requireResolved, resolveDisplay, resolveStation } from "./display.js";
|
|
6
|
-
import { currentEndpoint, feedEndpoint, liveEndpoint } from "./endpoints.js";
|
|
6
|
+
import { climatologyEndpoint, currentEndpoint, feedEndpoint, historyEndpoint, liveEndpoint } from "./endpoints.js";
|
|
7
|
+
import { STATION_CLIMATOLOGY_SCHEMA_VERSION, climatologyCellSchema, climatologySectorSchema, climatologyYearSchema, parseStationClimatology, parseStationClimatologyJson, stationClimatologySchema } from "./contract-climatology.js";
|
|
8
|
+
import { CHART_FALLBACK_WIDTH, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, favorableShare, filterByMonth, filterByTimeOfDay, historyCoverage, historyGaps, meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints } from "./geometry.js";
|
|
9
|
+
import { accumulatedCells, climatologyCoverage, climatologyFavorableShare, climatologyPattern, climatologyRose, coveredSlotCountByYear, createClimatologyAccumulator, foldClimatologyPoints } from "./climatology.js";
|
|
7
10
|
import { directionCell, optionalSpeed, roundSpeed, summaryEntries, temperatureText, temperatureValue, updatedAtText } from "./format.js";
|
|
8
|
-
import {
|
|
9
|
-
import { DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, bandStrips, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, historyRuns, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale } from "./instruments.js";
|
|
11
|
+
import { DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, bandStrips, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, historyRuns, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale } from "./instruments.js";
|
|
10
12
|
import { foldCurrent, mergeCurrent } from "./merge-current.js";
|
|
11
13
|
import { SAMPLE_GAP_TOLERANCE_FACTOR, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes } from "./samples.js";
|
|
12
14
|
import { airRows, airSummary, lastStrikeWords } from "./air.js";
|
|
13
15
|
import { normalizeWindnerdStationKey, windnerdStationUrl } from "./windnerd.js";
|
|
14
|
-
export { CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, CONNECTIVITY_SERVICE_STATES, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, METEOROLOGICAL_SEASON_MONTHS, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, compareTracePoints, compareWindow, compassDirection, connectivitySessionSchema, currentEndpoint, dailyPattern, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionCell, emptyConditions, feedEndpoint, filterByMonth, filterByTimeOfDay, foldCurrent, freshness, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationConnectivity, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureTendency, readingSchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationConnectivitySchema, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
|
|
16
|
+
export { CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, CONNECTIVITY_SERVICE_STATES, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, METEOROLOGICAL_SEASON_MONTHS, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_CLIMATOLOGY_SCHEMA_VERSION, STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, accumulatedCells, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, climatologyCellSchema, climatologyCoverage, climatologyEndpoint, climatologyFavorableShare, climatologyPattern, climatologyRose, climatologySectorSchema, climatologyYearSchema, compareTracePoints, compareWindow, compassDirection, connectivitySessionSchema, coveredSlotCountByYear, createClimatologyAccumulator, currentEndpoint, dailyPattern, declaredFavorableDirections, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionArcSchema, directionCell, emptyConditions, favorableShare, feedEndpoint, filterByMonth, filterByTimeOfDay, foldClimatologyPoints, foldCurrent, freshness, historyCoverage, historyEndpoint, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastNightLowC, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationClimatology, parseStationClimatologyJson, parseStationConnectivity, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationHistory, parseStationHistoryJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureDeltaHpa, pressureTendency, readingSchema, recentSummarySchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationClimatologySchema, stationConnectivitySchema, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationHistorySchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
|
package/dist/instruments.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HistoryPoint } from "./contract.js";
|
|
2
2
|
import { SpeedUnit } from "./derive.js";
|
|
3
|
+
import { DirectionArc } from "@azohra/meteo.core";
|
|
3
4
|
//#region src/instruments.d.ts
|
|
4
5
|
declare const DIAL_SIZE = 160;
|
|
5
6
|
declare const DIAL_CENTRE: number;
|
|
@@ -39,10 +40,11 @@ declare const ROSE_TICK_REACH = 4;
|
|
|
39
40
|
declare const ROSE_PETAL_FILL = 0.82;
|
|
40
41
|
declare function rosePolar(bearingDeg: number, radius: number): readonly [number, number];
|
|
41
42
|
declare function rosePetalPath(bearingDeg: number, radius: number, halfWidthDeg: number): string;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
/** One radial slice of a petal — a stacked wedge's band segment; the petal
|
|
44
|
+
* itself is the slice from the hub out. */
|
|
45
|
+
declare function roseBandPath(bearingDeg: number, innerRadius: number, outerRadius: number, halfWidthDeg: number): string;
|
|
46
|
+
/** The rose ring's arc input; the shape is core's `DirectionArc`. */
|
|
47
|
+
type FavorableDirection = DirectionArc;
|
|
46
48
|
declare function roseRingArcPath(sector: FavorableDirection): string;
|
|
47
49
|
declare const ROSE_CARDINAL_LETTERS: readonly [{
|
|
48
50
|
readonly bearing: 0;
|
|
@@ -72,4 +74,4 @@ type HistoryRun = {
|
|
|
72
74
|
declare function historyRuns(points: ReadonlyArray<HistoryPoint>, periodMinutes: number): HistoryRun[];
|
|
73
75
|
declare function bandStrips(runs: ReadonlyArray<HistoryRun>): HistoryRun[];
|
|
74
76
|
//#endregion
|
|
75
|
-
export { DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, FavorableDirection, HistoryRun, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, bandStrips, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, historyRuns, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale };
|
|
77
|
+
export { DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, FavorableDirection, HistoryRun, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, bandStrips, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, historyRuns, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale };
|
package/dist/instruments.js
CHANGED
|
@@ -26,6 +26,13 @@ function dialNeedlePoints(fromDeg) {
|
|
|
26
26
|
const right = dialPolar(flowDeg - 90, DIAL_NEEDLE_HALF_WIDTH);
|
|
27
27
|
return `${dialAt(tip)} ${dialAt(left)} ${dialAt(right)}`;
|
|
28
28
|
}
|
|
29
|
+
function dialRingArcPath(sector) {
|
|
30
|
+
const from = normalizeDegrees(sector.fromDeg);
|
|
31
|
+
const span = normalizeDegrees(sector.toDeg - sector.fromDeg);
|
|
32
|
+
const start = dialPolar(from, 70);
|
|
33
|
+
const end = dialPolar(from + span, 70);
|
|
34
|
+
return `M ${dialAt(start)} A 70 70 0 ${span > 180 ? 1 : 0} 1 ${dialAt(end)}`;
|
|
35
|
+
}
|
|
29
36
|
function dialSpeedArcPath(fraction) {
|
|
30
37
|
const sweepDeg = Math.min(359.9, Math.max(0, fraction) * 360);
|
|
31
38
|
const start = dialPolar(0, 70);
|
|
@@ -69,16 +76,22 @@ function rosePolar(bearingDeg, radius) {
|
|
|
69
76
|
}
|
|
70
77
|
const roseAt = ([x, y]) => `${x.toFixed(1)} ${y.toFixed(1)}`;
|
|
71
78
|
function rosePetalPath(bearingDeg, radius, halfWidthDeg) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
return roseBandPath(bearingDeg, 16, radius, halfWidthDeg);
|
|
80
|
+
}
|
|
81
|
+
/** One radial slice of a petal — a stacked wedge's band segment; the petal
|
|
82
|
+
* itself is the slice from the hub out. */
|
|
83
|
+
function roseBandPath(bearingDeg, innerRadius, outerRadius, halfWidthDeg) {
|
|
84
|
+
const outerLeft = rosePolar(bearingDeg - halfWidthDeg, outerRadius);
|
|
85
|
+
const outerRight = rosePolar(bearingDeg + halfWidthDeg, outerRadius);
|
|
86
|
+
const innerLeft = rosePolar(bearingDeg - halfWidthDeg, innerRadius);
|
|
87
|
+
const innerRight = rosePolar(bearingDeg + halfWidthDeg, innerRadius);
|
|
88
|
+
const arcRadius = (radius) => Number.isInteger(radius) ? String(radius) : radius.toFixed(1);
|
|
76
89
|
return [
|
|
77
90
|
`M ${roseAt(innerLeft)}`,
|
|
78
91
|
`L ${roseAt(outerLeft)}`,
|
|
79
|
-
`A ${
|
|
92
|
+
`A ${outerRadius.toFixed(1)} ${outerRadius.toFixed(1)} 0 0 1 ${roseAt(outerRight)}`,
|
|
80
93
|
`L ${roseAt(innerRight)}`,
|
|
81
|
-
`A
|
|
94
|
+
`A ${arcRadius(innerRadius)} ${arcRadius(innerRadius)} 0 0 0 ${roseAt(innerLeft)}`,
|
|
82
95
|
"Z"
|
|
83
96
|
].join(" ");
|
|
84
97
|
}
|
|
@@ -170,4 +183,4 @@ function bandStrips(runs) {
|
|
|
170
183
|
return strips;
|
|
171
184
|
}
|
|
172
185
|
//#endregion
|
|
173
|
-
export { DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, bandStrips, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, historyRuns, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale };
|
|
186
|
+
export { DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, bandStrips, dialNeedlePoints, dialPolar, dialRingArcPath, dialScaleMaxMps, dialSpeedArcPath, historyRuns, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale };
|
package/dist/merge-current.js
CHANGED
|
@@ -28,7 +28,8 @@ function mergeCurrent(feed, current) {
|
|
|
28
28
|
return {
|
|
29
29
|
...incoming,
|
|
30
30
|
reading: preserveOmitted(incoming.reading, prior?.reading ?? null),
|
|
31
|
-
history: prior?.history ?? null
|
|
31
|
+
history: prior?.history ?? null,
|
|
32
|
+
recentSummaries: incoming.recentSummaries ?? prior?.recentSummaries ?? null
|
|
32
33
|
};
|
|
33
34
|
})
|
|
34
35
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Station } from "../../contract.js";
|
|
2
|
+
import { StationStringOverrides } from "../../strings.js";
|
|
3
|
+
import "../../index.js";
|
|
4
|
+
//#region src/react/components/AirExtremes.d.ts
|
|
5
|
+
/** Derived atmo tiles from served history: the last completed night's low
|
|
6
|
+
* (real astronomy — no coordinates, no tile) and the trailing pressure
|
|
7
|
+
* delta. Nothing derivable, nothing rendered. */
|
|
8
|
+
declare function AirExtremes({ station: stationProp, stationId, nowMs, strings: stringsProp }: {
|
|
9
|
+
station?: Station;
|
|
10
|
+
stationId?: string;
|
|
11
|
+
/** Pinned in tests; defaults to the wall clock. */
|
|
12
|
+
nowMs?: number;
|
|
13
|
+
strings?: StationStringOverrides;
|
|
14
|
+
}): import("react").JSX.Element | null;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { AirExtremes };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { resolveDisplay } from "../../display.js";
|
|
3
|
+
import { airExtremesGate, airExtremesScene } from "../../scene/air-extremes.js";
|
|
4
|
+
import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/react/components/AirExtremes.tsx
|
|
7
|
+
/** Derived atmo tiles from served history: the last completed night's low
|
|
8
|
+
* (real astronomy — no coordinates, no tile) and the trailing pressure
|
|
9
|
+
* delta. Nothing derivable, nothing rendered. */
|
|
10
|
+
function AirExtremes({ station: stationProp, stationId, nowMs, strings: stringsProp }) {
|
|
11
|
+
const context = useStationFeedContext();
|
|
12
|
+
const station = stationProp ?? resolveStation(context, stationId) ?? void 0;
|
|
13
|
+
const { words } = resolveDisplay(context, { strings: stringsProp });
|
|
14
|
+
const gate = airExtremesGate(station);
|
|
15
|
+
if (gate.kind === "hidden") return null;
|
|
16
|
+
const scene = airExtremesScene({
|
|
17
|
+
nowMs: nowMs ?? Date.now(),
|
|
18
|
+
station: gate.station,
|
|
19
|
+
words
|
|
20
|
+
});
|
|
21
|
+
if (scene == null) return null;
|
|
22
|
+
return /* @__PURE__ */ jsx("dl", {
|
|
23
|
+
"aria-label": scene.ariaLabel,
|
|
24
|
+
className: scene.className,
|
|
25
|
+
children: scene.tiles.map((tile) => /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: tile.className,
|
|
27
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
28
|
+
className: "meteo-microlabel",
|
|
29
|
+
children: tile.label
|
|
30
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
31
|
+
className: "meteo-air-extremes-value",
|
|
32
|
+
children: tile.value
|
|
33
|
+
})]
|
|
34
|
+
}, tile.key))
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { AirExtremes };
|