Skip to content

Instantly share code, notes, and snippets.

@wiseman
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wiseman/9749487 to your computer and use it in GitHub Desktop.
Save wiseman/9749487 to your computer and use it in GitHub Desktop.
MH 370 vs. geostationaryish satellite with 3 deg. orbital inclination
import math
def deg2rad(d):
return d * math.pi / 180.0
# Convert spherical coordinates to cartesian.
def cart(c):
return [c[0] * math.sin(c[1]) * math.cos(c[2]),
c[0] * math.sin(c[1]) * math.sin(c[2]),
c[0] * math.cos(c[1])]
# Distance between cartesian coordinates.
def dist(c1, c2):
dx = abs(c1[0] - c2[0])
dy = abs(c1[1] - c2[1])
dz = abs(c1[2] - c2[2])
return math.sqrt(dx * dx + dy * dy + dz * dz)
R_EARTH = 6378
R_GEO = R_EARTH + 35786
sat1 = [R_GEO, math.pi / 2.0, 0.0]
sat2 = [R_GEO, math.pi / 2.0 + deg2rad(3.0), 0.0]
# -40 latitude
plane = [R_EARTH, deg2rad(130.0), 0.0]
print dist(cart(sat1), cart(plane)) - dist(cart(sat2), cart(plane))
@wiseman
Copy link
Author

wiseman commented Mar 24, 2014

[jwiseman@John-Wisemans-MacBook-Pro mh370]$ python mh370_doppler.py
234.433290731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment