Simple sunset and sunrise time calculation python library
Project description
SunTime
Simple sunset and sunrise time calculation python library forked from pypi suntime library.
Usage
You can use the library to get UTC and local time sunrise and sunset times typing:
from suntime import Sun, DegreesOffset, SunTimeException
MADRID_LAT = 40.416775
MADRID_LON = -3.703790
madrid_sun = Sun(MADRID_LAT, MADRID_LON)
# Get today's sunrise and sunset in UTC
sunrise_madrid = madrid_sun.get_sunrise_time()
today_ss = sun.get_sunset_time()
today_sr = sun.get_local_sunset_time()
print('Today at Madrid the sun raised at {} and get down at {} UTC'.
format(today_sr.strftime('%H:%M'), today_ss.strftime('%H:%M')))
# On a special date in your machine's local time zone
abd = datetime.date(2014, 10, 3)
abd_sr = sun.get_local_sunrise_time(abd)
abd_ss = sun.get_local_sunset_time(abd)
print('On {} the sun at Madrid raised at {} and get down at {}.'.
format(abd, abd_sr.strftime('%H:%M'), abd_ss.strftime('%H:%M')))
# offsets
horizon = madrid_sun.get_local_sunset_time(
degrees_offset=DegreesOffset.horizon.value) # 0
civil = madrid_sun.get_local_sunset_time(
degrees_offset=DegreesOffset.civil.value) # 6
nautical = madrid_sun.get_local_sunset_time(
degrees_offset=DegreesOffset.nautilcal.value) # 12
astronomical = madrid_sun.get_local_sunset_time(
degrees_offset=DegreesOffset.astronomical.value) # 18
References
- library improvement: Dusk dawn calculation
- Forked from suntime
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dt-suntime-1.0.0.tar.gz
(7.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dt-suntime-1.0.0.tar.gz.
File metadata
- Download URL: dt-suntime-1.0.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51e60de43dfe3ed75de883f2f41c1f5785bc302b6cee5b9d8f3e0afbb7e8f29c
|
|
| MD5 |
58bc61bb21dbca622dd2f073da1481b0
|
|
| BLAKE2b-256 |
9d99afd4586429eecb6e9861f148e19f506e9e18a30ca55407ae2c90d0b88d71
|
File details
Details for the file dt_suntime-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dt_suntime-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64fd3a8c080fd3b9d4cc69ed4091f7b4e8e7f353b584b3cf9439ceb31aa4c1d5
|
|
| MD5 |
98a1b6248f29c0f1645c9094ea42a607
|
|
| BLAKE2b-256 |
628baf981121f65eaf375e7dbd76381c890f4908ae4e9074aa3c271806ee3740
|