Skip to content
← Public packages

@oerd/yr-weather

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

AGENTS.md

37 lines · 1.4 KB · Markdown

@oerd-at-gripable/yr-weather

Human overview: README.md. MET Norway fetch. Place coordinates live in packageStorage() key locationLookup. Unknown names geocode once (Open-Meteo), then hit the map. No city is hard-coded.

Imports

import getWeather from 'kody:@oerd-at-gripable/yr-weather/getWeather'
import registerLocation from 'kody:@oerd-at-gripable/yr-weather/registerLocation'
import listLocations from 'kody:@oerd-at-gripable/yr-weather/listLocations'

Root kody:@oerd-at-gripable/yr-weather is the same as getWeather. Prefer static imports from execute.

Smoke tests

import getWeather from 'kody:@oerd-at-gripable/yr-weather/getWeather'
import listLocations from 'kody:@oerd-at-gripable/yr-weather/listLocations'

export default async function main() {
	const first = await getWeather({ place: 'Tirana' })
	const again = await getWeather({ place: 'Tirana' })
	const tomorrow = await getWeather({ place: 'Wurzburg', when: 'tomorrow' })
	const places = await listLocations()
	return { first, again, tomorrow, places }
}

Expect first.resolvedFrom to be cache if already stored, otherwise geocoded. again.resolvedFrom should be cache.

Edge cases

  • Unknown names are geocoded once, then served from the lookup map.
  • when is only now or tomorrow.
  • Honor MET cache headers; at most 4 decimal lat/lon.
  • Always keep the attribution string on results.