solarmoonpy 1.0.6__py3-none-any.whl → 1.0.7__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.
Potentially problematic release.
This version of solarmoonpy might be problematic. Click here for more details.
- solarmoonpy/location.py +137 -53
- solarmoonpy/version.py +1 -1
- {solarmoonpy-1.0.6.dist-info → solarmoonpy-1.0.7.dist-info}/METADATA +1 -1
- solarmoonpy-1.0.7.dist-info/RECORD +10 -0
- solarmoonpy-1.0.6.dist-info/RECORD +0 -10
- {solarmoonpy-1.0.6.dist-info → solarmoonpy-1.0.7.dist-info}/WHEEL +0 -0
- {solarmoonpy-1.0.6.dist-info → solarmoonpy-1.0.7.dist-info}/licenses/LICENSE +0 -0
- {solarmoonpy-1.0.6.dist-info → solarmoonpy-1.0.7.dist-info}/top_level.txt +0 -0
solarmoonpy/location.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from datetime import date, datetime, timezone
|
|
3
3
|
from zoneinfo import ZoneInfo
|
|
4
|
-
from typing import Optional, Union, Literal
|
|
4
|
+
from typing import Optional, Union, Literal, Dict
|
|
5
5
|
|
|
6
6
|
from .sun import sunrise_sunset, noon, dawn, dusk, midnight # Importar funciones de sun.py
|
|
7
7
|
|
|
@@ -257,57 +257,6 @@ class Location:
|
|
|
257
257
|
date=date,
|
|
258
258
|
timezone=self.tzinfo if local else timezone.utc
|
|
259
259
|
)
|
|
260
|
-
|
|
261
|
-
def sun_events(
|
|
262
|
-
self,
|
|
263
|
-
date: Optional[date] = None,
|
|
264
|
-
local: bool = True,
|
|
265
|
-
elevation: Optional[float] = None
|
|
266
|
-
) -> dict:
|
|
267
|
-
"""
|
|
268
|
-
Devuelve un diccionario con sunrise, noon y sunset para una fecha dada.
|
|
269
|
-
|
|
270
|
-
Args:
|
|
271
|
-
date: Fecha para la cual calcular los eventos solares. Si es None, usa la fecha actual.
|
|
272
|
-
local: True para devolver las horas en la zona horaria local, False para UTC.
|
|
273
|
-
elevation: Elevación del observador en metros. Si es None, usa self.elevation.
|
|
274
|
-
|
|
275
|
-
Returns:
|
|
276
|
-
dict: {
|
|
277
|
-
"sunrise": datetime,
|
|
278
|
-
"noon": datetime,
|
|
279
|
-
"sunset": datetime
|
|
280
|
-
}
|
|
281
|
-
"""
|
|
282
|
-
if local and self.timezone is None:
|
|
283
|
-
raise ValueError("Se solicitó hora local pero no se definió una zona horaria.")
|
|
284
|
-
|
|
285
|
-
tz = self.tzinfo if local else timezone.utc
|
|
286
|
-
date = date or datetime.now(tz).date()
|
|
287
|
-
elevation = elevation if elevation is not None else self.elevation
|
|
288
|
-
|
|
289
|
-
# Calcular amanecer y atardecer
|
|
290
|
-
sunrise, sunset = sunrise_sunset(
|
|
291
|
-
latitude=self.latitude,
|
|
292
|
-
longitude=self.longitude,
|
|
293
|
-
date=date,
|
|
294
|
-
elevation=elevation,
|
|
295
|
-
timezone=tz,
|
|
296
|
-
with_refraction=True,
|
|
297
|
-
)
|
|
298
|
-
|
|
299
|
-
# Calcular mediodía solar
|
|
300
|
-
noon_time = noon(
|
|
301
|
-
longitude=self.longitude,
|
|
302
|
-
date=date,
|
|
303
|
-
timezone=tz,
|
|
304
|
-
)
|
|
305
|
-
|
|
306
|
-
return {
|
|
307
|
-
"sunrise": sunrise,
|
|
308
|
-
"noon": noon_time,
|
|
309
|
-
"sunset": sunset,
|
|
310
|
-
}
|
|
311
260
|
|
|
312
261
|
def dawn(
|
|
313
262
|
self,
|
|
@@ -372,4 +321,139 @@ class Location:
|
|
|
372
321
|
longitude=self.longitude,
|
|
373
322
|
date=date,
|
|
374
323
|
timezone=self.tzinfo if local else timezone.utc
|
|
375
|
-
)
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
def sun_events(
|
|
327
|
+
self,
|
|
328
|
+
date: Optional[date] = None,
|
|
329
|
+
local: bool = True,
|
|
330
|
+
elevation: Optional[float] = None,
|
|
331
|
+
) -> Dict:
|
|
332
|
+
"""
|
|
333
|
+
Devuelve un diccionario con los eventos solares para una fecha dada, incluyendo todos los tipos de crepúsculo.
|
|
334
|
+
|
|
335
|
+
Args:
|
|
336
|
+
date: Fecha para la cual calcular los eventos solares. Si es None, usa la fecha actual.
|
|
337
|
+
local: True para devolver las horas en la zona horaria local, False para UTC.
|
|
338
|
+
elevation: Elevación del observador en metros. Si es None, usa self.elevation.
|
|
339
|
+
|
|
340
|
+
Returns:
|
|
341
|
+
dict: {
|
|
342
|
+
"dawn_civil": datetime | None,
|
|
343
|
+
"dawn_nautical": datetime | None,
|
|
344
|
+
"dawn_astronomical": datetime | None,
|
|
345
|
+
"sunrise": datetime,
|
|
346
|
+
"noon": datetime,
|
|
347
|
+
"sunset": datetime,
|
|
348
|
+
"dusk_civil": datetime | None,
|
|
349
|
+
"dusk_nautical": datetime | None,
|
|
350
|
+
"dusk_astronomical": datetime | None,
|
|
351
|
+
"midnight": datetime,
|
|
352
|
+
"daylight_duration": float | None
|
|
353
|
+
}
|
|
354
|
+
"""
|
|
355
|
+
if local and self.timezone is None:
|
|
356
|
+
raise ValueError("Se solicitó hora local pero no se definió una zona horaria.")
|
|
357
|
+
|
|
358
|
+
tz = self.tzinfo if local else timezone.utc
|
|
359
|
+
date = date or datetime.now(tz).date()
|
|
360
|
+
elevation = elevation if elevation is not None else self.elevation
|
|
361
|
+
|
|
362
|
+
# Calcular amanecer y atardecer
|
|
363
|
+
sunrise, sunset = sunrise_sunset(
|
|
364
|
+
latitude=self.latitude,
|
|
365
|
+
longitude=self.longitude,
|
|
366
|
+
date=date,
|
|
367
|
+
elevation=elevation,
|
|
368
|
+
timezone=tz,
|
|
369
|
+
with_refraction=True,
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
# Calcular mediodía solar
|
|
373
|
+
noon_time = noon(
|
|
374
|
+
longitude=self.longitude,
|
|
375
|
+
date=date,
|
|
376
|
+
timezone=tz,
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
# Calcular medianoche solar
|
|
380
|
+
midnight_time = midnight(
|
|
381
|
+
longitude=self.longitude,
|
|
382
|
+
date=date,
|
|
383
|
+
timezone=tz,
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
# Calcular duración del día (en horas)
|
|
387
|
+
daylight_duration = None
|
|
388
|
+
if sunrise and sunset:
|
|
389
|
+
daylight_duration = (sunset - sunrise).total_seconds() / 3600
|
|
390
|
+
|
|
391
|
+
# Calcular dawn y dusk para cada tipo de crepúsculo
|
|
392
|
+
dawn_civil = dawn(
|
|
393
|
+
latitude=self.latitude,
|
|
394
|
+
longitude=self.longitude,
|
|
395
|
+
date=date,
|
|
396
|
+
twilight_type="civil",
|
|
397
|
+
elevation=elevation,
|
|
398
|
+
timezone=tz,
|
|
399
|
+
with_refraction=True,
|
|
400
|
+
)
|
|
401
|
+
dusk_civil = dusk(
|
|
402
|
+
latitude=self.latitude,
|
|
403
|
+
longitude=self.longitude,
|
|
404
|
+
date=date,
|
|
405
|
+
twilight_type="civil",
|
|
406
|
+
elevation=elevation,
|
|
407
|
+
timezone=tz,
|
|
408
|
+
with_refraction=True,
|
|
409
|
+
)
|
|
410
|
+
dawn_nautical = dawn(
|
|
411
|
+
latitude=self.latitude,
|
|
412
|
+
longitude=self.longitude,
|
|
413
|
+
date=date,
|
|
414
|
+
twilight_type="nautical",
|
|
415
|
+
elevation=elevation,
|
|
416
|
+
timezone=tz,
|
|
417
|
+
with_refraction=True,
|
|
418
|
+
)
|
|
419
|
+
dusk_nautical = dusk(
|
|
420
|
+
latitude=self.latitude,
|
|
421
|
+
longitude=self.longitude,
|
|
422
|
+
date=date,
|
|
423
|
+
twilight_type="nautical",
|
|
424
|
+
elevation=elevation,
|
|
425
|
+
timezone=tz,
|
|
426
|
+
with_refraction=True,
|
|
427
|
+
)
|
|
428
|
+
dawn_astronomical = dawn(
|
|
429
|
+
latitude=self.latitude,
|
|
430
|
+
longitude=self.longitude,
|
|
431
|
+
date=date,
|
|
432
|
+
twilight_type="astronomical",
|
|
433
|
+
elevation=elevation,
|
|
434
|
+
timezone=tz,
|
|
435
|
+
with_refraction=True,
|
|
436
|
+
)
|
|
437
|
+
dusk_astronomical = dusk(
|
|
438
|
+
latitude=self.latitude,
|
|
439
|
+
longitude=self.longitude,
|
|
440
|
+
date=date,
|
|
441
|
+
twilight_type="astronomical",
|
|
442
|
+
elevation=elevation,
|
|
443
|
+
timezone=tz,
|
|
444
|
+
with_refraction=True,
|
|
445
|
+
)
|
|
446
|
+
|
|
447
|
+
return {
|
|
448
|
+
"dawn_civil": dawn_civil,
|
|
449
|
+
"dawn_nautical": dawn_nautical,
|
|
450
|
+
"dawn_astronomical": dawn_astronomical,
|
|
451
|
+
"sunrise": sunrise,
|
|
452
|
+
"noon": noon_time,
|
|
453
|
+
"sunset": sunset,
|
|
454
|
+
"dusk_civil": dusk_civil,
|
|
455
|
+
"dusk_nautical": dusk_nautical,
|
|
456
|
+
"dusk_astronomical": dusk_astronomical,
|
|
457
|
+
"midnight": midnight_time,
|
|
458
|
+
"daylight_duration": daylight_duration,
|
|
459
|
+
}
|
solarmoonpy/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# version.py
|
|
2
|
-
__version__ = "1.0.
|
|
2
|
+
__version__ = "1.0.7"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
solarmoonpy/__init__.py,sha256=cS0ZjePNX75usK8mgvbk_uguVpXRixqZU4zjrEtg42c,722
|
|
2
|
+
solarmoonpy/location.py,sha256=vO39N1IWWchztZAkPh1QAG65bVa06vWYKjUoGOchxtY,15672
|
|
3
|
+
solarmoonpy/moon.py,sha256=yhJSsED7AWK3nF79fjqFlCeqYjiXXFhqGE36Nyfp0qk,19699
|
|
4
|
+
solarmoonpy/sun.py,sha256=K31_btucloC5WYnltFb_X_3hF1Xk0_5aQ1hRSrYP7C8,13396
|
|
5
|
+
solarmoonpy/version.py,sha256=1WAI3HCLSBsNOYFDrx3iybB2BK0q9VjsVmNPgtn8gxw,35
|
|
6
|
+
solarmoonpy-1.0.7.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
7
|
+
solarmoonpy-1.0.7.dist-info/METADATA,sha256=2-EtubwWPbvTXa3Fpz5daf9FxHqIAHNd8aaPa_hTzDI,15023
|
|
8
|
+
solarmoonpy-1.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
solarmoonpy-1.0.7.dist-info/top_level.txt,sha256=egsoDe9E0QEu5GfAA5jSvy_3qTCWMLMe_Kh3gnM6-dY,12
|
|
10
|
+
solarmoonpy-1.0.7.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
solarmoonpy/__init__.py,sha256=cS0ZjePNX75usK8mgvbk_uguVpXRixqZU4zjrEtg42c,722
|
|
2
|
-
solarmoonpy/location.py,sha256=XC-d0g2kjLdTJyYDokz8m3C5bKZ7h9xy6rsRf40uQ84,12764
|
|
3
|
-
solarmoonpy/moon.py,sha256=yhJSsED7AWK3nF79fjqFlCeqYjiXXFhqGE36Nyfp0qk,19699
|
|
4
|
-
solarmoonpy/sun.py,sha256=K31_btucloC5WYnltFb_X_3hF1Xk0_5aQ1hRSrYP7C8,13396
|
|
5
|
-
solarmoonpy/version.py,sha256=C1AoWYSu92cpPGAfSGtTeKE9EGde-yUoSv0cT_BVTJM,35
|
|
6
|
-
solarmoonpy-1.0.6.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
7
|
-
solarmoonpy-1.0.6.dist-info/METADATA,sha256=hBdLEmwc3QWazEVQKaWF63k6pMVrtUUmiLoshnV6nD4,15023
|
|
8
|
-
solarmoonpy-1.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
solarmoonpy-1.0.6.dist-info/top_level.txt,sha256=egsoDe9E0QEu5GfAA5jSvy_3qTCWMLMe_Kh3gnM6-dY,12
|
|
10
|
-
solarmoonpy-1.0.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|