-*- coding: utf-8 -*-
"""
Created on Tue Oct 27 18:37:49 2015
@author: Rodolfo Escobar et al
"""
from datetime import datetime
from astropy.time import Time
from numpy import floor
# Reductor de rango 0-24h
def to24(x):
while x >= 24:
if x < 0:
x = x + 24
if x > 24:
x = x - 24
return x
#
# Conversor de formato de hora
def tohms(x):
time_hours = x
time_minutes = time_hours * 60
time_seconds = time_minutes * 60
horas = int(floor(time_hours))
minutos = int(floor(time_minutes % 60))
segundos = int(floor(time_seconds % 60))
return (horas,minutos,segundos)
#
#Programa principal
ut = Time(datetime.utcnow(), scale='utc')
JD= ut.jd # Fecha Juliana
D = JD - 2451545.0
GMST = 18.697374558 + 24.06570982441908*D
GMST = to24(GMST)
(horas,minutos,segundos) = tohms(GMST)
#
print "Hora Sideral:","{h}:{m}:{s}".format(h=horas, m=minutos, s=segundos)
Referencias:
Approximate Sidereal Time, USNO
Local Sidereal Time, Durham University
Astronomy With Your Personal Computer, Peter Duffett-Smith
Astropy.org
No hay comentarios:
Publicar un comentario