Files
sky-cam/moon-phase-monthly.sh
T
Claude 5fb7ff09a3 Add nightly moon-track timelapse and monthly moon-phase composites
Two new jobs operate on the SUNRISE_CAM, sharing three Python helpers
(moon_phase, moon_detect, moon_composite) and one cached lunar texture:

- moon-track.sh: nightly batch detects the moon in each east frame,
  crops a 480x480 box around it, stitches into an mp4 that holds the
  moon roughly centred while clouds and stars drift past.

- moon-phase-monthly.sh: daily check that runs whichever phase composite
  is due that day. Handles full moon (posts D+3), first quarter (D+2,
  best-effort due to daytime-only geometry from east), and third quarter
  (D+2). Picks the frame closest in time to the exact phase moment that
  meets quality / altitude / illumination thresholds, then composites
  the cached lunar texture into it -- sky/halo/parallactic-angle/timing
  real from east, surface detail borrowed from the reference image.

Honest-by-design: a 38-px white blob from a wide-field IP camera cannot
be enhanced into crater detail by software. The composite makes the
borrowing explicit and constrains everything else (when, where, sky,
orientation) to match what east actually saw.

install.sh now downloads the skyfield ephemeris (de421.bsp) and the
default lunar reference (Wikipedia CC BY-SA full-moon photo) on first
run. Both can be overridden via .env.

https://claude.ai/code/session_015PBVDESC3KLMbq1LpA6qLn
2026-04-30 11:40:11 +00:00

26 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# moon-phase-monthly.sh — thin wrapper around moon_phase_monthly.py.
#
# Run via systemd daily. In auto mode (no flags) the Python helper checks
# all three phases (full, first-quarter, third-quarter) and runs the composite
# for any whose post-day equals today UTC. If you scheduled the timer for
# 09:30 local, you'll see posts hit Mattermost at:
#
# Full Moon 3 days after exact full moon
# First Quarter 2 days after exact first quarter (best-effort — daytime)
# Third Quarter 2 days after exact third quarter
#
# Manual:
# ./moon-phase-monthly.sh # auto mode
# ./moon-phase-monthly.sh --dry-run # auto, no post
# ./moon-phase-monthly.sh --phase full # force most recent full
# ./moon-phase-monthly.sh --phase third-quarter --target 2026-04-09T11:51:00Z
set -euo pipefail
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "$SCRIPT_DIR/sky-cam.conf"
export TZ="$TIMEZONE"
exec python3 "$SCRIPT_DIR/moon_phase_monthly.py" "$@"