Skip to content

Instantly share code, notes, and snippets.

@mainvoid007
Created July 15, 2016 12:20
Show Gist options
  • Save mainvoid007/957bd0b9c03771199630bb2afe50f8cd to your computer and use it in GitHub Desktop.
Save mainvoid007/957bd0b9c03771199630bb2afe50f8cd to your computer and use it in GitHub Desktop.
def pol2latlon(x,y):
R = 6370.04
lam0 = math.radians(10);
phi0 = math.radians(60);
lam = np.arctan(x*-1 / y) + lam0
z = math.pow(R,2) * math.pow(1+np.sin(phi0),2) - (math.pow(x,2) + math.pow(y,2))
n = math.pow(R,2) * math.pow(1+np.sin(phi0),2) + (math.pow(x,2) + math.pow(y,2))
phi = np.arcsin(z/n)
return (math.degrees(lam), math.degrees(phi))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment