Plane flight sunsets
When I'm going to fly somewhere, I sometimes spend a bit of time thinking about what it might be possible to see from the window of the plane. When I say sometimes, I mean always without fail, and when I say a bit of time, I mean more time than is normal.
The ultimate aim is to be in a window seat, flying over something interesting, when it's not cloudy, and during the day. Then you might see something totally awesome, like Greenland's mountains and glaciers.
Estimating when there'll be enough light to see a particular awesome thing during your flight is non-trivial if the flight is long. I mean, it's easy to have an idea: you know that if you're flying towards the east, you're going to be quickly heading into the dark side of the Earth and all that comes with it. On the other hand if you're flying west you can experience a longer than normal period of daylight. But I always want to know where exactly, on the route, the sun will appear or disappear. That way I can know before the flight whether I should have any hope of realising my dream of seeing the Himalayas from the air at sunset.
Luckily, I'm a huge geek, so I wrote a bit of R code to answer my own question. You enter your start and end airport codes, and some departure and arrival times, and it will spit out a map like this:
The flight path is shown as a great circle line between the start and end points. The line colour is red for day time, blue for night time. The size of the white dots corresponds to the sun's elevation during nautical twilight. Nautical twilight is when the sun's elevation is greater than -12 degrees, after which it's light enough to navigate at sea using the horizon, but that's beside the point because from now on I'm going to just add the word "nautical" to arbitrary things because it sounds so cool.
For fun, here are a couple of other flights. Here is QF7 from Sydney to Dallas Fort Worth: this route is currently the world's longest non-stop flight by distance. At the moment it's sunnier in the northern hemisphere than in the southern.
And here is the awesome flight path of Dubai to Los Angeles, complete with projectional distortion in the north (the white dots are all 40 minutes apart). The sun doesn't set on this sixteen hour flight!
One of the reasons that R is great is its amazing community of contributors. That means that when you think up some stupid thing to code, somebody else has almost always written libraries that do either the whole thing or at least the tricky and/or useful parts. This was true in this case: I used maps to draw the map, geosphere to calculate the great circle paths, maptools to find the sun elevation at each point on the path, and the wonderful ggplot2 to make it look nice.
Of course planes don't fly exactly on great circles, so these maps are just a rough guide. The point here is that if I was flying on SQ345, I wouldn't see the Himalayas out the window. As the map shows, it would be well after dark by that stage of the flight, and more importantly SQ345 does not actually fly anywhere near the Himalayas. But you see: now we know.