mirror of
https://github.com/Findus23/suntracking.git
synced 2024-08-27 19:52:18 +02:00
fix timezone
This commit is contained in:
parent
07dd0dde7a
commit
7a5ca5a82a
3 changed files with 6 additions and 2 deletions
4
guess.py
4
guess.py
|
@ -1,5 +1,7 @@
|
|||
from datetime import datetime, timedelta, time
|
||||
|
||||
from pytz import timezone
|
||||
|
||||
midday = time(12)
|
||||
|
||||
import astropy.coordinates as coord
|
||||
|
@ -9,7 +11,7 @@ import config
|
|||
|
||||
|
||||
def time2altitude(time: datetime) -> float:
|
||||
astro_time = Time(time.astimezone())
|
||||
astro_time = Time(time.astimezone(tz=timezone(config.tz)))
|
||||
altaz = coord.AltAz(location=config.loc, obstime=astro_time)
|
||||
sun = coord.get_sun(astro_time)
|
||||
return sun.transform_to(altaz).alt.degree
|
||||
|
|
|
@ -3,6 +3,7 @@ from statistics import mean, stdev
|
|||
|
||||
import astropy.coordinates as coord
|
||||
from astropy.time import Time
|
||||
from pytz import timezone
|
||||
|
||||
import config
|
||||
|
||||
|
@ -19,7 +20,7 @@ for line in lines:
|
|||
if "#" in line:
|
||||
print("skipped")
|
||||
continue
|
||||
parsetime = datetime.strptime("2018 " + line, "%Y %d.%m %H:%M").astimezone()
|
||||
parsetime = datetime.strptime("2018 " + line, "%Y %d.%m %H:%M").astimezone(tz=timezone(config.tz))
|
||||
print(parsetime.isoformat())
|
||||
time = Time(parsetime)
|
||||
print(time)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
astropy==3.0.2
|
||||
numpy==1.14.3
|
||||
pytz==2018.4
|
||||
schedule==0.5.0
|
||||
|
|
Loading…
Reference in a new issue