|
# -*- coding: utf-8 -*- |
|
# calculate GMT offset given: |
|
# - lunar center's arc distance from sun center, measured locally at noon |
|
# - lunar center's arc distance from sun center, measured at Greenwich at noon |
|
# - lunar center's arc distance from sun center, measured at Greenwich at 3PM |
|
|
|
def angle_to_float(deg, min, sec): |
|
return deg + min/60.0 + sec/3600.0 |
|
|
|
def gmt_from_lunar(angle_local_tup, angle_greenwich_tup, angle_greenwich_3pm_tup): |
|
'''each tup (<deg>, <min>, <sec>)''' |
|
angle_local = angle_to_float(*angle_local_tup) |
|
angle_greenwich = angle_to_float(*angle_greenwich_tup) |
|
hr_arcdiff = (angle_to_float(*angle_greenwich_3pm_tup)-angle_greenwich) / 3.0 |
|
print "hour arcdiff:", hr_arcdiff |
|
return (angle_local - angle_greenwich) / hr_arcdiff |
|
|
|
|
|
if __name__ == "__main__": |
|
data = { |
|
2: [(78,13,52),(84,45,40),(86,23,56)], |
|
3: [(53,53,19),(56,48,24),(58,15,28)], |
|
6: [(74,14,7),(71,32,58),(73,3,21)], |
|
7: [(49,49,13),(44,42,27),(42,59,34)], |
|
8: [(82,29,26),(85,43,56),(87,20,48)], |
|
} |
|
for case_number, tuples in data.iteritems(): |
|
print "CASE #%d"%case_number |
|
gmt = gmt_from_lunar(*tuples) |
|
print "GMT:", gmt |