West with the Night, or East or North or South
May 12, 2010 4:00 PM Subscribe
Posting for brand-new user mdonnahoo, who will answer any queries in the thread: I am writing a program to determine how much time in a flight from Point X to Point Y occurs at night for pilot logging purposes. Is there an elegant way to calculate this?
Nighttime, in this context, is basically 1 hr after sunset to 1 hr before sunrise. So the givens are: date, time (in UTC), latitude and longitude and the time of sunset and sunrise at the point of departure and destination. It is assumed that the flight followed a great circle route and wasn't delayed, thus the speed is simply the distance traveled / time.
Because of the assumptions the accuracy need only be within a few minutes but generally speaking, the more accurate the better (it's already approximate enough as it is).
I found a
list of equations that gets me close, but the best I can come up with based on these is to use a "brute force" method and calculate a destination point every few miles and check to see if it's nighttime yet at that location. I'm sure this method would work but it's slow and inelegant and it seems like there should be a relatively simple formula to determine where (or more specifically when) along the route nighttime occurred. Any help would be appreciated.
posted by Quietgal to science & nature (10 answers total)
My impulse is that you can get a formula for the sunrise based on longitude and latitude and plug that into your position formula, but I won't attempt it myself.
posted by ecurtz at 4:20 PM on May 12, 2010