Skip to content

weather

Look up current weather for a city or zip code, and convert between Celsius and Fahrenheit. No API key required.

ts
import { weather } from "std::weather"

node main() {
  const w = weather("San Francisco")
  print(w)
}

Weather data comes from Open-Meteo (https://open-meteo.com), licensed under CC BY 4.0, for non-commercial use.

Types

Effects

std::weather

ts
effect std::weather {
  location: string;
  units: string
}

(source)

Functions

weather

ts
weather(location: string, units: "imperial" | "metric"): Result

Get current weather for a city name or zip code. Returns temperature, feels-like temperature, humidity, wind speed/direction, precipitation, cloud cover, and a text description.

@param location - City name or zip code @param units - "imperial" for Fahrenheit/mph, "metric" for Celsius/km/h

Usage from Agency code: import { weather } from "std::weather"

node main() { const w = weather("San Francisco") print(w) }

Open-Meteo (https://open-meteo.com) provides the weather data, licensed under CC BY 4.0. Free API usage is for non-commercial purposes only.

Parameters:

NameTypeDefault
locationstring
units"imperial" | "metric""imperial"

Returns: Result

Throws: std::weather

(source)

celsiusToFahrenheit

ts
celsiusToFahrenheit(celsius: number): number

Parameters:

NameTypeDefault
celsiusnumber

Returns: number

(source)

fahrenheitToCelsius

ts
fahrenheitToCelsius(fahrenheit: number): number

Parameters:

NameTypeDefault
fahrenheitnumber

Returns: number

(source)