Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

How do I use Astropy to transform coordinates from J2000 to Lat, Lon, and Altitude

$
0
0

I've followed the instructions from questions present on this site pertaining to this issue, but the code all seems off. For one thing, the altitude seems far too low, and it doesn't appear that the time I set impacts the location substantially, which it should since as I understand the J2000 frame is time sensitive.

Here is the code I'm running in VSCODE:

from astropy import coordinates as coordfrom astropy import units as ufrom astropy import timefrom astropy.time import Timenow = Time("2024-03-07 00:46:00.000", scale='utc')xyz = [1155.746046202530, -6632.420367726780, 953.533229633281]cartrep = coord.CartesianRepresentation(*xyz, unit=u.m)gcrs = coord.GCRS(cartrep, obstime = now)itrs = gcrs.transform_to(coord.ITRS(obstime = now))loc = coord.EarthLocation(*itrs.cartesian.xyz)print(loc.lat, loc.lon, loc.height)

This returns -1d21m45.24750203s 103d26m20.83691865s -6371417.547754194 m, which I'm not certain is correct. The altitude is close to the surface of the earth when it should be nearly 500 km higher. And it doesn't seem the time affects it greatly. These coordinates and times are all based on the ISS Trajectory Data from: https://spotthestation.nasa.gov/trajectory_data.cfm


Viewing all articles
Browse latest Browse all 23160

Trending Articles