sky_positions
Compute accurate sun, moon, and planet positions for any location and time, with rise/set, phase, twilight, and season events.
Instructions
Sun, Moon and planet positions and events for a place and time.
Call this instead of recalling ephemeris values from memory: rise/set times, moon phase and body positions depend on a multi-megabyte JPL kernel and are not reliably predictable token-by-token.
Args: lat: Geodetic latitude in degrees, -90 to 90. lon: Longitude in degrees, -180 to 180. elevation_m: Observer height above sea level in metres. Defaults to 0. when: ISO date/datetime or "now". Defaults to "now" (UTC).
Returns: JSON-serializable dict with: - bodies: for the Sun and Moon, altitude_deg/azimuth_deg, above_horizon, distance_km and distance_au, plus ecliptic ("zodiac") sign - sun: rise/set/transit times and day_length_hours - moon: rise/set/transit, phase_angle_deg, illuminated_fraction, phase_name and the next new/full moons - twilight: the four twilight-phase times - next_season_event: the next equinox or solstice - query: echoed inputs and resolved UTC time; plus kernel, engine, deterministic Times are ISO-8601 UTC; angles in degrees.
Raises: ValueError: if lat or lon is out of range.
Computed from the public-domain JPL DE421 kernel via skyfield, cross-checked against an independent engine to ~1 arcsecond. Deterministic: same inputs → same output. github.com/savecharlie/almanac
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lat | Yes | ||
| lon | Yes | ||
| when | No | ||
| elevation_m | No |