Files
rickzkmandClaude Opus 5.5 2132262896 Sky and ISS views
Two new views, picked from mockups. `sky`: a star chart of the sky over
Zlín as seen lying on your back, with the planets, the moon in its phase,
tonight's darkness, cloud for the next 12 hours and the next visible ISS
pass. `iss`: a dotted world map with day and night, the ISS and its ground
track, and the next pass over Zlín with the cloud cover for that hour.

Positions are calculated locally with ephem; only the ISS orbit
(CelesTrak, every 6 h, retried gently) and cloud cover (Open-Meteo) are
fetched. The poller gained a per-source retry delay for that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 00:03:38 +01:00

30 lines
852 B
Python

from PIL import Image
import skykit
from tests.helpers import count_colour
LIT, DARK, BG = (255, 255, 255), (40, 40, 40), (0, 0, 0)
def moon(pct, waxing):
img = Image.new("RGB", (40, 40), BG)
skykit.moon_disc(img, 20, 20, 16, pct, waxing, lit=LIT, dark=DARK)
return img
def lit(img, box=None):
return count_colour(img, LIT, box)
def test_waxing_moon_is_lit_on_the_right_waning_on_the_left():
waxing, waning = moon(50, True), moon(50, False)
assert lit(waxing, (20, 0, 40, 40)) > 10 * max(1, lit(waxing, (0, 0, 20, 40)))
assert lit(waning, (0, 0, 20, 40)) > 10 * max(1, lit(waning, (20, 0, 40, 40)))
def test_lit_area_grows_with_illumination():
areas = [lit(moon(pct, True)) for pct in (0, 10, 50, 90, 100)]
assert areas == sorted(areas)
assert areas[0] == 0
assert areas[-1] > 0.9 * 3.14 * 16 * 16