Esempio n. 1
0
def compute_hourangle(date, obsvr_long, obsvr_lat, obsvr_hgt, mean_ra, mean_dec, dbg=False):

    mjd_tdb = datetime2mjd_tdb(date, obsvr_long, obsvr_lat, obsvr_hgt, False)
 # Compute MJD_UTC
    mjd_utc =  datetime2mjd_utc(date)

# Compute UT1-UTC

    dut = ut1_minus_utc(mjd_utc)

# Compute local apparent sidereal time
# Do GMST first which takes UT1 and then add East longitude and the equation of the equinoxes
# (which takes TDB)
#
    gmst = S.sla_gmst(mjd_utc+(dut/86400.0))
    stl = gmst + obsvr_long + S.sla_eqeqx(mjd_tdb)

    logger.debug('GMST, LAST, EQEQX, GAST, long= %.17f %.17f %E %.17f %.17f' % (gmst, stl, S.sla_eqeqx(mjd_tdb), gmst+S.sla_eqeqx(mjd_tdb), obsvr_long))

    (app_ra, app_dec) = S.sla_map(mean_ra, mean_dec, 0.0, 0.0, 0.0, 0.0, 2000.0, mjd_tdb)
    (ra_str, dec_str) = radec2strings(app_ra, app_dec)
    logger.debug("%f %f %s %s" % (app_ra, app_dec, ra_str, dec_str))
    hour_angle = stl - app_ra
    logger.debug(hour_angle)
    hour_angle = S.sla_drange(hour_angle)
    logger.debug(hour_angle)

    return hour_angle
Esempio n. 2
0
def moon_ra_dec(date, obsvr_long, obsvr_lat, obsvr_hgt, dbg=False):
    '''Calculate the topocentric (from an observing location) apparent RA, Dec
    of the Moon. <date> is a UTC datetime, obsvr_long, obsvr_lat are geodetic
    North/East +ve observatory positions (in radians) and obsvr_hgt is the height
    (in meters).
    Returns a (RA, Dec, diameter) (in radians) tuple.'''

    body = 3 # The Moon...

    mjd_tdb = datetime2mjd_tdb(date, obsvr_long, obsvr_lat, obsvr_hgt, dbg)

# Compute Moon's apparent RA, Dec, diameter (all in radians)
    (moon_ra, moon_dec, diam) = S.sla_rdplan(mjd_tdb, body, obsvr_long, obsvr_lat)

    logger.debug("Moon RA, Dec, diam=%s %s %s" % (moon_ra, moon_dec, diam))
    return (moon_ra, moon_dec, diam)
Esempio n. 3
0
def moonphase(date, obsvr_long, obsvr_lat, obsvr_hgt, dbg=False):

    mjd_tdb = datetime2mjd_tdb(date, obsvr_long, obsvr_lat, obsvr_hgt, dbg)
    (moon_ra, moon_dec, moon_diam) = S.sla_rdplan(mjd_tdb, 3, obsvr_long, obsvr_lat)

    (sun_ra, sun_dec, sun_diam) = S.sla_rdplan (mjd_tdb, 0, obsvr_long, obsvr_lat)

    cosphi = ( sin(sun_dec) * sin(moon_dec) + cos(sun_dec) \
        * cos(moon_dec) * cos(sun_ra - moon_ra) )
    logger.debug("cos(phi)=%s" % cosphi)

# Full formula for phase angle, i. Requires r (Earth-Sun distance) and del(ta) (the
# Earth-Moon distance) neither of which we have with our methods. However Meeus
# _Astronomical Algorithms_ p 316 reckons we can "put cos(i) = -cos(phi) and k (the
# Moon phase) will never be in error by more than 0.0014"
#    i = atan2( r * sin(phi), del - r * cos(phi) )

    cosi = -cosphi
    logger.debug("cos(i)=%s" % cosi)
    mphase = (1.0 + cosi) / 2.0

    return mphase