Ra dec to az el

Hi!! How can I convert ra dec to azel using a topocentric system without knowing the state ??

Hi there,

you could do something along these lines I think:

  1. Create a Vector3D of arbitrary norm e.g. new Vector3D(ra, dec)
  2. Create your TopocentricFrame
  3. Call the getTrackingCoordinates method, with arguments: your vector, the inertial axes where the RADEC are defined and the date

Cheers,
Romain.

Thanks for the reply!! However, my code gives a result that does not match the astropy

from astropy.coordinates import SkyCoord, EarthLocation, AltAz, ITRS
from astropy.time import Time
import astropy.units as u

ra = 0.0*u.degree
dec = 15.0*u.degree
sky_coord = SkyCoord(ra=ra, dec=dec, frame='icrs')

location = EarthLocation(lat=43*u.deg, lon=77*u.deg, height=0.0*u.m)
obs_time = Time('2025-06-09 00:00:00')

altaz_frame = AltAz(obstime=obs_time, location=location)
altaz_coord = sky_coord.transform_to(altaz_frame)

print(f"Altitude: {altaz_coord.alt}")
print(f"Azimuth: {altaz_coord.az}")




import orekit
orekit.initVM()

from orekit.pyhelpers import setup_orekit_curdir
setup_orekit_curdir()

from org.orekit.time import AbsoluteDate, TimeScalesFactory
from org.orekit.utils import IERSConventions
from org.orekit.frames import FramesFactory, TopocentricFrame
from org.orekit.bodies import GeodeticPoint
from org.hipparchus.geometry.euclidean.threed import Vector3D
from org.orekit.models.earth import ReferenceEllipsoid

import math

earth = ReferenceEllipsoid.getWgs84(FramesFactory.getITRF(IERSConventions.IERS_2010, True))
station_lat = math.radians(43.0)
station_lon = math.radians(77.0)
station_alt = 0.0

geo_point = GeodeticPoint(station_lat, station_lon, station_alt)
topo = TopocentricFrame(earth, geo_point, "TSO")
date = AbsoluteDate(2025, 6, 9, 0, 0, 0.0, TimeScalesFactory.getUTC())

from math import radians, degrees
ra_deg = sky_coord.ra.deg
dec_deg = sky_coord.dec.deg

ra = radians(ra_deg)
dec = radians(dec_deg)

direction = Vector3D(ra, dec)

azEl = topo.getTrackingCoordinates(direction, FramesFactory.getICRF(), date)

print(f"Orekit: Altitude = {degrees(azEl.getElevation()):.2f}°")
print(f"Orekit: Azimuth = {degrees(azEl.getAzimuth()):.2f}°")

Out:
Altitude: 54.51029030134816 deg
Azimuth: 133.84478671101272 deg
Orekit: Altitude = 6.80°
Orekit: Azimuth = 64.86°

Hi,

yeah the problem must be the origin, the RA-DEC are centered on the station, but ICRF is attached to the solar system barycenter.
I’ll get back to you when I can. In the meantime if somebody has something, please go ahead.

Cheers,
Romain.

1 Like

Hi,

this works:

earth = ReferenceEllipsoid.getWgs84(FramesFactory.getITRF(IERSConventions.IERS_2010, True))
station_lat = radians(43.0)
station_lon = radians(77.0)
station_alt = 0.0

geo_point = GeodeticPoint(station_lat, station_lon, station_alt)
topo = TopocentricFrame(earth, geo_point, "TSO")
date = AbsoluteDate(2025, 6, 9, 0, 0, 0.0, TimeScalesFactory.getUTC())

ra = radians(0.0)
dec = radians(15.0)

frame = FramesFactory.getEME2000()
topo_in_inertial = topo.getPosition(date, frame)
direction_in_topo = Vector3D(ra, dec)

az_el = topo.getTrackingCoordinates(topo_in_inertial.add(direction_in_topo), frame, date)

Cheers,
Romain.

Thank you!! Now everything matches