'Januar', 2 => 'Februar', 3 => 'März', 4 => 'April', 5 => 'Mai', 6 => 'Juni', 7 => 'Juli', 8 => 'August', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Dezember', ]; $monthSkyTimes = [ 1 => ['hour' => 22, 'minute' => 0], 2 => ['hour' => 22, 'minute' => 0], 3 => ['hour' => 22, 'minute' => 0], 4 => ['hour' => 23, 'minute' => 0], 5 => ['hour' => 23, 'minute' => 0], 6 => ['hour' => 23, 'minute' => 30], 7 => ['hour' => 23, 'minute' => 30], 8 => ['hour' => 23, 'minute' => 0], 9 => ['hour' => 23, 'minute' => 0], 10 => ['hour' => 23, 'minute' => 0], 11 => ['hour' => 22, 'minute' => 0], 12 => ['hour' => 22, 'minute' => 0], ]; $selectedSkyTime = $monthSkyTimes[$selectedMonth] ?? ['hour' => 22, 'minute' => 0]; require __DIR__ . '/header.php'; $chartLocationName = (string) (($currentLocation['name'] ?? null) ?: 'Sternwarte Sonneberg'); $chartLatitude = isset($currentLocation['latitude']) ? (float) $currentLocation['latitude'] : 50.3547; $chartLongitude = isset($currentLocation['longitude']) ? (float) $currentLocation['longitude'] : 11.1900; $chartElevation = isset($currentLocation['elevation']) && $currentLocation['elevation'] !== null ? (float) $currentLocation['elevation'] : 640.0; $chartTimezone = (string) (($currentLocation['timezone'] ?? null) ?: 'Europe/Berlin'); $pythonExecutable = PHP_OS_FAMILY === 'Windows' ? 'python' : '/usr/bin/python'; $pythonScriptPath = __DIR__ . '/py/api.py'; $pythonOutput = []; $pythonExitCode = 0; $pythonPayload = null; $pythonError = null; $pythonArgs = [ $pythonScriptPath, 'month_sky_context', (string) $chartLatitude, (string) $chartLongitude, (string) $chartElevation, (string) $selectedYear, (string) $selectedMonth, (string) ((int) $selectedSkyTime['hour']), (string) ((int) $selectedSkyTime['minute']), $chartTimezone, ]; $command = $pythonExecutable . ' ' . implode(' ', array_map('escapeshellarg', $pythonArgs)) . ' 2>&1'; exec($command, $pythonOutput, $pythonExitCode); $pythonRaw = trim(implode("\n", $pythonOutput)); if ($pythonExitCode !== 0) { $pythonError = $pythonRaw !== '' ? $pythonRaw : 'Python-Aufruf fehlgeschlagen.'; } else { $decoded = json_decode($pythonRaw, true); if (!is_array($decoded)) { $pythonError = $pythonRaw !== '' ? $pythonRaw : 'Python lieferte kein gültiges JSON.'; } elseif (!($decoded['ok'] ?? false)) { $pythonError = (string) ($decoded['error'] ?? 'Python meldete einen Fehler.'); } else { $pythonPayload = $decoded; } } $bodyRows = []; if (is_array($pythonPayload['bodies'] ?? null)) { $bodyRows[] = $pythonPayload['bodies']['sun'] ?? null; $bodyRows[] = $pythonPayload['bodies']['moon'] ?? null; foreach (($pythonPayload['bodies']['planets'] ?? []) as $planet) { $bodyRows[] = $planet; } $bodyRows = array_values(array_filter($bodyRows, static fn ($row) => is_array($row))); } $formatNumber = static function ($value, int $decimals = 1): string { if (!is_numeric($value)) { return '–'; } return number_format((float) $value, $decimals, ',', ''); }; ?>

Serverseitige Monatsbasis

Diese Vorschau läuft jetzt ohne Browser-Rechenlogik über die Python-AstronomyEngine. Damit ist der erste Baustein für den späteren Cronjob vorhanden: Datum, Standort und Himmelskoordinaten kommen bereits serverseitig aus public/py/api.py.

Ausgewählter Monat
Ziel-Uhrzeit
Standort
°, °
Zeitzone

Python-Snapshot

Lokalzeit
UTC
Lokale Sternzeit h
Mondphase
Objekt Höhe Azimut RA Dekl. Mag. Sichtbar
° ° h °

Nächste Schritte

  1. Python ergänzt als Nächstes Sterne, Messier-Objekte und Sternbildlinien für genau diesen Monatszeitpunkt.
  2. Danach ziehen wir die Projektionen und das serverseitige Bildrendering nach, damit die Ausgabe cronjob-tauglich als PNG erzeugt werden kann.
  3. Die bisherige Browser-Vorschau bleibt vorerst als fachliche Referenz erhalten.