Topocentric Position to Geocentric Frame Conversion

Hi @Serrof.

Thank you for your reply. I tried to implement what was tagged as the solution in the link that you sent. I tried to implement it as shown below. I am simply trying to get a position vector right now in the ECI (J2000) frame. I am still getting values that are off. Here is my code:

# create a timescale object for UTC time
utc_time_scale = TimeScalesFactory.getUTC()

# initialise our different frames
ECI = FramesFactory.getEME2000()  # Define ECI reference frame.
ECEF = FramesFactory.getITRF(IERSConventions.IERS_2010, True)  # Define ECEF reference frame.

# we need a BodyShape object to reference when we make our Topocentric Frame
earth = OneAxisEllipsoid(
    Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
    Constants.WGS84_EARTH_FLATTENING,
    ECEF,
)

def create_sat_position(ra, dec, lat, lon, alt, rng, earth: OneAxisEllipsoid, date: AbsoluteDate):
    """
    Returns 'Position' of observation in ECI frame.
    """
    range_in_m = rng * 1000
    alt_in_m = alt * 1000

    ra = radians(ra)
    dec = radians(dec)
    lat = radians(lat)
    lon = radians(lon)

    # Create the topocentric frame of the observer
    groundStationPoint = GeodeticPoint(lat, lon, alt_in_m)
    groundStationFrame = TopocentricFrame(earth, groundStationPoint, "Observer")

    # Convert Ra and Dec to a direction vector in the topocentric frame
    sat_direction_topo = Vector3D(
        range_in_m * cos(dec) * cos(ra),
        range_in_m * cos(dec) * sin(ra),
        range_in_m * sin(dec)
    )

    transform = groundStationFrame.getTransformTo(earth.getBodyFrame(), date)

    # Transform RADEC to ECI coordinates
    pvECI = groundStationFrame.getTransformTo(earth.getBodyFrame(), date).transformPVCoordinates(PVCoordinates(sat_direction_topo,
                         Vector3D.ZERO)); #Velocity is assumed to be zero in this example

    print(pvECI.getPosition().scalarMultiply(1/1000))


position = create_sat_position(
    327.850223,
    36.185382,
    38.994194,
    -104.6365,
    2.237,
    1120.4,
    earth,
    AbsoluteDate(2023, 6, 23, 4, 46, 38.674272, utc_time_scale),
)

I am concerned that the frame conversion is still not correct which might be what is causing this disparity. I am still confident that the date, time and measurement values are all accurately inputted into the function call. For your reference:

Expected Result: X=-1873.775, Y = -4683.677, Z = 4658.770 (km)

After implementing the solution outlined in your suggestion, I am getting:

X = -720.3461726758, Y = -5,788.190605978, Z = 4,035.4618581839

I would appreciate any advice. Thank you.