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 t
Since angle_b
is practically zero (max 0.00016 degrees at perihelion and ISS directly overhead), you could just do angle_a = math.pi - angle_c
.
This has about the same accuracy, since you already have made some minor errors with distance a
.
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!!
(Formally posting my answer AS an ACTUAL answer - yes - it took me a while to figure out that's what I should have done all along).