@dangahagan/weather-mcp 1.38.0 → 1.39.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 +8 -7
- package/dist/config/tools.d.ts +4 -1
- package/dist/config/tools.d.ts.map +1 -1
- package/dist/config/tools.js +5 -2
- package/dist/config/tools.js.map +1 -1
- package/dist/handlers/forecastDiscussion.d.ts +38 -0
- package/dist/handlers/forecastDiscussion.d.ts.map +1 -0
- package/dist/handlers/forecastDiscussion.js +141 -0
- package/dist/handlers/forecastDiscussion.js.map +1 -0
- package/dist/handlers/forecastHandler.d.ts +2 -1
- package/dist/handlers/forecastHandler.d.ts.map +1 -1
- package/dist/handlers/forecastHandler.js +53 -4
- package/dist/handlers/forecastHandler.js.map +1 -1
- package/dist/handlers/spcOutlookLine.d.ts +27 -0
- package/dist/handlers/spcOutlookLine.d.ts.map +1 -0
- package/dist/handlers/spcOutlookLine.js +71 -0
- package/dist/handlers/spcOutlookLine.js.map +1 -0
- package/dist/server/weatherServer.d.ts +5 -0
- package/dist/server/weatherServer.d.ts.map +1 -1
- package/dist/server/weatherServer.js +9 -1
- package/dist/server/weatherServer.js.map +1 -1
- package/dist/services/noaa.d.ts +14 -1
- package/dist/services/noaa.d.ts.map +1 -1
- package/dist/services/noaa.js +92 -0
- package/dist/services/noaa.js.map +1 -1
- package/dist/services/spc.d.ts +34 -0
- package/dist/services/spc.d.ts.map +1 -0
- package/dist/services/spc.js +119 -0
- package/dist/services/spc.js.map +1 -0
- package/dist/types/noaa.d.ts +25 -0
- package/dist/types/noaa.d.ts.map +1 -1
- package/dist/types/spc.d.ts +47 -0
- package/dist/types/spc.d.ts.map +1 -0
- package/dist/types/spc.js +16 -0
- package/dist/types/spc.js.map +1 -0
- package/dist/utils/nwsJurisdiction.d.ts +21 -2
- package/dist/utils/nwsJurisdiction.d.ts.map +1 -1
- package/dist/utils/nwsJurisdiction.js +55 -2
- package/dist/utils/nwsJurisdiction.js.map +1 -1
- package/dist/utils/serviceStatusCoverage.d.ts.map +1 -1
- package/dist/utils/serviceStatusCoverage.js +1 -0
- package/dist/utils/serviceStatusCoverage.js.map +1 -1
- package/dist/utils/spcOutlook.d.ts +52 -0
- package/dist/utils/spcOutlook.d.ts.map +1 -0
- package/dist/utils/spcOutlook.js +245 -0
- package/dist/utils/spcOutlook.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@dangahagan/weather-mcp)
|
|
4
4
|
[](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.dgahagan/weather-mcp)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[](./docs/testing/TEST_SUITE_README.md)
|
|
7
7
|
[](https://nodejs.org)
|
|
8
8
|
|
|
9
9
|
**Give your AI assistant real weather data — 18 tools, zero API keys, zero signup, zero cost.**
|
|
10
10
|
|
|
11
|
-
Weather MCP is a [Model Context Protocol](https://modelcontextprotocol.io) server that connects AI assistants (Claude, Cursor, Cline, Zed, and any other MCP client) to live weather data: forecasts, current conditions, alerts, air quality, marine conditions, lightning, radar, rivers, wildfires, aviation weather, and 85+ years of historical weather. It's built entirely on free public data sources — NOAA, the NOAA Aviation Weather Center, Open-Meteo, MET Norway, USGS, NIFC, NASA FIRMS, RainViewer, and Blitzortung.org — so there is nothing to sign up for and no key to paste in. (A few optional keys unlock extras — see [Optional API keys](#optional-api-keys) — but no tool ever requires one.)
|
|
11
|
+
Weather MCP is a [Model Context Protocol](https://modelcontextprotocol.io) server that connects AI assistants (Claude, Cursor, Cline, Zed, and any other MCP client) to live weather data: forecasts, current conditions, alerts, air quality, marine conditions, lightning, radar, rivers, wildfires, aviation weather, and 85+ years of historical weather. It's built entirely on free public data sources — NOAA, the NOAA Aviation Weather Center, the NOAA Storm Prediction Center, Open-Meteo, MET Norway, USGS, NIFC, NASA FIRMS, RainViewer, and Blitzortung.org — so there is nothing to sign up for and no key to paste in. (A few optional keys unlock extras — see [Optional API keys](#optional-api-keys) — but no tool ever requires one.)
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
claude mcp add weather -- npx -y @dangahagan/weather-mcp@latest
|
|
@@ -58,7 +58,7 @@ Choose this one if you want:
|
|
|
58
58
|
|
|
59
59
|
- **Genuinely free** — every data source is a free public API. No trial that expires, no credit card, no rate-limited "free tier" bait.
|
|
60
60
|
- **No API keys** — install to first forecast in under a minute. Nothing to configure, nothing to leak into a repo. ([Four optional keys](#optional-api-keys) add extras if you want them; the default configuration needs none.)
|
|
61
|
-
- **Fully open source** — MIT licensed, readable TypeScript, 7,
|
|
61
|
+
- **Fully open source** — MIT licensed, readable TypeScript, 7,216 tests. Audit it, fork it, fix it.
|
|
62
62
|
- **Privacy-respecting** — your queries go directly from your machine to public weather APIs. No middleman server, and no telemetry unless you opt in.
|
|
63
63
|
- **Breadth** — 18 tools covering weather, safety hazards (lightning, floods, wildfires), marine conditions, air quality, and historical data back to 1940. Most weather MCPs stop at forecasts.
|
|
64
64
|
|
|
@@ -70,7 +70,7 @@ All 18 tools, documented in detail in **[docs/TOOLS.md](./docs/TOOLS.md)**:
|
|
|
70
70
|
|
|
71
71
|
| Tool | What it does | Coverage |
|
|
72
72
|
|------|-------------|----------|
|
|
73
|
-
| `get_forecast` | Daily/hourly forecasts up to 16 days by coordinates, saved location, or city name, plus a 2-hour, 15-minute precipitation nowcast in North America and Central Europe (`granularity="minutely"`) (NOAA publishes 7 days daily and ~6.5 days hourly in the US, and says so when you ask for more; `source="openmeteo"` reaches the full range); sunrise/sunset, UV, precipitation probability, optional climate-normals comparison, optional moon phase & twilight almanac, optional five-model agreement comparison When the National Weather Service has a life-threatening alert active for a point in the United States or an NWS-served territory, its warning is surfaced at the top of the response before the report — absence of the banner is not an all-clear, so call `get_alerts` for the authoritative answer | 🌍 Global |
|
|
73
|
+
| `get_forecast` | Daily/hourly forecasts up to 16 days by coordinates, saved location, or city name, plus a 2-hour, 15-minute precipitation nowcast in North America and Central Europe (`granularity="minutely"`) (NOAA publishes 7 days daily and ~6.5 days hourly in the US, and says so when you ask for more; `source="openmeteo"` reaches the full range); sunrise/sunset, UV, precipitation probability, optional climate-normals comparison, optional moon phase & twilight almanac, optional five-model agreement comparison; optional NWS forecast discussion (`include_discussion`); an automatic SPC convective outlook line at Marginal risk or above (absence is not an all-clear). When the National Weather Service has a life-threatening alert active for a point in the United States or an NWS-served territory, its warning is surfaced at the top of the response before the report — absence of the banner is not an all-clear, so call `get_alerts` for the authoritative answer | 🌍 Global |
|
|
74
74
|
| `get_current_conditions` | Current weather: temperature, wind, humidity, pressure; NOAA station observations in the US (plus heat index/wind chill, snow depth, optional NOAA fire-weather indices), Open-Meteo model data elsewhere (with an optional computed Fosberg fire-weather index), or real airport station observations worldwide with `source="metar"` (the optional Fosberg index is then computed from the station's own observation). Always states the observation's age, and automatically falls back to a fresher nearby station when the nearest one has gone dark. In extreme conditions automatically adds frostbite time-to-onset (computed wind chill) or heat-stress context (estimated WBGT) When the National Weather Service has a life-threatening alert active for a point in the United States or an NWS-served territory, its warning is surfaced at the top of the response before the report — absence of the banner is not an all-clear, so call `get_alerts` for the authoritative answer | 🌍 Global |
|
|
75
75
|
| `get_alerts` | Active watches, warnings, and advisories sorted by severity; official national warnings for the US (NOAA), Canada (ECCC), 38 European countries (MeteoAlarm), India (NDMA SACHET), the Philippines (PAGASA), Indonesia (BMKG), and Japan (JMA) | 🇺🇸 🇨🇦 🇪🇺 🇮🇳 🇵🇭 🇮🇩 🇯🇵 |
|
|
76
76
|
| `get_historical_weather` | Hourly/daily observations from 1940 to present | 🌍 Global |
|
|
@@ -123,6 +123,7 @@ All free, all public, no authentication required:
|
|
|
123
123
|
| [NOAA Weather API](https://www.weather.gov/documentation/services-web-api) | US forecasts, current conditions, alerts, fire weather | US |
|
|
124
124
|
| [Open-Meteo](https://open-meteo.com/) | Global forecasts, historical data (1940+), air quality, marine, geocoding, climate normals, fire-weather inputs | Global |
|
|
125
125
|
| [MET Norway](https://api.met.no/weatherapi/locationforecast/2.0/documentation) | Global forecasts, used only when Open-Meteo fails transiently outside the US (about a nine-day horizon, daily only) — CC BY 4.0 | Global |
|
|
126
|
+
| [NOAA Storm Prediction Center](https://www.spc.noaa.gov/) | Day 1–3 categorical convective outlooks (the `get_forecast` SPC line) | Contiguous US |
|
|
126
127
|
| [NOAA Aviation Weather Center](https://aviationweather.gov/data/api/) | METAR airport observations, TAFs, SIGMETs, G-AIRMETs and pilot reports | Global (G-AIRMETs: contiguous US) |
|
|
127
128
|
| [NOAA NWPS](https://water.noaa.gov/) | River levels, streamflow, flood stages | US |
|
|
128
129
|
| [Environment Agency](https://environment.data.gov.uk/flood-monitoring/doc/reference) | Observed river levels from the real-time gauge network, with published typical ranges — Open Government Licence v3 | Great Britain |
|
|
@@ -237,8 +238,8 @@ Control which tools are exposed to reduce context overhead:
|
|
|
237
238
|
|
|
238
239
|
**Context cost.** Every MCP client puts the `tools/list` result into model context on
|
|
239
240
|
every turn, so the preset you choose is a standing cost on every request. Measured on
|
|
240
|
-
the built server: `basic` **
|
|
241
|
-
`full`/`all` **34,
|
|
241
|
+
the built server: `basic` **14,102 bytes** (~3.5k tokens), `standard` **22,923** (~5.7k),
|
|
242
|
+
`full`/`all` **34,858** (~8.7k). It scales with the number of **tools**, not the number of
|
|
242
243
|
data sources — adding Japan and India as alert authorities added zero tools and zero bytes.
|
|
243
244
|
|
|
244
245
|
Each tool also carries a display title ("Weather Forecast") and MCP behaviour hints: 16 tools
|
|
@@ -408,7 +409,7 @@ npm run build # Compile TypeScript
|
|
|
408
409
|
npm run dev # Run in development mode
|
|
409
410
|
npm test # Offline tests: unit + integration (what CI runs)
|
|
410
411
|
npm run test:live # Live-network tests against the real upstreams, by hand
|
|
411
|
-
npm test && npm run test:live # Run all 7,
|
|
412
|
+
npm test && npm run test:live # Run all 7,216 tests
|
|
412
413
|
npm run test:coverage # Coverage report
|
|
413
414
|
npm run audit # Dependency vulnerability scan
|
|
414
415
|
```
|
package/dist/config/tools.d.ts
CHANGED
|
@@ -63,7 +63,10 @@ export declare const PRESETS: Record<string, ("check_service_status" | "get_air_
|
|
|
63
63
|
* plan-tool-annotations); `basic` stayed inside 14,000. Re-measured 2026-11-28 on the
|
|
64
64
|
* built dist: `full` 34,617 with get_aviation_weather (plan-aviation-weather-tool), so
|
|
65
65
|
* raised from 33,000 to 35,000 on purpose; `basic` 13,861 and `standard` 22,682 unchanged,
|
|
66
|
-
* because neither preset carries the tool.
|
|
66
|
+
* because neither preset carries the tool. Re-measured 2026-11-29 on the built dist
|
|
67
|
+
* with get_forecast's include_discussion (plan-nws-discussion-spc-outlook): basic 14,102,
|
|
68
|
+
* standard 22,923, full 34,858. `basic` raised from 14,000 to 15,000 on purpose;
|
|
69
|
+
* `full` stays inside 35,000.
|
|
67
70
|
*/
|
|
68
71
|
export declare const TOOLS_LIST_BYTE_BUDGET: Record<'basic' | 'full', number>;
|
|
69
72
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/config/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E;;GAEG;AAKH,eAAO,MAAM,UAAU,YACrB,cAAc,EACd,wBAAwB,EACxB,YAAY,EACZ,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,CACf,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE;IAA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;CACF;AAGD,eAAO,MAAM,UAAU,YAAmB,CAAC;AAG3C,eAAO,MAAM,OAAO,mbAAe,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,OAAO,GAAG,MAAM,EAAE,MAAM,CAGnE,CAAC"}
|
package/dist/config/tools.js
CHANGED
|
@@ -330,10 +330,13 @@ export const PRESETS = TOOL_PRESETS;
|
|
|
330
330
|
* plan-tool-annotations); `basic` stayed inside 14,000. Re-measured 2026-11-28 on the
|
|
331
331
|
* built dist: `full` 34,617 with get_aviation_weather (plan-aviation-weather-tool), so
|
|
332
332
|
* raised from 33,000 to 35,000 on purpose; `basic` 13,861 and `standard` 22,682 unchanged,
|
|
333
|
-
* because neither preset carries the tool.
|
|
333
|
+
* because neither preset carries the tool. Re-measured 2026-11-29 on the built dist
|
|
334
|
+
* with get_forecast's include_discussion (plan-nws-discussion-spc-outlook): basic 14,102,
|
|
335
|
+
* standard 22,923, full 34,858. `basic` raised from 14,000 to 15,000 on purpose;
|
|
336
|
+
* `full` stays inside 35,000.
|
|
334
337
|
*/
|
|
335
338
|
export const TOOLS_LIST_BYTE_BUDGET = {
|
|
336
|
-
basic:
|
|
339
|
+
basic: 15000,
|
|
337
340
|
full: 35000,
|
|
338
341
|
};
|
|
339
342
|
//# sourceMappingURL=tools.js.map
|
package/dist/config/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/config/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;GAEG;AACH,6EAA6E;AAC7E,2FAA2F;AAC3F,4EAA4E;AAC5E,4CAA4C;AAC5C,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,cAAc;IACd,wBAAwB;IACxB,YAAY;IACZ,wBAAwB;IACxB,qBAAqB;IACrB,sBAAsB;IACtB,iBAAiB;IACjB,iBAAiB;IACjB,uBAAuB;I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;QACvH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,IAAc;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;CACF;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;AAE3C,8CAA8C;AAC9C,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAqC;IACtE,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,KAAK;CACZ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NWS forecast discussion section of `get_forecast` (`include_discussion`).
|
|
3
|
+
*
|
|
4
|
+
* Garnish, and the one place its failure posture lives: `resolveForecastDiscussion`
|
|
5
|
+
* never rejects. Every failure becomes a one-line note for the product that failed,
|
|
6
|
+
* with one stderr warn (class only: no office, no coordinate, never the `Error`).
|
|
7
|
+
* The caller asked for the section, so a failure is said, never left silent; and a
|
|
8
|
+
* product that is not published is said as that, never as "no hazards".
|
|
9
|
+
*
|
|
10
|
+
* Each product is the office's newest AFD or HWO, rendered verbatim inside the one
|
|
11
|
+
* raw-text fence (`fenceRawText`, G116: nothing escaped or trimmed inside).
|
|
12
|
+
*/
|
|
13
|
+
import { NOAAService } from '../services/noaa.js';
|
|
14
|
+
import type { PointsResponse } from '../types/noaa.js';
|
|
15
|
+
import type { ResolvedLocation } from '../utils/locationResolver.js';
|
|
16
|
+
import type { UnitPreferences } from '../config/units.js';
|
|
17
|
+
/** A product text above this many UTF-8 bytes (4× the largest measured) is cut (GD2). */
|
|
18
|
+
export declare const DISCUSSION_TEXT_MAX_BYTES = 32768;
|
|
19
|
+
export declare const DISCUSSION_OUTSIDE_LINE = "Forecast discussions are published by US National Weather Service offices, and this location is outside the area they serve.";
|
|
20
|
+
export declare const DISCUSSION_OFFICE_UNAVAILABLE_LINE = "The NWS office for this location could not be retrieved, so its forecast discussion is not shown.";
|
|
21
|
+
/**
|
|
22
|
+
* Cut a text over `DISCUSSION_TEXT_MAX_BYTES` at the last newline before the bound.
|
|
23
|
+
* Returns the text unchanged when it fits.
|
|
24
|
+
*/
|
|
25
|
+
export declare function boundDiscussionText(text: string): {
|
|
26
|
+
text: string;
|
|
27
|
+
truncated: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The whole discussion section, starting with a blank line. Never rejects.
|
|
31
|
+
*
|
|
32
|
+
* @param pointsPromise The forecast's own NOAA `/points` request, when the forecast
|
|
33
|
+
* is on the NOAA path, so a cold call makes one `/points` request rather than two
|
|
34
|
+
* (plan-review codex-R2). On every other path the discussion makes its own, with
|
|
35
|
+
* no retry (garnish, G132).
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveForecastDiscussion(noaaService: NOAAService, resolved: ResolvedLocation, latitude: number, longitude: number, prefs: UnitPreferences, pointsPromise?: Promise<PointsResponse>): Promise<string>;
|
|
38
|
+
//# sourceMappingURL=forecastDiscussion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forecastDiscussion.d.ts","sourceRoot":"","sources":["../../src/handlers/forecastDiscussion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAA6B,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAa1D,yFAAyF;AACzF,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAIhD,eAAO,MAAM,uBAAuB,iIAC4F,CAAC;AAEjI,eAAO,MAAM,kCAAkC,sGACsD,CAAC;AAWtG;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAWtF;AAsCD;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,eAAe,EACtB,aAAa,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC,CA0DjB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NWS forecast discussion section of `get_forecast` (`include_discussion`).
|
|
3
|
+
*
|
|
4
|
+
* Garnish, and the one place its failure posture lives: `resolveForecastDiscussion`
|
|
5
|
+
* never rejects. Every failure becomes a one-line note for the product that failed,
|
|
6
|
+
* with one stderr warn (class only: no office, no coordinate, never the `Error`).
|
|
7
|
+
* The caller asked for the section, so a failure is said, never left silent; and a
|
|
8
|
+
* product that is not published is said as that, never as "no hazards".
|
|
9
|
+
*
|
|
10
|
+
* Each product is the office's newest AFD or HWO, rendered verbatim inside the one
|
|
11
|
+
* raw-text fence (`fenceRawText`, G116: nothing escaped or trimmed inside).
|
|
12
|
+
*/
|
|
13
|
+
import { NWS_PRODUCT_NOT_PUBLISHED } from '../services/noaa.js';
|
|
14
|
+
import { isNwsOfficeCandidate } from '../utils/nwsJurisdiction.js';
|
|
15
|
+
import { formatInTimezoneWithZone, guessTimezoneFromCoords } from '../utils/timezone.js';
|
|
16
|
+
import { logger } from '../utils/logger.js';
|
|
17
|
+
import { fenceRawText } from './aviationWeatherHandler.js';
|
|
18
|
+
const PRODUCT_NAMES = {
|
|
19
|
+
AFD: { name: 'Area Forecast Discussion', article: 'an' },
|
|
20
|
+
HWO: { name: 'Hazardous Weather Outlook', article: 'a' },
|
|
21
|
+
};
|
|
22
|
+
/** A product text above this many UTF-8 bytes (4× the largest measured) is cut (GD2). */
|
|
23
|
+
export const DISCUSSION_TEXT_MAX_BYTES = 32_768;
|
|
24
|
+
const OFFICE_PATTERN = /^[A-Z]{3}$/;
|
|
25
|
+
export const DISCUSSION_OUTSIDE_LINE = 'Forecast discussions are published by US National Weather Service offices, and this location is outside the area they serve.';
|
|
26
|
+
export const DISCUSSION_OFFICE_UNAVAILABLE_LINE = 'The NWS office for this location could not be retrieved, so its forecast discussion is not shown.';
|
|
27
|
+
function errorType(error) {
|
|
28
|
+
return error instanceof Error ? error.constructor.name : typeof error;
|
|
29
|
+
}
|
|
30
|
+
/** Luxon's locale output can carry U+202F / U+00A0 before AM/PM (G75); render plain spaces. */
|
|
31
|
+
function plainSpaces(text) {
|
|
32
|
+
return text.replace(/[\u202f\u00a0\u2009]/g, ' ');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Cut a text over `DISCUSSION_TEXT_MAX_BYTES` at the last newline before the bound.
|
|
36
|
+
* Returns the text unchanged when it fits.
|
|
37
|
+
*/
|
|
38
|
+
export function boundDiscussionText(text) {
|
|
39
|
+
const bytes = Buffer.from(text, 'utf8');
|
|
40
|
+
if (bytes.length <= DISCUSSION_TEXT_MAX_BYTES) {
|
|
41
|
+
return { text, truncated: false };
|
|
42
|
+
}
|
|
43
|
+
// A cut inside a multi-byte character decodes to U+FFFD; the newline cut below
|
|
44
|
+
// drops that tail, and the fallback strips it when the text has no newline.
|
|
45
|
+
const head = bytes.subarray(0, DISCUSSION_TEXT_MAX_BYTES).toString('utf8');
|
|
46
|
+
const lastNewline = head.lastIndexOf('\n');
|
|
47
|
+
const cut = lastNewline > 0 ? head.slice(0, lastNewline + 1) : head.replace(/\uFFFD$/, '');
|
|
48
|
+
return { text: cut, truncated: true };
|
|
49
|
+
}
|
|
50
|
+
function renderProduct(type, office, outcome, zone, prefs) {
|
|
51
|
+
const { name, article } = PRODUCT_NAMES[type];
|
|
52
|
+
if (outcome.status === 'rejected') {
|
|
53
|
+
logger.warn('Forecast discussion lookup failed; rendering a note', {
|
|
54
|
+
service: 'NOAA',
|
|
55
|
+
product: type,
|
|
56
|
+
errorType: errorType(outcome.reason),
|
|
57
|
+
securityEvent: false,
|
|
58
|
+
});
|
|
59
|
+
return `### ${name}\n\nThe latest ${name} could not be retrieved.\n`;
|
|
60
|
+
}
|
|
61
|
+
const product = outcome.value;
|
|
62
|
+
if (product === NWS_PRODUCT_NOT_PUBLISHED) {
|
|
63
|
+
return `### ${name}\n\n${office} does not publish ${article} ${name} through the NWS API.\n`;
|
|
64
|
+
}
|
|
65
|
+
const issued = plainSpaces(formatInTimezoneWithZone(product.issuanceTime, zone, 'medium', prefs.timeFormat));
|
|
66
|
+
const bounded = boundDiscussionText(product.productText);
|
|
67
|
+
let section = `### ${name} — issued ${issued}\n\n${fenceRawText(bounded.text)}\n`;
|
|
68
|
+
if (bounded.truncated) {
|
|
69
|
+
logger.warn('Forecast discussion product exceeds the text bound; truncated', {
|
|
70
|
+
service: 'NOAA',
|
|
71
|
+
product: type,
|
|
72
|
+
maxBytes: DISCUSSION_TEXT_MAX_BYTES,
|
|
73
|
+
securityEvent: true,
|
|
74
|
+
});
|
|
75
|
+
section += `\n*(Truncated at 32 KB; the full product is at https://api.weather.gov/products/${product.id}.)*\n`;
|
|
76
|
+
}
|
|
77
|
+
return section;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The whole discussion section, starting with a blank line. Never rejects.
|
|
81
|
+
*
|
|
82
|
+
* @param pointsPromise The forecast's own NOAA `/points` request, when the forecast
|
|
83
|
+
* is on the NOAA path, so a cold call makes one `/points` request rather than two
|
|
84
|
+
* (plan-review codex-R2). On every other path the discussion makes its own, with
|
|
85
|
+
* no retry (garnish, G132).
|
|
86
|
+
*/
|
|
87
|
+
export async function resolveForecastDiscussion(noaaService, resolved, latitude, longitude, prefs, pointsPromise) {
|
|
88
|
+
try {
|
|
89
|
+
// A false here is rendered as a negative claim, so the predicate errs wide
|
|
90
|
+
// (codex-R1). A true asserts nothing: the office is still resolved below.
|
|
91
|
+
if (!isNwsOfficeCandidate(latitude, longitude, resolved.country_code)) {
|
|
92
|
+
return `\n## Forecast discussion\n\n${DISCUSSION_OUTSIDE_LINE}\n`;
|
|
93
|
+
}
|
|
94
|
+
let points;
|
|
95
|
+
try {
|
|
96
|
+
points = await (pointsPromise ?? noaaService.getPointData(latitude, longitude, 0));
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
logger.warn('Forecast discussion lookup failed; rendering a note', {
|
|
100
|
+
service: 'NOAA',
|
|
101
|
+
product: 'office',
|
|
102
|
+
errorType: errorType(error),
|
|
103
|
+
securityEvent: false,
|
|
104
|
+
});
|
|
105
|
+
return `\n## Forecast discussion (NWS)\n\n${DISCUSSION_OFFICE_UNAVAILABLE_LINE}\n`;
|
|
106
|
+
}
|
|
107
|
+
const properties = points?.properties;
|
|
108
|
+
const office = properties?.cwa;
|
|
109
|
+
if (typeof office !== 'string' || !OFFICE_PATTERN.test(office)) {
|
|
110
|
+
logger.warn('Forecast discussion lookup failed; rendering a note', {
|
|
111
|
+
service: 'NOAA',
|
|
112
|
+
product: 'office',
|
|
113
|
+
errorType: 'UnusableOffice',
|
|
114
|
+
securityEvent: false,
|
|
115
|
+
});
|
|
116
|
+
return `\n## Forecast discussion (NWS)\n\n${DISCUSSION_OFFICE_UNAVAILABLE_LINE}\n`;
|
|
117
|
+
}
|
|
118
|
+
const zone = typeof properties?.timeZone === 'string' && properties.timeZone.length > 0
|
|
119
|
+
? properties.timeZone
|
|
120
|
+
: guessTimezoneFromCoords(latitude, longitude);
|
|
121
|
+
const [afd, hwo] = await Promise.allSettled([
|
|
122
|
+
noaaService.getLatestTextProduct('AFD', office),
|
|
123
|
+
noaaService.getLatestTextProduct('HWO', office),
|
|
124
|
+
]);
|
|
125
|
+
return (`\n## Forecast discussion (NWS ${office})\n\n` +
|
|
126
|
+
renderProduct('AFD', office, afd, zone, prefs) +
|
|
127
|
+
'\n' +
|
|
128
|
+
renderProduct('HWO', office, hwo, zone, prefs));
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
// Nothing above should throw; this keeps the never-rejects contract if it does.
|
|
132
|
+
logger.warn('Forecast discussion lookup failed; rendering a note', {
|
|
133
|
+
service: 'NOAA',
|
|
134
|
+
product: 'section',
|
|
135
|
+
errorType: errorType(error),
|
|
136
|
+
securityEvent: false,
|
|
137
|
+
});
|
|
138
|
+
return `\n## Forecast discussion (NWS)\n\n${DISCUSSION_OFFICE_UNAVAILABLE_LINE}\n`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=forecastDiscussion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forecastDiscussion.js","sourceRoot":"","sources":["../../src/handlers/forecastDiscussion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAe,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAI7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAI3D,MAAM,aAAa,GAA2D;IAC5E,GAAG,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,IAAI,EAAE;IACxD,GAAG,EAAE,EAAE,IAAI,EAAE,2BAA2B,EAAE,OAAO,EAAE,GAAG,EAAE;CACzD,CAAC;AAEF,yFAAyF;A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OAAO,UAAU,EAAE,QAAQ,KAAK,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YACxE,CAAC,CAAC,UAAU,CAAC,QAAQ;YACrB,CAAC,CAAC,uBAAuB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAEnD,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;YAC1C,WAAW,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC;YAC/C,WAAW,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC;SAChD,CAAC,CAAC;QAEH,OAAO,CACL,iCAAiC,MAAM,OAAO;YAC9C,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC;YAC9C,IAAI;YACJ,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAC/C,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gFAAgF;QAChF,MAAM,CAAC,IAAI,CAAC,qDAAqD,EAAE;YACjE,OAAO,EAAE,MAAM;YACf,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC;YAC3B,aAAa,EAAE,KAAK;SACrB,CAAC,CAAC;QACH,OAAO,qCAAqC,kCAAkC,IAAI,CAAC;IACrF,CAAC;AACH,CAAC"}
|
|
@@ -8,8 +8,9 @@ import { NCEIService } from '../services/ncei.js';
|
|
|
8
8
|
import { AcisService } from '../services/acis.js';
|
|
9
9
|
import { LocationStore } from '../services/locationStore.js';
|
|
10
10
|
import { GeocodingService } from '../services/geocoding.js';
|
|
11
|
+
import type { SpcService } from '../services/spc.js';
|
|
11
12
|
import { MetnoService } from '../services/metno.js';
|
|
12
|
-
export declare function handleGetForecast(args: unknown, noaaService: NOAAService, openMeteoService: OpenMeteoService, locationStore: LocationStore, geocodingService: GeocodingService, nceiService?: NCEIService, acisService?: AcisService, criticalAlertBanner?: boolean, metnoService?: MetnoService): Promise<{
|
|
13
|
+
export declare function handleGetForecast(args: unknown, noaaService: NOAAService, openMeteoService: OpenMeteoService, locationStore: LocationStore, geocodingService: GeocodingService, nceiService?: NCEIService, acisService?: AcisService, criticalAlertBanner?: boolean, metnoService?: MetnoService, spcService?: SpcService): Promise<{
|
|
13
14
|
content: Array<{
|
|
14
15
|
type: string;
|
|
15
16
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forecastHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/forecastHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"forecastHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/forecastHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAa5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAmDrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AA2JpD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,mBAAmB,CAAC,EAAE,OAAO,EAU7B,YAAY,CAAC,EAAE,YAAY,EAI3B,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAoX7D"}
|
|
@@ -6,6 +6,8 @@ import { DateTime } from 'luxon';
|
|
|
6
6
|
import { validateForecastDays, validateGranularity, validateOptionalBoolean, validateDetail, } from '../utils/validation.js';
|
|
7
7
|
import { resolveLocationAsync, formatLocationLine, prependCriticalAlertBanner } from '../utils/locationResolver.js';
|
|
8
8
|
import { resolveCriticalAlertBanner, carryCriticalAlertBannerOnError } from './criticalAlertBanner.js';
|
|
9
|
+
import { resolveForecastDiscussion } from './forecastDiscussion.js';
|
|
10
|
+
import { resolveSpcOutlookLines } from './spcOutlookLine.js';
|
|
9
11
|
import { resolveUnitPreferences } from '../utils/unitPreferences.js';
|
|
10
12
|
import { temperatureLabel, windSpeedLabel, precipitationLabel, noaaUnitsParam, formatElevationFromM, formatLuxonTime, formatTemperatureFromC, formatWindFromMps, formatPrecipFromMm, } from '../utils/unitFormat.js';
|
|
11
13
|
import { logger, redactCoordinatesForLogging } from '../utils/logger.js';
|
|
@@ -147,7 +149,11 @@ export async function handleGetForecast(args, noaaService, openMeteoService, loc
|
|
|
147
149
|
// arguments, dropping `acisService` and `criticalAlertBanner`, so it has to
|
|
148
150
|
// pass `undefined, undefined, metnoService` to reach this slot — appending
|
|
149
151
|
// one argument there would bind the service to `acisService`.
|
|
150
|
-
metnoService
|
|
152
|
+
metnoService,
|
|
153
|
+
// Tenth and trailing. Only the `get_forecast` dispatch passes it; the summary
|
|
154
|
+
// passes nine positionals, so the slot is `undefined` there by construction and
|
|
155
|
+
// the SPC line never reaches the summary (G93).
|
|
156
|
+
spcService) {
|
|
151
157
|
// Resolve location from coordinates, a saved location name, or a geocoded city name
|
|
152
158
|
const resolved = await resolveLocationAsync(args, locationStore, geocodingService);
|
|
153
159
|
const { latitude, longitude } = resolved;
|
|
@@ -167,6 +173,9 @@ metnoService) {
|
|
|
167
173
|
// include_* garnish flags — this replaces the forecast product entirely,
|
|
168
174
|
// so its parameter conflicts are errors rather than silent no-ops.
|
|
169
175
|
const ensemble_spread = validateOptionalBoolean(args?.ensemble_spread, 'ensemble_spread', false);
|
|
176
|
+
// The local NWS office's latest AFD and HWO, verbatim. Garnish, decided by
|
|
177
|
+
// place rather than source: it renders on every forecast path.
|
|
178
|
+
const include_discussion = validateOptionalBoolean(args?.include_discussion, 'include_discussion', false);
|
|
170
179
|
// Output verbosity: caps hourly output unless detail="full" (see hourlyEntryCap)
|
|
171
180
|
const detail = validateDetail(args?.detail);
|
|
172
181
|
// Resolve unit preferences (per-call params over the server default)
|
|
@@ -227,6 +236,28 @@ metnoService) {
|
|
|
227
236
|
else {
|
|
228
237
|
useNOAA = requestedSource === 'noaa';
|
|
229
238
|
}
|
|
239
|
+
// The forecast discussion starts here, beside the banner, and never rejects.
|
|
240
|
+
// On the NOAA primary path the forecast and the discussion share one `/points`
|
|
241
|
+
// request with the forecast's own retry contract (plan-review codex-R2): two
|
|
242
|
+
// concurrent cold calls would each miss the cache. Every other path leaves the
|
|
243
|
+
// discussion to make its own garnish request.
|
|
244
|
+
const noaaPrimary = useNOAA && granularity !== 'minutely' && !ensemble_spread && !compare_models;
|
|
245
|
+
const sharedPointsPromise = include_discussion && noaaPrimary ? noaaService.getPointData(latitude, longitude) : undefined;
|
|
246
|
+
const discussionPromise = include_discussion
|
|
247
|
+
? resolveForecastDiscussion(noaaService, resolved, latitude, longitude, prefs, sharedPointsPromise)
|
|
248
|
+
: undefined;
|
|
249
|
+
// The SPC convective outlook line: positive-assertion-only, never rejects.
|
|
250
|
+
// Only days whose window overlaps the requested range qualify: the next 2 h
|
|
251
|
+
// for the nowcast, else from now to the end of the last requested local day.
|
|
252
|
+
let spcPromise;
|
|
253
|
+
if (spcService) {
|
|
254
|
+
const spcZone = guessTimezoneFromCoords(latitude, longitude);
|
|
255
|
+
const nowMs = Date.now();
|
|
256
|
+
const rangeEndMs = granularity === 'minutely'
|
|
257
|
+
? nowMs + 2 * 60 * 60 * 1000
|
|
258
|
+
: DateTime.fromMillis(nowMs, { zone: spcZone }).startOf('day').plus({ days }).toMillis();
|
|
259
|
+
spcPromise = resolveSpcOutlookLines(spcService, latitude, longitude, spcZone, prefs.timeFormat, nowMs, rangeEndMs);
|
|
260
|
+
}
|
|
230
261
|
// Use NOAA for US locations or if explicitly requested
|
|
231
262
|
let result;
|
|
232
263
|
try {
|
|
@@ -256,7 +287,7 @@ metnoService) {
|
|
|
256
287
|
}
|
|
257
288
|
else if (useNOAA) {
|
|
258
289
|
try {
|
|
259
|
-
result = await formatNOAAForecast(noaaService, openMeteoService, nceiService, latitude, longitude, days, granularity, include_precipitation_probability, include_severe_weather, include_normals, include_astronomy, prefs, detail, acisService);
|
|
290
|
+
result = await formatNOAAForecast(noaaService, openMeteoService, nceiService, latitude, longitude, days, granularity, include_precipitation_probability, include_severe_weather, include_normals, include_astronomy, prefs, detail, acisService, sharedPointsPromise);
|
|
260
291
|
}
|
|
261
292
|
catch (error) {
|
|
262
293
|
// The US bounding boxes overrun the border (Toronto, Vancouver, Windsor
|
|
@@ -341,6 +372,21 @@ metnoService) {
|
|
|
341
372
|
// original error untouched and the existing error contract is unchanged.
|
|
342
373
|
throw carryCriticalAlertBannerOnError(error, bannerPromise ? await bannerPromise : '');
|
|
343
374
|
}
|
|
375
|
+
// Appended after the forecast body; the location line and banner below are
|
|
376
|
+
// prepended, so their order is unchanged.
|
|
377
|
+
// The SPC lines first, directly under the forecast body, then the discussion.
|
|
378
|
+
if (spcPromise) {
|
|
379
|
+
const spcLines = await spcPromise;
|
|
380
|
+
if (spcLines && result.content.length > 0 && result.content[0]?.type === 'text') {
|
|
381
|
+
result.content[0].text += '\n' + spcLines;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (discussionPromise) {
|
|
385
|
+
const discussion = await discussionPromise;
|
|
386
|
+
if (result.content.length > 0 && result.content[0]?.type === 'text') {
|
|
387
|
+
result.content[0].text += discussion;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
344
390
|
// If the location was resolved from a name (saved or geocoded), show the user
|
|
345
391
|
// what it matched so an ambiguous city name is transparent.
|
|
346
392
|
const locationLine = formatLocationLine(resolved);
|
|
@@ -417,14 +463,17 @@ async function formatMinutelyNowcast(openMeteoService, latitude, longitude, incl
|
|
|
417
463
|
/**
|
|
418
464
|
* Format NOAA forecast data for display
|
|
419
465
|
*/
|
|
420
|
-
async function formatNOAAForecast(noaaService, openMeteoService, nceiService, latitude, longitude, days, granularity, include_precipitation_probability, include_severe_weather, include_normals, include_astronomy, prefs, detail, acisService
|
|
466
|
+
async function formatNOAAForecast(noaaService, openMeteoService, nceiService, latitude, longitude, days, granularity, include_precipitation_probability, include_severe_weather, include_normals, include_astronomy, prefs, detail, acisService,
|
|
467
|
+
// The handler's shared `/points` request when the discussion also needs it
|
|
468
|
+
// (codex-R2); absent, this renderer makes its own exactly as before.
|
|
469
|
+
pointsPromise) {
|
|
421
470
|
const noaaUnits = noaaUnitsParam(prefs);
|
|
422
471
|
// Fetch point data once. It yields both the timezone AND the grid coordinates,
|
|
423
472
|
// so downstream forecast/gridpoint calls use the grid-based methods directly
|
|
424
473
|
// instead of re-resolving the point (avoids duplicate upstream lookups on a
|
|
425
474
|
// cold cache). A point-data failure here propagates — the forecast can't be
|
|
426
475
|
// built without it anyway.
|
|
427
|
-
const points = await noaaService.getPointData(latitude, longitude);
|
|
476
|
+
const points = await (pointsPromise ?? noaaService.getPointData(latitude, longitude));
|
|
428
477
|
const { gridId, gridX, gridY } = points.properties;
|
|
429
478
|
const timezone = points.properties.timeZone || guessTimezoneFromCoords(latitude, longitude);
|
|
430
479
|
// Get forecast data based on granularity (units=us|si controls NWS output units)
|