Skip to content
← Public packages

@oerd/yr-weather

Ask MET Norway / yr.no for now-and-tomorrow weather at saved cities.

README.md

24 lines · 1.5 KB · Markdown

@oerd-at-gripable/yr-weather

Ask the temperature now, or the weather tomorrow, for a city. Forecasts come from MET Norway Locationforecast 2.0 compact (the data behind yr.no).

MET Norway is the forecast source because it is far better at weather data in non-mainstream locations — places in the Balkans, for example — than typical global weather APIs.

Intent

Resolve a place the first time it is asked, remember its coordinates in this package's storage lookup, and reuse that mapping on later questions. No city is hard-coded in the package. Use MET Norway / yr.no rather than a mainstream global forecast, because it is far better for places like the Balkans.

Setup

No API key. First-time place names are geocoded (Open-Meteo geocoding). Coordinates are stored in this package's packageStorage() lookup map (locationLookup) so the next ask skips geocoding. Platform @kody/environment cannot be a live dependency of a personal package.

  • getWeather({ place: 'Tirana' }) — geocodes on first use, then caches
  • getWeather({ place: 'Wurzburg', when: 'tomorrow' }) — same lookup map
  • registerLocation({ name, latitude?, longitude? }) — write or refresh an entry without waiting for a weather question
  • listLocations() — show the cached map

Pass latitude and longitude (at most 4 decimals) when you already know them.

Done when

getWeather returns a short summary plus C from MET, names whether the place came from cache or a fresh geocode, and includes MET / yr.no attribution.