[AstroPy] How to separate %H %M %S in LST CALCULATION

Miro Saide mirosaide at gmail.com
Fri Feb 11 05:49:37 EST 2022


Hi all

I am calculating local sidereal time and I wonder how can I split the
output to have hours, minutes and seconds and the put it in iso format.
The code example is below:

import numpy as np
import astropy.units as u
from astropy.time import Time
from astropy.coordinates import SkyCoord, EarthLocation, AltAz
from astroplan import Observer, FixedTarget

target = SkyCoord.from_name("Barnard's star")
time = Time("2021-9-21 00:00:00", scale='utc')
Location = Observer(latitude=65.033*u.deg, longitude=-18.536*u.deg)

star_rise_time = Location.target_rise_time(time, target, which='previous')
star_set_time = Location.target_set_time(time, target, which='next')

print(star_rise_time.iso)
print(star_set_time.iso)

time_LST_rise = Location.local_sidereal_time(star_rise_time,'mean',
model=None)
time_LST_set = Location.local_sidereal_time(star_set_time,'mean',
model=None)
print(time_LST_rise)
print(time_LST_set)

Thanks in advance.

*Ramiro Caisse Saide*
*MPhil Research Student*
Department of Physics
University of Mauritius
Contact Number: +258 845672884
Email: ramiro.saide at umail.uom.mu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/astropy/attachments/20220211/30998e5c/attachment.html>


More information about the AstroPy mailing list