FDC
Around the World in Four Minutes with Father Christmas
Dave Jesse on January 9, 2013
0

Welcome back after the Christmas holidays, and may I wish you a Happy New Year, wherever you may be. It’s a little bit late, but I thought I would explain how Father Christmas has been helping us to test POLARIS.

One of the questions that analysts ask when looking at flight data is “was it daytime or nighttime?” That’s to say, what could the pilot see out of the cockpit windows? (OK, we’ll leave the issue of clouds and other weather information for another day).

The old-fashioned answer is easy. You look up the sunrise and sunset tables and if you are between the two, it’s daylight. (In fact, this is what some systems still do). However, sunrise and sunset times vary depending upon where you are and the date and time. So, for an aircraft moving in time and space this gets a little trickier. Now we don’t really need to work out the sunrise and sunset times as what we really want to know is whether the sun is above the horizon.

With a little mathematics, we rearranged the astronomical equations which map the movement of the planets to compute the angle of the sun with respect to the earth’s horizon for any location and time. Add in a bit of research and we found that most Aviation Authorities accept that when the sun is less than 6 degrees below the horizon it’s twilight, and light enough to treat this as daytime.

Almost there. All we need now is to check the calculations. The Druids have known when the sun will rise on the summer solstice at Stonehenge for thousands of years, so that proved the calculation for one place and time.

Next we have to check the calculations all around the world. Ideally, we need someone who flies around the world at a known time of year.

Enter Father Christmas, who we know travels all round the world on Christmas night, starting at 1:00 in the morning – except that it’s daylight at that time when he starts in the Pacific, of course. As you know, it only takes him 256 seconds to fly all round the world, so the finished test code is…

[sourcecode language=”python” wraplines=”false” collapse=”false”] def test_father_christmas(self):
”’Starting on the far side of the world, he flies all round
delivering parcels mostly by night (in the northern lands).
”’
lat = P(‘Latitude’, np.ma.arange(60,64,1/64.0))
lon = P(‘Longitude’, np.ma.arange(-180,180,90/64.0))
start_dt = A(‘Start Datetime’, datetime.datetime(2012,12,25,01,00))
dur = A(‘HDF Duration’, 256)
day = Daylight()
day.get_derived((lat, lon, start_dt, dur))
expected = [‘Day’, ‘Night’, ‘Night’, ‘Night’] np.testing.assert_array_equal(day.array, expected)
[/sourcecode]

This test works fine, and we should have all the other tests passing before we release the code in the middle of the month. With the open source software release imminent, you could say there’s Daylight at the end of the tunnel (ugh!).

TTFN
Dave