Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

SpheroidLocation.cartesian_cords call does not correctly convert geodetic coordinates to cartesian coordinates #1600

Open
spindirella opened this issue Dec 15, 2022 · 0 comments

Comments

@spindirella
Copy link

from astropy import units as u
from poliastro.bodies import Earth
from poliastro.spheroid_location import SpheroidLocation

'''Anchorage'''
gstation = SpheroidLocation(body=Earth,
                            lat=61.2176 << u.deg, 
                            lon=210.1003 << u.deg,
                            h=31.09 << u.m)

g = gstation.cartesian_cords.value/1000 #km #ground station location, cartesian coords
print(g)

[-2659101.73006609 -4840409.50949421 -3180013.2204397 ] m

z component of g should be a positive value since it is north of the equator. Consequently, gstation.N (the normal vector) and other values are incorrect.

Using astropy.coordinates.spherical_to_cartesian provides the approximately correct value, however:

from astropy.coordinates import spherical_to_cartesian as s2c
g = s2c(lat=gstation._lat,lon=gstation._lon,r=gstation._h+gstation._a) << u.km
g = g.value
print(g)

[-2656.86215945 -1540.14771067 5590.17455692]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant