solarmoonpy 1.0.3__py3-none-any.whl → 1.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- solarmoonpy/moon.py +51 -1
- solarmoonpy/version.py +1 -1
- {solarmoonpy-1.0.3.dist-info → solarmoonpy-1.0.4.dist-info}/METADATA +5 -2
- solarmoonpy-1.0.4.dist-info/RECORD +10 -0
- solarmoonpy-1.0.3.dist-info/RECORD +0 -10
- {solarmoonpy-1.0.3.dist-info → solarmoonpy-1.0.4.dist-info}/WHEEL +0 -0
- {solarmoonpy-1.0.3.dist-info → solarmoonpy-1.0.4.dist-info}/licenses/LICENSE +0 -0
- {solarmoonpy-1.0.3.dist-info → solarmoonpy-1.0.4.dist-info}/top_level.txt +0 -0
solarmoonpy/moon.py
CHANGED
|
@@ -374,4 +374,54 @@ def moon_elongation(date_utc: date) -> float:
|
|
|
374
374
|
jc = julianday_to_juliancentury(jd)
|
|
375
375
|
lambda_m, _, _, _ = _moon_ecliptic_position(jd)
|
|
376
376
|
lambda_s = sun_apparent_long(jc)
|
|
377
|
-
return _normalize_angle(lambda_m - lambda_s)
|
|
377
|
+
return _normalize_angle(lambda_m - lambda_s)
|
|
378
|
+
|
|
379
|
+
def get_moon_phase_name(d: date) -> str:
|
|
380
|
+
"""Determina el nombre de la fase lunar para la fecha dada."""
|
|
381
|
+
percentage = illuminated_percentage(d)
|
|
382
|
+
elongation = moon_elongation(d)
|
|
383
|
+
|
|
384
|
+
# Determinar nombre intermedio basado en elongación y porcentaje iluminado
|
|
385
|
+
is_waxing = elongation < 180.0 # <180° creciente, >=180° menguante
|
|
386
|
+
if percentage < 50.0:
|
|
387
|
+
phase_name = "waxing_crescent" if is_waxing else "waning_crescent"
|
|
388
|
+
else:
|
|
389
|
+
phase_name = "waxing_gibbous" if is_waxing else "waning_gibbous"
|
|
390
|
+
|
|
391
|
+
# Verificar fases primarias exactas y override si corresponde
|
|
392
|
+
last_new = find_last_phase_exact(d, 0.0)
|
|
393
|
+
if last_new and last_new.date() == d:
|
|
394
|
+
return "new_moon"
|
|
395
|
+
elif percentage < 1.0: # Backup para luna nueva cercana
|
|
396
|
+
return "new_moon"
|
|
397
|
+
|
|
398
|
+
last_first = find_last_phase_exact(d, 90.0)
|
|
399
|
+
if last_first and last_first.date() == d:
|
|
400
|
+
return "first_quarter"
|
|
401
|
+
|
|
402
|
+
last_full = find_last_phase_exact(d, 180.0)
|
|
403
|
+
if last_full and last_full.date() == d:
|
|
404
|
+
return "full_moon"
|
|
405
|
+
elif percentage > 99.0: # Backup para luna llena cercana
|
|
406
|
+
return "full_moon"
|
|
407
|
+
|
|
408
|
+
last_last = find_last_phase_exact(d, 270.0)
|
|
409
|
+
if last_last and last_last.date() == d:
|
|
410
|
+
return "last_quarter"
|
|
411
|
+
|
|
412
|
+
return phase_name
|
|
413
|
+
|
|
414
|
+
def get_lunation_duration(date_utc: date) -> str:
|
|
415
|
+
"""Calcula la duración exacta de la lunación actual (desde la última luna nueva hasta la siguiente)."""
|
|
416
|
+
last_new = find_last_phase_exact(date_utc, 0.0)
|
|
417
|
+
# Buscar la siguiente luna nueva: empezar ~25 días después (buffer seguro)
|
|
418
|
+
search_date = (last_new + timedelta(days=25)).date()
|
|
419
|
+
next_new = find_last_phase_exact(search_date + timedelta(days=10), 0.0) # Buffer para asegurar el cruce
|
|
420
|
+
if next_new <= last_new:
|
|
421
|
+
next_new = find_last_phase_exact(search_date + timedelta(days=35), 0.0) # Seguridad extra si falla
|
|
422
|
+
duration = next_new - last_new
|
|
423
|
+
days = duration.days
|
|
424
|
+
secs = duration.seconds
|
|
425
|
+
hours = secs // 3600
|
|
426
|
+
minutes = (secs % 3600) // 60
|
|
427
|
+
return f"{days} days {hours} hours {minutes} minutes"
|
solarmoonpy/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# version.py
|
|
2
|
-
__version__ = "1.0.
|
|
2
|
+
__version__ = "1.0.4"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: solarmoonpy
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Summary: Precise solar and lunar calculations for astronomical applications
|
|
5
5
|
Author-email: figorr <jdcuartero@yahoo.es>
|
|
6
6
|
License: Apache License
|
|
@@ -221,6 +221,9 @@ License-File: LICENSE
|
|
|
221
221
|
Dynamic: license-file
|
|
222
222
|
|
|
223
223
|
# ☀️🌙 solarmoonpy
|
|
224
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
225
|
+

|
|
226
|
+
|
|
224
227
|
Solar and moon calculations for Meteocat Home Assistant integration.
|
|
225
228
|
|
|
226
229
|
**solarmoonpy** is a Python library that provides accurate calculations of solar and lunar positions, specifically designed to integrate with Home Assistant and Meteocat data.
|
|
@@ -229,7 +232,7 @@ This project enables you to obtain information such as sunrise, sunset, moon pha
|
|
|
229
232
|
|
|
230
233
|
## 🚀 Features
|
|
231
234
|
|
|
232
|
-
- ☀️ Solar position calculations (sunrise, sunset,
|
|
235
|
+
- ☀️ Solar position calculations (sunrise, sunset, noon, etc.).
|
|
233
236
|
- 🌙 Moon phase and position calculations.
|
|
234
237
|
- Integration with meteorological data from Meteocat.
|
|
235
238
|
- Compatible with Home Assistant for automations based on solar and lunar events.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
solarmoonpy/__init__.py,sha256=cS0ZjePNX75usK8mgvbk_uguVpXRixqZU4zjrEtg42c,722
|
|
2
|
+
solarmoonpy/location.py,sha256=CcIAlghZ6QQKiQXygfaAs4aBN_7ANfoszabZycIPY30,10312
|
|
3
|
+
solarmoonpy/moon.py,sha256=vaa2LX1O5wtf0Aw6YqA4O81C0rj987bzAnRonmJGUj0,19715
|
|
4
|
+
solarmoonpy/sun.py,sha256=dleHQWXzjnqtPAZr9ONdXiZvTVWvdW6gW775A2ASsNk,8937
|
|
5
|
+
solarmoonpy/version.py,sha256=4GueiH6X-r8Q74Jb_Q5RthVTiWWIAi41JPOadHGhAhw,35
|
|
6
|
+
solarmoonpy-1.0.4.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
7
|
+
solarmoonpy-1.0.4.dist-info/METADATA,sha256=NArTJopTV0wOosJWGDHkMz5Va8Mgg8ZvWXhxbAlbmUs,15023
|
|
8
|
+
solarmoonpy-1.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
solarmoonpy-1.0.4.dist-info/top_level.txt,sha256=egsoDe9E0QEu5GfAA5jSvy_3qTCWMLMe_Kh3gnM6-dY,12
|
|
10
|
+
solarmoonpy-1.0.4.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
solarmoonpy/__init__.py,sha256=cS0ZjePNX75usK8mgvbk_uguVpXRixqZU4zjrEtg42c,722
|
|
2
|
-
solarmoonpy/location.py,sha256=CcIAlghZ6QQKiQXygfaAs4aBN_7ANfoszabZycIPY30,10312
|
|
3
|
-
solarmoonpy/moon.py,sha256=SSa4pwUX-r70NSg2Fv3TSAnoyMAdTq2vQ8JRZqDBONo,17587
|
|
4
|
-
solarmoonpy/sun.py,sha256=dleHQWXzjnqtPAZr9ONdXiZvTVWvdW6gW775A2ASsNk,8937
|
|
5
|
-
solarmoonpy/version.py,sha256=pUPSnwcgDgNwpkrUxTeExM60u3Bsk0wjaFqQSDBlYhg,35
|
|
6
|
-
solarmoonpy-1.0.3.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
7
|
-
solarmoonpy-1.0.3.dist-info/METADATA,sha256=hxP0bZCAu8rYVR56CqxsCt4mCkCFKC81XPEgj-CXDis,14850
|
|
8
|
-
solarmoonpy-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
solarmoonpy-1.0.3.dist-info/top_level.txt,sha256=egsoDe9E0QEu5GfAA5jSvy_3qTCWMLMe_Kh3gnM6-dY,12
|
|
10
|
-
solarmoonpy-1.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|