diff --git a/.codex-temp/php-server.err.log b/.codex-temp/php-server.err.log index cc1a430..ef6c2ae 100644 --- a/.codex-temp/php-server.err.log +++ b/.codex-temp/php-server.err.log @@ -281,3 +281,207 @@ Stack trace: [Fri Apr 3 13:40:28 2026] 127.0.0.1:63117 Accepted [Fri Apr 3 13:40:30 2026] 127.0.0.1:63117 [200]: GET /favicon.ico [Fri Apr 3 13:40:30 2026] 127.0.0.1:63117 Closing +[Fri Apr 3 13:43:20 2026] 127.0.0.1:61568 Accepted +[Fri Apr 3 13:43:29 2026] 127.0.0.1:61568 [200]: GET /monatsvorhersage_old.php?year=2026&month=4 +[Fri Apr 3 13:43:29 2026] 127.0.0.1:61568 Closing +[Fri Apr 3 13:44:59 2026] 127.0.0.1:63182 Accepted +[Fri Apr 3 13:45:07 2026] 127.0.0.1:63182 [200]: GET /monatsvorhersage_old.php?year=2026&month=8 +[Fri Apr 3 13:45:07 2026] 127.0.0.1:63182 Closing +[Fri Apr 3 13:45:07 2026] 127.0.0.1:51825 Accepted +[Fri Apr 3 13:45:07 2026] 127.0.0.1:51825 [200]: GET /css/style.css +[Fri Apr 3 13:45:07 2026] 127.0.0.1:51825 Closing +[Fri Apr 3 13:45:07 2026] 127.0.0.1:56032 Accepted +[Fri Apr 3 13:45:07 2026] 127.0.0.1:56032 [200]: GET /js/astronomy.browser.min.js +[Fri Apr 3 13:45:07 2026] 127.0.0.1:56032 Closing +[Fri Apr 3 13:45:07 2026] 127.0.0.1:63778 Accepted +[Fri Apr 3 13:45:07 2026] 127.0.0.1:63778 [200]: GET /images/star16x16.png +[Fri Apr 3 13:45:07 2026] 127.0.0.1:59176 Accepted +[Fri Apr 3 13:45:07 2026] 127.0.0.1:59176 [200]: GET /images/star16x16_rays.png +[Fri Apr 3 13:45:07 2026] 127.0.0.1:63778 Closing +[Fri Apr 3 13:45:07 2026] 127.0.0.1:59176 Closing +[Fri Apr 3 13:45:08 2026] 127.0.0.1:50275 Accepted +[Fri Apr 3 13:45:09 2026] 127.0.0.1:50275 [200]: GET /favicon.ico +[Fri Apr 3 13:45:09 2026] 127.0.0.1:50275 Closing +[Fri Apr 3 13:46:38 2026] 127.0.0.1:58386 Accepted +[Fri Apr 3 13:46:53 2026] 127.0.0.1:58386 [200]: GET /monatsvorhersage_old.php?year=2026&month=1 +[Fri Apr 3 13:46:53 2026] 127.0.0.1:58386 Closing +[Fri Apr 3 13:46:53 2026] 127.0.0.1:64800 Accepted +[Fri Apr 3 13:47:02 2026] 127.0.0.1:64800 [200]: GET /monatsvorhersage_old.php?year=2026&month=8 +[Fri Apr 3 13:47:02 2026] 127.0.0.1:64800 Closing +[Fri Apr 3 13:47:02 2026] 127.0.0.1:58666 Accepted +[Fri Apr 3 13:47:02 2026] 127.0.0.1:58666 [200]: GET /css/style.css +[Fri Apr 3 13:47:02 2026] 127.0.0.1:57926 Accepted +[Fri Apr 3 13:47:02 2026] 127.0.0.1:57926 [200]: GET /js/astronomy.browser.min.js +[Fri Apr 3 13:47:02 2026] 127.0.0.1:58666 Closing +[Fri Apr 3 13:47:02 2026] 127.0.0.1:57926 Closing +[Fri Apr 3 13:47:02 2026] 127.0.0.1:56331 Accepted +[Fri Apr 3 13:47:02 2026] 127.0.0.1:58939 Accepted +[Fri Apr 3 13:47:02 2026] 127.0.0.1:56331 [200]: GET /images/star16x16.png +[Fri Apr 3 13:47:02 2026] 127.0.0.1:58939 [200]: GET /images/star16x16_rays.png +[Fri Apr 3 13:47:02 2026] 127.0.0.1:56331 Closing +[Fri Apr 3 13:47:02 2026] 127.0.0.1:58939 Closing +[Fri Apr 3 13:47:02 2026] 127.0.0.1:50616 Accepted +[Fri Apr 3 13:47:03 2026] 127.0.0.1:50616 [200]: GET /favicon.ico +[Fri Apr 3 13:47:03 2026] 127.0.0.1:50616 Closing +[Fri Apr 3 13:47:15 2026] 127.0.0.1:57631 Accepted +[Fri Apr 3 13:47:30 2026] 127.0.0.1:57631 [200]: GET /monatsvorhersage_old.php?year=2026&month=1 +[Fri Apr 3 13:47:30 2026] 127.0.0.1:57631 Closing +[Fri Apr 3 13:47:30 2026] 127.0.0.1:55628 Accepted +[Fri Apr 3 13:47:30 2026] 127.0.0.1:58335 Accepted +[Fri Apr 3 13:47:30 2026] 127.0.0.1:55628 [200]: GET /css/style.css +[Fri Apr 3 13:47:30 2026] 127.0.0.1:58335 [200]: GET /js/astronomy.browser.min.js +[Fri Apr 3 13:47:30 2026] 127.0.0.1:55628 Closing +[Fri Apr 3 13:47:30 2026] 127.0.0.1:58335 Closing +[Fri Apr 3 13:47:30 2026] 127.0.0.1:49979 Accepted +[Fri Apr 3 13:47:30 2026] 127.0.0.1:64153 Accepted +[Fri Apr 3 13:47:30 2026] 127.0.0.1:49979 [200]: GET /images/star16x16.png +[Fri Apr 3 13:47:30 2026] 127.0.0.1:64153 [200]: GET /images/star16x16_rays.png +[Fri Apr 3 13:47:30 2026] 127.0.0.1:49979 Closing +[Fri Apr 3 13:47:30 2026] 127.0.0.1:64153 Closing +[Fri Apr 3 13:47:30 2026] 127.0.0.1:58580 Accepted +[Fri Apr 3 13:47:31 2026] 127.0.0.1:58580 [200]: GET /favicon.ico +[Fri Apr 3 13:47:31 2026] 127.0.0.1:58580 Closing +[Fri Apr 3 13:48:57 2026] 127.0.0.1:62922 Accepted +[Fri Apr 3 13:49:05 2026] 127.0.0.1:62922 [200]: GET /monatsvorhersage_old.php?year=2026&month=6 +[Fri Apr 3 13:49:05 2026] 127.0.0.1:62922 Closing +[Fri Apr 3 13:49:05 2026] 127.0.0.1:57024 Accepted +[Fri Apr 3 13:49:05 2026] 127.0.0.1:57025 Accepted +[Fri Apr 3 13:49:05 2026] 127.0.0.1:57024 [200]: GET /css/style.css +[Fri Apr 3 13:49:21 2026] 127.0.0.1:57025 [200]: GET /monatsvorhersage_old.php?year=2026&month=1 +[Fri Apr 3 13:49:21 2026] 127.0.0.1:57025 Closing +[Fri Apr 3 13:49:21 2026] 127.0.0.1:51002 Accepted +[Fri Apr 3 13:49:21 2026] 127.0.0.1:51002 [200]: GET /js/astronomy.browser.min.js +[Fri Apr 3 13:49:21 2026] 127.0.0.1:57024 Closing +[Fri Apr 3 13:49:21 2026] 127.0.0.1:51002 Closing +[Fri Apr 3 13:49:21 2026] 127.0.0.1:54937 Accepted +[Fri Apr 3 13:49:21 2026] 127.0.0.1:54937 [200]: GET /images/star16x16.png +[Fri Apr 3 13:49:21 2026] 127.0.0.1:54119 Accepted +[Fri Apr 3 13:49:21 2026] 127.0.0.1:54119 [200]: GET /images/star16x16_rays.png +[Fri Apr 3 13:49:21 2026] 127.0.0.1:54937 Closing +[Fri Apr 3 13:49:21 2026] 127.0.0.1:54119 Closing +[Fri Apr 3 13:49:21 2026] 127.0.0.1:61998 Accepted +[Fri Apr 3 13:49:22 2026] 127.0.0.1:61998 [200]: GET /favicon.ico +[Fri Apr 3 13:49:22 2026] 127.0.0.1:61998 Closing +[Fri Apr 3 13:49:39 2026] 127.0.0.1:50955 Accepted +[Fri Apr 3 13:49:47 2026] 127.0.0.1:50955 [200]: GET /monatsvorhersage_old.php?year=2026&month=6 +[Fri Apr 3 13:49:47 2026] 127.0.0.1:50955 Closing +[Fri Apr 3 13:49:47 2026] 127.0.0.1:57414 Accepted +[Fri Apr 3 13:49:47 2026] 127.0.0.1:57414 [200]: GET /css/style.css +[Fri Apr 3 13:49:47 2026] 127.0.0.1:57414 Closing +[Fri Apr 3 13:49:47 2026] 127.0.0.1:51870 Accepted +[Fri Apr 3 13:49:47 2026] 127.0.0.1:51870 [200]: GET /js/astronomy.browser.min.js +[Fri Apr 3 13:49:47 2026] 127.0.0.1:51870 Closing +[Fri Apr 3 13:49:47 2026] 127.0.0.1:50802 Accepted +[Fri Apr 3 13:49:47 2026] 127.0.0.1:50802 [200]: GET /images/star16x16.png +[Fri Apr 3 13:49:47 2026] 127.0.0.1:50540 Accepted +[Fri Apr 3 13:49:47 2026] 127.0.0.1:50540 [200]: GET /images/star16x16_rays.png +[Fri Apr 3 13:49:47 2026] 127.0.0.1:50802 Closing +[Fri Apr 3 13:49:47 2026] 127.0.0.1:50540 Closing +[Fri Apr 3 13:49:47 2026] 127.0.0.1:51123 Accepted +[Fri Apr 3 13:49:48 2026] 127.0.0.1:51123 [200]: GET /favicon.ico +[Fri Apr 3 13:49:48 2026] 127.0.0.1:51123 Closing +[Fri Apr 3 13:50:26 2026] 127.0.0.1:57344 Accepted +[Fri Apr 3 13:50:34 2026] 127.0.0.1:57344 [200]: GET /monatsvorhersage_old.php?year=2026&month=7 +[Fri Apr 3 13:50:34 2026] 127.0.0.1:57344 Closing +[Fri Apr 3 13:50:34 2026] 127.0.0.1:63748 Accepted +[Fri Apr 3 13:50:34 2026] 127.0.0.1:56800 Accepted +[Fri Apr 3 13:50:34 2026] 127.0.0.1:63748 [200]: GET /css/style.css +[Fri Apr 3 13:50:34 2026] 127.0.0.1:56800 [200]: GET /js/astronomy.browser.min.js +[Fri Apr 3 13:50:34 2026] 127.0.0.1:63748 Closing +[Fri Apr 3 13:50:34 2026] 127.0.0.1:56800 Closing +[Fri Apr 3 13:50:34 2026] 127.0.0.1:64411 Accepted +[Fri Apr 3 13:50:34 2026] 127.0.0.1:65386 Accepted +[Fri Apr 3 13:50:34 2026] 127.0.0.1:64411 [200]: GET /images/star16x16.png +[Fri Apr 3 13:50:34 2026] 127.0.0.1:65386 [200]: GET /images/star16x16_rays.png +[Fri Apr 3 13:50:34 2026] 127.0.0.1:64411 Closing +[Fri Apr 3 13:50:34 2026] 127.0.0.1:65386 Closing +[Fri Apr 3 13:50:34 2026] 127.0.0.1:57436 Accepted +[Fri Apr 3 13:50:36 2026] 127.0.0.1:57436 [200]: GET /favicon.ico +[Fri Apr 3 13:50:36 2026] 127.0.0.1:57436 Closing +[Fri Apr 3 13:51:49 2026] 127.0.0.1:57952 Accepted +[Fri Apr 3 13:51:57 2026] 127.0.0.1:57952 [200]: GET /monatsvorhersage_old.php?year=2026&month=7 +[Fri Apr 3 13:51:57 2026] 127.0.0.1:57952 Closing +[Fri Apr 3 13:51:57 2026] 127.0.0.1:61080 Accepted +[Fri Apr 3 13:51:57 2026] 127.0.0.1:60174 Accepted +[Fri Apr 3 13:51:57 2026] 127.0.0.1:61080 [200]: GET /css/style.css +[Fri Apr 3 13:51:57 2026] 127.0.0.1:60174 [200]: GET /js/astronomy.browser.min.js +[Fri Apr 3 13:51:57 2026] 127.0.0.1:61080 Closing +[Fri Apr 3 13:51:57 2026] 127.0.0.1:60174 Closing +[Fri Apr 3 13:51:57 2026] 127.0.0.1:58447 Accepted +[Fri Apr 3 13:51:57 2026] 127.0.0.1:64622 Accepted +[Fri Apr 3 13:51:57 2026] 127.0.0.1:58447 [200]: GET /images/star16x16.png +[Fri Apr 3 13:51:57 2026] 127.0.0.1:64622 [200]: GET /images/star16x16_rays.png +[Fri Apr 3 13:51:57 2026] 127.0.0.1:58447 Closing +[Fri Apr 3 13:51:57 2026] 127.0.0.1:64622 Closing +[Fri Apr 3 13:51:57 2026] 127.0.0.1:49389 Accepted +[Fri Apr 3 13:51:59 2026] 127.0.0.1:49389 [200]: GET /favicon.ico +[Fri Apr 3 13:51:59 2026] 127.0.0.1:49389 Closing +[Fri Apr 3 13:52:20 2026] 127.0.0.1:62560 Accepted +[Fri Apr 3 13:52:28 2026] 127.0.0.1:62560 [200]: GET /monatsvorhersage_old.php?year=2026&month=6 +[Fri Apr 3 13:52:28 2026] 127.0.0.1:62560 Closing +[Fri Apr 3 13:52:28 2026] 127.0.0.1:50216 Accepted +[Fri Apr 3 13:52:28 2026] 127.0.0.1:50216 [200]: GET /css/style.css +[Fri Apr 3 13:52:28 2026] 127.0.0.1:61695 Accepted +[Fri Apr 3 13:52:28 2026] 127.0.0.1:61695 [200]: GET /js/astronomy.browser.min.js +[Fri Apr 3 13:52:28 2026] 127.0.0.1:50216 Closing +[Fri Apr 3 13:52:28 2026] 127.0.0.1:61695 Closing +[Fri Apr 3 13:52:28 2026] 127.0.0.1:61670 Accepted +[Fri Apr 3 13:52:28 2026] 127.0.0.1:61670 [200]: GET /images/star16x16.png +[Fri Apr 3 13:52:28 2026] 127.0.0.1:62407 Accepted +[Fri Apr 3 13:52:28 2026] 127.0.0.1:62407 [200]: GET /images/star16x16_rays.png +[Fri Apr 3 13:52:28 2026] 127.0.0.1:61670 Closing +[Fri Apr 3 13:52:28 2026] 127.0.0.1:62407 Closing +[Fri Apr 3 13:52:29 2026] 127.0.0.1:51933 Accepted +[Fri Apr 3 13:52:30 2026] 127.0.0.1:51933 [200]: GET /favicon.ico +[Fri Apr 3 13:52:30 2026] 127.0.0.1:51933 Closing +[Fri Apr 3 13:53:00 2026] 127.0.0.1:52753 Accepted +[Fri Apr 3 13:53:09 2026] 127.0.0.1:52753 [200]: GET /monatsvorhersage_old.php?year=2026&month=4 +[Fri Apr 3 13:53:09 2026] 127.0.0.1:52753 Closing +[Fri Apr 3 13:53:09 2026] 127.0.0.1:52304 Accepted +[Fri Apr 3 13:53:24 2026] 127.0.0.1:52304 [200]: GET /monatsvorhersage_old.php?year=2026&month=1 +[Fri Apr 3 13:53:24 2026] 127.0.0.1:52304 Closing +[Fri Apr 3 13:53:24 2026] 127.0.0.1:61207 Accepted +[Fri Apr 3 13:53:24 2026] 127.0.0.1:65071 Accepted +[Fri Apr 3 13:53:24 2026] 127.0.0.1:61207 [200]: GET /css/style.css +[Fri Apr 3 13:53:24 2026] 127.0.0.1:54477 Accepted +[Fri Apr 3 13:53:25 2026] 127.0.0.1:65071 [200]: GET /.well-known/appspecific/com.chrome.devtools.json +[Fri Apr 3 13:53:25 2026] 127.0.0.1:65071 Closing +[Fri Apr 3 13:53:25 2026] 127.0.0.1:54477 [200]: GET /js/astronomy.browser.min.js +[Fri Apr 3 13:53:25 2026] 127.0.0.1:61207 Closing +[Fri Apr 3 13:53:25 2026] 127.0.0.1:54477 Closing +[Fri Apr 3 13:53:25 2026] 127.0.0.1:53519 Accepted +[Fri Apr 3 13:53:25 2026] 127.0.0.1:64233 Accepted +[Fri Apr 3 13:53:25 2026] 127.0.0.1:53519 [200]: GET /images/star16x16.png +[Fri Apr 3 13:53:25 2026] 127.0.0.1:64233 [200]: GET /images/star16x16_rays.png +[Fri Apr 3 13:53:25 2026] 127.0.0.1:53519 Closing +[Fri Apr 3 13:53:25 2026] 127.0.0.1:64233 Closing +[Fri Apr 3 13:53:25 2026] 127.0.0.1:62437 Accepted +[Fri Apr 3 13:53:27 2026] 127.0.0.1:62437 [200]: GET /favicon.ico +[Fri Apr 3 13:53:27 2026] 127.0.0.1:62437 Closing +[Fri Apr 3 13:53:58 2026] 127.0.0.1:49351 Accepted +[Fri Apr 3 13:54:07 2026] 127.0.0.1:49351 [200]: GET /monatsvorhersage_old.php?year=2026&month=4 +[Fri Apr 3 13:54:07 2026] 127.0.0.1:49351 Closing +[Fri Apr 3 13:54:53 2026] 127.0.0.1:52140 Accepted +[Fri Apr 3 13:55:08 2026] 127.0.0.1:52140 [200]: GET /monatsvorhersage_old.php?year=2026&month=1 +[Fri Apr 3 13:55:08 2026] 127.0.0.1:52140 Closing +[Fri Apr 3 13:55:08 2026] 127.0.0.1:57912 Accepted +[Fri Apr 3 13:55:08 2026] 127.0.0.1:61820 Accepted +[Fri Apr 3 13:55:08 2026] 127.0.0.1:57912 [200]: GET /css/style.css +[Fri Apr 3 13:55:09 2026] 127.0.0.1:61820 [200]: GET /.well-known/appspecific/com.chrome.devtools.json +[Fri Apr 3 13:55:09 2026] 127.0.0.1:61820 Closing +[Fri Apr 3 13:55:09 2026] 127.0.0.1:64502 Accepted +[Fri Apr 3 13:55:09 2026] 127.0.0.1:64502 [200]: GET /js/astronomy.browser.min.js +[Fri Apr 3 13:55:09 2026] 127.0.0.1:57912 Closing +[Fri Apr 3 13:55:09 2026] 127.0.0.1:64502 Closing +[Fri Apr 3 13:55:09 2026] 127.0.0.1:59606 Accepted +[Fri Apr 3 13:55:09 2026] 127.0.0.1:59674 Accepted +[Fri Apr 3 13:55:09 2026] 127.0.0.1:59606 [200]: GET /images/star16x16.png +[Fri Apr 3 13:55:09 2026] 127.0.0.1:59674 [200]: GET /images/star16x16_rays.png +[Fri Apr 3 13:55:09 2026] 127.0.0.1:59606 Closing +[Fri Apr 3 13:55:09 2026] 127.0.0.1:59674 Closing +[Fri Apr 3 13:55:09 2026] 127.0.0.1:56830 Accepted +[Fri Apr 3 13:55:10 2026] 127.0.0.1:56830 [200]: GET /favicon.ico +[Fri Apr 3 13:55:10 2026] 127.0.0.1:56830 Closing +[Fri Apr 3 13:56:21 2026] 127.0.0.1:63611 Accepted +[Fri Apr 3 13:56:30 2026] 127.0.0.1:63611 [200]: GET /monatsvorhersage_old.php?year=2026&month=4 +[Fri Apr 3 13:56:30 2026] 127.0.0.1:63611 Closing diff --git a/public/monatsvorhersage_old.php b/public/monatsvorhersage_old.php index e571afd..d18dbba 100644 --- a/public/monatsvorhersage_old.php +++ b/public/monatsvorhersage_old.php @@ -62,6 +62,7 @@ $planetConjunctions = []; $eclipseEvents = []; $moonApsisEvents = []; $sunApsisEvents = []; +$innerPlanetElongationEvents = []; $moonOccultations = []; $seasonChanges = []; $monthEventList = []; @@ -404,6 +405,23 @@ if (is_array($sunApsisDecoded) && ($sunApsisDecoded['ok'] ?? false)) { $sunApsisEvents = is_array($sunApsisDecoded['events'] ?? null) ? $sunApsisDecoded['events'] : []; } +$elongationOutput = []; +$elongationExitCode = 0; +$elongationArgs = [ + $pythonScriptPath, + 'inner_planet_elongations_for_month', + (string) $selectedYear, + (string) $selectedMonth, + $chartTimezone, +]; +$elongationCommand = $pythonExecutable . ' ' . implode(' ', array_map('escapeshellarg', $elongationArgs)) . ' 2>&1'; +exec($elongationCommand, $elongationOutput, $elongationExitCode); +$elongationRaw = trim(implode("\n", $elongationOutput)); +$elongationDecoded = json_decode($elongationRaw, true); +if (is_array($elongationDecoded) && ($elongationDecoded['ok'] ?? false)) { + $innerPlanetElongationEvents = is_array($elongationDecoded['events'] ?? null) ? $elongationDecoded['events'] : []; +} + $moonPlanetOutput = []; $moonPlanetExitCode = 0; $moonPlanetArgs = [ @@ -597,6 +615,31 @@ foreach ($sunApsisEvents as $sunApsisEvent) { ]; } +foreach ($innerPlanetElongationEvents as $elongationEvent) { + if (!is_array($elongationEvent)) { + continue; + } + + $elongationPlanet = (string) ($elongationEvent['planet_label'] ?? 'Planet'); + $elongationKind = (string) ($elongationEvent['kind'] ?? ''); + $elongationText = isset($elongationEvent['elongation_deg']) + ? number_format((float) $elongationEvent['elongation_deg'], 2, ',', '') . ' Grad' + : ''; + $elongationLabel = $elongationKind === 'western' + ? $elongationPlanet . ' größte westliche Elongation' + : ($elongationKind === 'eastern' + ? $elongationPlanet . ' größte östliche Elongation' + : (string) ($elongationEvent['label'] ?? 'Elongation')); + + $monthEventList[] = [ + 'event' => trim($elongationLabel . ($elongationText !== '' ? ' (' . $elongationText . ')' : '')), + 'date' => (string) ($elongationEvent['local_date'] ?? ''), + 'time' => (string) ($elongationEvent['local_time'] ?? ''), + 'local_iso' => (string) ($elongationEvent['local_iso'] ?? ''), + 'type' => 'planet_elongation', + ]; +} + foreach ($moonPlanetApproaches as $approachEvent) { if (!is_array($approachEvent)) { continue; diff --git a/public/py/__pycache__/api.cpython-314.pyc b/public/py/__pycache__/api.cpython-314.pyc index b421731..40ecfa3 100644 Binary files a/public/py/__pycache__/api.cpython-314.pyc and b/public/py/__pycache__/api.cpython-314.pyc differ diff --git a/public/py/api.py b/public/py/api.py index aa99651..f46121e 100644 --- a/public/py/api.py +++ b/public/py/api.py @@ -1154,6 +1154,82 @@ def action_sun_apsides_for_month(args: list[str]) -> dict: } +def action_inner_planet_elongations_for_month(args: list[str]) -> dict: + if len(args) != 3: + fail( + "Aktion inner_planet_elongations_for_month erwartet 3 Argumente: year month timezone", + extra={"argv": args}, + ) + + try: + year = int(args[0]) + month = int(args[1]) + except ValueError as exc: + fail("Jahr oder Monat sind ungueltig.", extra={"details": str(exc), "argv": args}) + + if month < 1 or month > 12: + fail("Monat muss zwischen 1 und 12 liegen.", extra={"month": month}) + + timezone_name = args[2] + try: + tz = ZoneInfo(timezone_name) + except Exception as exc: + fail("Zeitzone ist ungueltig oder auf dem Server nicht verfuegbar.", extra={"details": str(exc)}) + + local_start = datetime(year, month, 1, 0, 0, 0, tzinfo=tz) + if month == 12: + local_end = datetime(year + 1, 1, 1, 0, 0, 0, tzinfo=tz) + else: + local_end = datetime(year, month + 1, 1, 0, 0, 0, tzinfo=tz) + + utc_start = local_start.astimezone(timezone.utc) + scan_start = dt_to_time(utc_start - timedelta(days=80)) + + planet_defs = [ + ("Merkur", astronomy.Body.Mercury, "mercury"), + ("Venus", astronomy.Body.Venus, "venus"), + ] + + events: list[dict] = [] + for label, body, key in planet_defs: + event = astronomy.SearchMaxElongation(body, scan_start) + while event is not None: + dt_utc = time_to_datetime(event.time) + local_dt = dt_utc.astimezone(tz) + if local_dt >= local_end: + break + + if local_dt >= local_start: + visibility_label = "westliche" if event.visibility == astronomy.Visibility.Morning else "oestliche" + events.append({ + "planet_key": key, + "planet_label": label, + "kind": "western" if event.visibility == astronomy.Visibility.Morning else "eastern", + "label": f"{label} groesste {visibility_label} Elongation", + "elongation_deg": float(event.elongation), + "ecliptic_separation_deg": float(event.ecliptic_separation), + "utc_iso": dt_utc.isoformat().replace("+00:00", "Z"), + "local_iso": local_dt.isoformat(), + "local_date": local_dt.strftime("%d.%m.%Y"), + "local_time": local_dt.strftime("%H:%M"), + }) + + event = astronomy.SearchMaxElongation(body, event.time.AddDays(1.0)) + + events.sort(key=lambda item: item["local_iso"]) + + return { + "ok": True, + "action": "inner_planet_elongations_for_month", + "selected": { + "year": year, + "month": month, + "timezone": timezone_name, + }, + "events": events, + } + + def action_moon_star_occultations_for_month(args: list[str]) -> dict: if len(args) != 7: fail( @@ -2210,7 +2286,7 @@ def action_satellite_passes(args: list[str]) -> dict: def main() -> None: if len(sys.argv) < 2: - fail("Es wurde keine Aktion uebergeben.", extra={"available_actions": ["sun_moon_rise_set", "moon_star_occultations", "moon_phase_details", "satellite_passes", "planet_rise_set", "month_sky_context", "moon_phases_for_month", "season_changes_for_month", "moon_planet_approaches", "planet_conjunctions_for_month", "eclipses_for_month", "moon_apsides_for_month", "sun_apsides_for_month", "moon_star_occultations_for_month"]}) + fail("Es wurde keine Aktion uebergeben.", extra={"available_actions": ["sun_moon_rise_set", "moon_star_occultations", "moon_phase_details", "satellite_passes", "planet_rise_set", "month_sky_context", "moon_phases_for_month", "season_changes_for_month", "moon_planet_approaches", "planet_conjunctions_for_month", "eclipses_for_month", "moon_apsides_for_month", "sun_apsides_for_month", "inner_planet_elongations_for_month", "moon_star_occultations_for_month"]}) action = sys.argv[1] args = sys.argv[2:] @@ -2280,12 +2356,17 @@ def main() -> None: print(json.dumps(result, ensure_ascii=False)) return + if action == "inner_planet_elongations_for_month": + result = action_inner_planet_elongations_for_month(args) + print(json.dumps(result, ensure_ascii=False)) + return + if action == "moon_star_occultations_for_month": result = action_moon_star_occultations_for_month(args) print(json.dumps(result, ensure_ascii=False)) return - fail("Unbekannte Aktion.", extra={"action": action, "available_actions": ["sun_moon_rise_set", "moon_star_occultations", "moon_phase_details", "satellite_passes", "planet_rise_set", "month_sky_context", "moon_phases_for_month", "season_changes_for_month", "moon_planet_approaches", "planet_conjunctions_for_month", "eclipses_for_month", "moon_apsides_for_month", "sun_apsides_for_month", "moon_star_occultations_for_month"]}) + fail("Unbekannte Aktion.", extra={"action": action, "available_actions": ["sun_moon_rise_set", "moon_star_occultations", "moon_phase_details", "satellite_passes", "planet_rise_set", "month_sky_context", "moon_phases_for_month", "season_changes_for_month", "moon_planet_approaches", "planet_conjunctions_for_month", "eclipses_for_month", "moon_apsides_for_month", "sun_apsides_for_month", "inner_planet_elongations_for_month", "moon_star_occultations_for_month"]}) if __name__ == "__main__":