I have a Python code that converts (u,v)to (s,d):
def d2r(d):
r = d * math.pi / 180.0
return (r)
def r2d(r):
d = r * 180.0 / math.pi
return (d)
def sd2uv(s,d):
r = d2r(d)
u = s * math.sin(r)
v = s * math.cos(r)
return (u,v)
def uv2sd(u,v):
s = math.sqrt((u*u)+(v*v))
r = math.atan2(u,v)
d = r2d(r)
if d < 0:
d = 360 + d
return (s,d)
The u data are stored in u.txt, each line has one number; the v data are stored in v.txt and each line has one number too. My question is how to extract data from these two files and then use them in the Python code to print (s,d)? Thanks!
I think this should do it: