Astronomical almanac

Have you ever needed to know where the moon was during the Battle of Hastings? Probably not, but there is a marvellous piece of software which goes by the unassuming name of aa which can compute the position in the sky of any planet, sun, moon, or star, in any year/date, and at any time.
As an example we are going to use aa to find where the Moon was during the Battle of Hastings. Hastings is at latitude 50.85 degrees and Longitude 0.5734 degrees. The Battle was on 14 Oct 1066, starting at 9.00 am. We will need these data to setup aa for that location.
aa is available in Debian as the package astronomical-almanac so it installs with
apt-get install astronomical-almanac
You will get a binary in /usr/bin, files in /usr/share/doc/astronomical-almanac, and more files in /usr/share/aa,
and a global init file in /etc/aa.ini. That is all. It is a C program.

To run aa you need an aa.ini file defining the location ( on earths surface) of interest. Here is my aa.ini file for Hastings in the UK

0.5734 ;Terrestrial east longitude of observer, degrees
50.85  ;Geodetic latitude, degrees
20.0    ;Height above sea level, meters
15.0   ;Atmospheric temperature, deg C
1010.0 ;Atmospheric pressure, millibars
1      ; 0 - TDT=UT, 1 - input=TDT, 2 - input=UT
0.0    ;Use this deltaT (sec) if nonzero, else compute it.

Put this in a clean directory, then

cd cleandirectory

Then the fun begins. aa is one of those old fashioned so called interactive programs… the sort of thing you might have used in the 1970’s sitting at a teletype on a minicomputer . It asks questions. Here are the questions

	Steve Moshier's Ephemeris Program v5.6

Planetary and lunar positions approximate DE404.
Terrestrial east longitude 0.5734 deg
geocentric latitude 50.6614 deg
Earth radius 0.99799
temperature 15.0 C
pressure 1010 mb
Input time is TDT.
Enter starting date of tabulation
Calendar date: Year (1986) ? 1066
Month (1-12) (1) ? 10
Day.fraction (1.000000) ? 14
 Julian Calendar assumed.
Time: Hours (0) ? 9
Minutes (0) ? 
Seconds (0.000000) ? 
1066 October 14 Saturday  8h 39m 10.734s  UT
1066 October 14 Saturday  9h 00m 00.000s  TDT
Julian day 2110700.8750000
Enter interval between tabulations in days (1.000000) ? 
Number of tabulations to display (1) ? 
Planet number 0-9 or 88 to read star, 99 to read orbit (0) ? 3

So it has read the aa.ini file and you can see its content listed, then
I have to enter
1066 for year
10 for month
14 for day
9 for hour
and I set it to 1 days result at 1 day intervals
and choose planet no 3 (which happens to be the moon)
then it lists the result

                   The Moon

JD 2110700.88,  1066 October 14 Saturday  8h 39m 10.734s  UT
1066 October 14 Saturday  9h 00m 00.000s  TDT
nutation dRA -0.280s dDec -7.27"
Geometric lon 117.605 deg, lat -4.425 deg, rad 2.6882e-03 au
Apparent geocentric longitude 117.604 deg   latitude -4.425 deg
Distance 63.052 Earth-radii
Horizontal parallax    0d 54' 31.49"  Semidiameter    0d 14' 51.37"  
Elongation from sun 89.10 deg,  Illuminated fraction 0.49
Phase 0.08 days past Third Quarter
    Apparent:  R.A.  7h 55m 09.153s  Declination   16d 24' 14.13"  
Local apparent sidereal time  10h 34m 56.152s  
diurnal aberration dRA 0.011s dDec 0.04"
diurnal parallax dRA -93.090s dDec -1996.98"
atmospheric refraction 0.017 deg  dRA 2.395s dDec 51.97"
Topocentric:  Altitude 42.454 deg, Azimuth 237.527 deg
Topocentric: R.A.  7h 53m 38.469s   Dec.   15d 51' 49.16"  
local meridian transit 1066 October 14 Saturday  5h 54m 11.760s  UT
rises 1066 October 13 Friday 22h 11m 29.851s  UT
sets 1066 October 14 Saturday 13h 30m 36.428s  UT
Visible hours 15.3185

Marvellous. The moon rose at 22h 11m the previous day, and set at 13h 30m on the day of the battle. It was .08 days past third quarter.
So the moon was in the sky during the day of the battle, and it set in the early afternoon. The battle ended at sunset, and there was no moon then, so they had to bury the dead next day.

Now , that is OK for a single result. What I want to do with aa is calculate Moon information for a whole series of successive days over a period of 20 years. It will do it, but that arcane output generates one of those result sheets for each day. I am going to have to write a C program or a script to extract the data I need.

And, aa’s documentation is poor. It reads like a scientific treatise on celestial computations, and forgets to show the user how to use the program For example … how did I know the Moon was planet no 3? Not from the docs… I had to read the source code to find out.

There is an online version. Not sure it is exactly the same as aa

and there are a number of programs , including source for aa here

Have fun if you try aa.



I read some “study” saying how we get less sleep on average on the night of a full moon. I thought, “bolongna”. My fitbit has my sleep data for the past several years, which I downloaded. Then whipped up a Python script using a moon library from PIP. I showed the average number of hours for each day of the lunar cycle and there is NO difference from my years of fitbit data.

Pretty fun project.

There is another aspect to that. When we were all hunter-gatherers, moonlight nights were for gathering food. Therefore reproduction tended to occur at other times, ie at new moon… Females who were fertile at that time tended to leave more offspring, so there was natural selection for female menstrual cycles to be coordinated with moon phases. That is true even today, there is a correlation of the timing of menstrual cycles with the phases of the moon, and that is also why the cycle length is 29 days… the same as the moon’s cycle length.

Now , given that, there may also have been natural selection among hunter gatherers for people who could stay awake on full moon nights when all the hunting and gathering occurred. I seem to have inherited some of those genes, because I do have trouble sleeping on full moon nights. You actually have some data for number of hours of sleep and it shows no differences. I wonder if your data have been truncated by the alarm clock? I also wonder whether ‘ability to stay awake’ , if you could measure it, would correlate with moon phases.

Did you try a fourier analysis of your several years sequence of data? It would show if there were any periodic effects of any lenth of period.
That might be interesting


Another thing you might try is distance of moon from earth. When the moon is closer, gravity pull of the moon is greater. That determines spring tides, for example.
It is shown in my post as Distance 63.052 Earth-radii.
I think gravity would be least when you have a new moon ( moon and sun both countering earths gravity) and the moon is at its greatest distance from the earth, and the moon is overhead at your location.


Just by curiosity: I wonder if the software calculates historical dates on the base of the Gregorian Calendar alone or if it takes into account that dates were calculated differently before the reform.

Take the battle of Hastings. 14th October 1066 was obviously the day in the Julian Calendar. If we just counted the number of days passed since then backwards using our calendar, we should get to 26th October or so.

You might want to test one of the days from 5th to 14th October 1582. These days did never exist.


I just checked: In the astronomy app “Stellarium” (which should be included in most software repositories and is also used by professional astronomers), you can actually switch from Gregorian to Julian calendar.


Will do. I think aa uses Julian days for calculation, from what I have read. If that is true it should be OK. One obviously needs to have a proper real number timescale without gaps, for such calculations.

I dont know what would happen if you went back past the zero Julian day

I did not know about Stellarium. It may be easier to use.


Stellarium is an excellent piece of open source and contains astronomical data for nearly all catalogued sky objects.

Here a screenshot:


Stellarium is awesome. I check it quite a bit to see what is up in the sky to view. Sometimes I’m out for a walk and can see a planet, but I’m not sure what the planet is. I can easily check with Stellarium. Jupiter looked more the color of Mars to me lately, but the position and brightness were way off. So I was confused and had to check.

I could agree that we WERE hunter gatherers and it might have affected humans. This was a more recent study. And I realize you were pointing out it might have affected natural selection and we could have inherited these tendencies.

Today we are much more regulated by the day of the week than the lunar cycle I would say. My alarm clock has been set for 5:15 or 5:30 for the past 12 years or so. That’s the only time I can count on in my day to do some exercising. I’ve always been somewhat of an early riser and wake up without the alarm as much as due to the alarm.

When I was a kid I’d get up early on a Saturday morning, turn on the TV and wait for the cartoons to come on. These days TV is 24 hours, but back then there was a test pattern on when I turned it on early. Then they’d start playing some music with it. Finally the cartoons would come on.


It takes many generations for genetic adaptations to disappear from a population, once the cause disappears. Those adaptations to the lunar cycle may have faded , but they have not completely disappeared.

For many centuries we were faced with adapting to hours of daylight. I the medieval world an hour was 1/12 of the daylight period. So an hour was a different length (according toa mechanical clock) each day. Clocks changed that, and we had to adapt again. I doubt if we are fully adapted to clock time yet. We have only had a couple of centuries… maybe 10 generations , and that is not long for genetic change.

At least it does not feel like I am well adapted, when the alarm rings


1 Like

I did somethin similar once.
When we retired and moved to the country , I tried to see what ot was like for the ancient astronomers , sitting out in the desert at night recording the movements of the planets. It was quite a struggle to,identify the 5 visible planets, and I did not have anything like Stellarium to help. I used internet astronomy sites. It was fascinating to watch the looping path of Mars against the stars.

What I got out of it was an appreciation of how clever those ancient astronomers were. They came up with the celestial sphere concept with the Earth inside it. They were able to make quite precise calulations of planet positions, all with a number system that only had integers and fractions… no real numbers.
Try doing something simple, with just integers and fractions. Stellarium would have a hard time in such a number system

The other thing about the stars and planets as you see them, and as the ancients saw them, is it is an inside view. We did not get an outside view until Copernicus. Notice how the maths changes when you go from inside to outside view. Outside view is simpler.
There is a lesson in this for things other than astronomy



I tried 1582 10 9 (9 Oct 1582) in aa.
It changed it to 19 Oct 1582
so it omitted 10 days, which I think is correct.

	Steve Moshier's Ephemeris Program v5.6

Planetary and lunar positions approximate DE404.
Terrestrial east longitude 150.7200 deg
geocentric latitude 34.6398 deg
Earth radius 0.99892
temperature 15.0 C
pressure 1010 mb
Input time is TDT.
Enter starting date of tabulation
Calendar date: Year (1986) ? 1582
Month (1-12) (1) ? 10
Day.fraction (1.000000) ? 9
 Julian Calendar assumed.
Time: Hours (0) ? 
Minutes (0) ? 
Seconds (0.000000) ? 
1582 October 18 Monday 23h 57m 46.244s  UT
1582 October 19 Tuesday  0h 00m 00.000s  TDT
Julian day 2299164.5000000
Enter interval between tabulations in days (1.000000) ? 
Number of tabulations to display (1) ? 
Planet number 0-9 or 88 to read star, 99 to read orbit (0) ? 3

It actually says Julian Calendar assumed.

Also tried 30 Feb 2022. It changed it to 2 March 2022.

1 Like

I did the same Battle of Hastings calculation in aa and stellarium

                Stellarium     aa   
Moon rise       22.14        22.11     the previous day
Moon set        13.33        13.30     14 Oct
Phase           22.2 days   .08 days past 3rd quarter

Given that I had trouble with Stellarium - I could not see how to stop the clock as it moved on from my set time - I think these results are in agreement.

For Orbit computations aa says it has a precision of

0.5  arc second relative to DE404 for all dates between 1369 B.C.  and  3000    A.D. 

while Stellarium says it uses VSOPB87/ELP2000-82B and it lists DE440, DE441, … but says they are not available

These DE… things are tables of the trajectory of moon, planets, etc in the sky, and are called ephemerides. The one used when aa was written (DE404) is obviously older and therefore less accurate than the ones listed by Stellarium (DE414,…) but not used.

I cant see how to use Stellarium to export daily data over a period of 25 years, so I shall probably be staying with aa for that. Otherwise it is, as @Mina and @pdecker say a fine program. I used it in Void/KDE. I had to find a few missing libraries that the package system did not drag in as dependencies, but were obviously needed. What I have previously used for stargazing is the android app SkEye. It produces views but not data and it is easier to drive than Stellarium.


This, indeed, can never be overestimated. With hardly any technology to aid and poor theoretical knowledge coming to the point where they could make pretty accurate predictions, is absolutely amazing.

I never lived in the desert, but a couple of years in the countryside and I have to say: The beauty of the clear night sky has hardly any match.


I don’t think, it’s made to export ephemerides. For this, aa is probably the better choice.

1 Like

Agreed. When we first came here to our retirement farm, there were no lights of nearby towns visible, just a few isolated farms. You could
actually see the Magellanic clouds. Today it is more populated , there is more light, and we can see less.

I did live in the desert once… a remote research station in the far west about 150km from the nearest town. The nights were clear and bright with stars, unless there was a dust storm. The nights were also very cold… 4 blankets at night, 40 deg C during the day.
The people who live in such places are quite different. There is an outback culture of helping anyone and everyone… I think it is a way of combating what Australians call the ‘tyranny of distance’.


I can imagine … such a huge country with so few people (except for the South-East) surely creates a special culture.

Reminds of the days, decades ago, when I was travelling in the Andes, talking to older people who hardly spoke Spanish and admiring the Southern Sky, which has so much more stars than ours on the Northern Hemisphere (because you guys are looking towards the centre of our galaxy, and we’re looking away from it).

Oh, I see. I did not appreciate that. Yes the southern sky around the Milky Way is beautiful.
The Andes would have been some experience. There are lost cultures that were very significant. Australia imported some Alpacas and they are now becoming an important fibre industry, competing with wool.

People tend to rally and help when there is danger. Isolated locations are dangerous. Medical help is not at hand. We had a Flying Doctor service. I had to call in the emergency plane once when someone had an accident. We used a pedal radio to communicate with the Flying Doctor base station. The Flying Doctor service still exists today.

Experiencing these remote communities can be life changing. You need to live and work there, not just fly past in a tourist bus.

1 Like