To help me with calculating the visual magnitude of the International Space Station I need to be able to calculate the phase angle.
Can anyone help me calculate that?
For any moment in time I have generated the Obs
object and the ISS
object using PyEphem
. For the observer I have the Alt/Az
to the ISS
and Alt/Az
to the Sun... And of course I have the ISS.range
(in km) from the observer. So it looks to me that I should be able to calculate the phase angle with "simple" geometry. Unfortunately, this simple geometry is a little beyond what I am capable of confidently working out (been too long I guess since I last did that).
ANSWER: I figured it out (with the help of the good old Internets) This is a partial code snippet (updated with correction for ephem.earth_radius to Km by Leandro Guedes)
# SSA Triangle. We have side a and b and angle C. Need to solve to find side c
a = sun.earth_distance * au - ephem.earth_radius/1000 #distance sun from observer (Km)
b = iss.range / 1000 # distance to ISS from observer (Km)
angle_c = ephem.separation( (iss.az, iss.alt), ( sun.az, sun.alt) )
c = math.sqrt( math.pow(a,2) + math.pow(b,2) - 2*a*b*math.cos( angle_c) )
# now we find the "missing" angles (of which angle A is the one we need)
angle_a = math.acos((math.pow(b,2) + math.pow( c,2) - math.pow(a,2)) / (2 * b * c))
angle_b = math.pi - angle_a - angle_c #note: this is basically ZERO - not a big surprise really - and I don't need this anyway.
phase_angle = angle_a # This is the angle we need. BINGO!!