from astropy.io import fits
import astropy.units as u
from astropy.coordinates import SkyCoord,EarthLocation
from astropy.time import Time
hdulistex = fits.open('/media/zyy/Disk_D/望远镜检测/ali20220506/站点-20220505-694低轨-600ms-230407-可见光/站点-20220505-694低轨-600ms-230407-可见光_FITS/142945.fits/FITS_00000.fits')
hdr = hdulistex[0].header
az = hdr['AZ']
ele = hdr['EL']
date= hdr['DATE-OBS']
tm = hdr['TIME-OBS']
t = date+' '+tm
location = EarthLocation(lat=32.3052787780762 * u.deg, lon=80.0458297729492 * u.deg, height=5375.99992752075 * u.m)
crab = SkyCoord(obstime= Time(t), location=location,az = az*u.deg, alt=ele*u.deg,frame = 'altaz')
coord = crab.transform_to('icrs')
ra = str((coord.ra*u.deg).value)
dec = (coord.dec*u.deg).value
print(ra,dec)
print(type(ra))
azalt_transformto_radec
于 2022-05-14 17:34:27 首次发布