In [8]:
# calculation from: http://astro.uchicago.edu/cosmus/tech/latlong.html
# Written as python function by team rama.
import numpy as np
def ll2xyz(lat, lon, R):
""" Convert Latitude/Longitude coordinates into cartesian
coordinates.
Inputs
------------
Latitude: scalar float in degrees
Longitude: scalar float in degrees
R: radius to object from Sun
Outputs
------------
cart is 1x3 array that is filled with result
cart = [x, y, z]
"""
cart = np.zeros(3)
LAT = lat * np.pi/180
LON = lon * np.pi/180
# x component
cart[0] = -R * np.cos(LAT) * np.cos(LON)
# y component
cart[1] = R * np.sin(LAT)
# z component
cart[2] = R * np.cos(LAT) * np.sin(LON)
return cart
In [9]:
# Dictionaries
# R, semimajor axis, in AU
R = {'mercury': 0.38709893,
'venus': 0.72333199,
'earth': 1.00000011,
'mars': 1.52366231,
'jupiter': 5.20336301,
'saturn': 9.53707032,
'uranus': 19.19126393,
'neptune': 30.06896348,
'eris': 68.049918,
}
# in km/s
Vel = {'mercury': 47.36,
'venus': 35.02,
'earth': 29.78,
'mars': 24.07,
'jupiter': 13.06,
'saturn': 9.68,
'uranus': 6.80,
'neptune': 5.43,
'eris': 3.4344,
}
In [10]:
# * Mercury
# * Lat: 5.3548
# * Lon: 98.0342
# * R : 0.38709893 (AU)
# * e : 0.20563069
# * Vel: 47.36(kms-1)
# * Venus
# * Lat: -3.3844
# * Lon: 342.2338
# * R : 0.72333199 (AU)
# * e : 0.00677323
# * Vel: 35.02 (kms-1)
# * Earth
# * Lat: 0.0011
# * Lon: 199.3471
# * R : 1.00000011 (AU)
# * e : 0.01671022
# * Vel: 29.78 (kms-1)
# * Mars
# * Lat: 0.3171
# * Lon: 219.6337
# * R : 1.52366231 (AU)
# * e : 0.09341233
# * Vel: 24.07 (kms-1)
# * Jupiter
# * Lat: 1.2249
# * Lon: 170.4785
# * R : 5.20336301 (AU)
# * e : 0.04839266
# * Vel: 13.06 (kms-1)
# * Saturn
# * Lat: 1.6770
# * Lon: 251.2103
# * R : 9.53707032 (AU)
# * e : 0.05415060
# * Vel: 9.68 (kms-1)
# * Uranus
# * Lat: -0.6226
# * Lon: 20.2212
# * R : 19.19126393 (AU)
# * e : 0.04716771
# * Vel: 6.80 (kms-1)
# * Neptune
# * Lat: -0.8237
# * Lon: 339.5081
# * R : 30.06896348 (AU)
# * e : 0.00858587
# * Vel: 5.43 (kms-1)
# * Eris
# * Lat: -10.5916
# * Lon: 350.3274
# * R : 68.049918 (AU)
# * e : 0.433628367
# * Vel: 3.4344 (kms-1)
In [11]:
# example
merc = ll2xyz(5.3548, 98.0342, R['mercury'])
venus = ll2xyz(-3.3844, 342.2338, R['venus'])
earth = ll2xyz(0.0011, 199.3471, R['earth'])
mars = ll2xyz(0.3171, 219.6337, R['mars'])
jup = ll2xyz(1.2249, 170.4785, R['jupiter'])
sat = ll2xyz(1.6770, 251.2103, R['saturn'])
uran = ll2xyz(-0.6226, 20.2212, R['uranus'])
nep = ll2xyz(-0.8237, 339.5081, R['neptune'])
eris = ll2xyz(-10.5916, 350.3274, R['eris'])
In [12]:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
#%matplotlib inline
%matplotlib notebook
In [13]:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(0, 0, 0, zdir='z', s=20, c='y')
ax.scatter(merc[0], merc[1], merc[2], zdir='z', s=20, c='g')
ax.scatter(venus[0], venus[1], venus[2], zdir='z', s=20, c='g')
ax.scatter(earth[0], earth[1], earth[2], zdir='z', s=20, c='g')
ax.scatter(mars[0], mars[1], mars[2], zdir='z', s=20, c='g')
ax.scatter(jup[0], jup[1], jup[2], zdir='z', s=20, c='g')
ax.scatter(sat[0], sat[1], sat[2], zdir='z', s=20, c='g')
ax.scatter(uran[0], uran[1], uran[2], zdir='z', s=20, c='g')
ax.scatter(nep[0], nep[1], nep[2], zdir='z', s=20, c='g')
ax.scatter(eris[0], eris[1], eris[2], zdir='z', s=20, c='g')
Out[13]:
In [14]:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(0, 0, 0, zdir='z', s=20, c='y')
Out[14]:
In [ ]: