Astronomical Algorithms

A simple utility to get information on solar and lunar position relative to any geographic location or time. Accurate to within ~seconds for rise-set times, and ~1/2 minute for the solstices/equinoxes. A host of other solar and lunar trivia are presented plus an inordinate number of different types of 'time'.

A 'Tools' menu will be added to Igor, from which you can choose 'Astronomical data' at which point a dialogue where you can enter your location, time zone, altitude etc. will be presented 

By default the current time zone and location of your machine are looked up by a web service - this only gets the position of your local exchange which could be quite far from your actual location but doesn't reveal or require any personal information and uses your public facing IP address for this purpose. This can be disabled by commenting the following line at the top of the AtsronomicalData.ipf:

#define webApps             // comment this to disable web applications which can be slow

// some defaults for latitude and longitude
Static Constant defaultlatVar =  -7.9286077  // Obsidian Hotel, Georgetown
Static Constant defaultlonVar =  -14.4106611 // Obsidian Hotel, Georgetown

A set of static default lat/lon locations can be set - currently to the sadly closed Obsidian Hotel, Georgetown, Ascension Island which will be used. Two other web features will also be disabled which are slow - these look up the current modelled location of the geomagnetic North and South poles from NOAA.

Originally written to get the sunset time from the POV of an aircraft flying over the North Atlantic for one specific case to prove a point, hence corrections for observer altitude are included as this affects rise and set times, away from the horizon the effect is minimal. The default altitude is 0 m which should be reasonable for most purposes. 

Library of functions translated from this excellent resource from Alan Eliasen, itself an implementation of the comprehensive book "Astronomical Algorithms" Second Edition (1998) by Jean Meeus. There are some unused functions provided for completeness. The GUI output is not a requirement and is provided for convenience as a fun distraction. Igor 9 is required due to the heavy use of the in-line multiple return syntax - no other requirements exist.  

All credit to Alan Eliasen and Jean Meeus. Further credit to Alan Eliasen for his kind help with ephemeris time. 


1) When retrieving information across a daylight saving boundary times will likely be off by an hour. i.e. daylight saving is ignored. Hopefully daylight saving will be scrapped soon as it hasn't made sense since the invention of the electric lightbulb. 

2) Leap seconds are looked up and will have to be updated manually as there is no way to know when or if one will be added (they are observed, not calculated). There is a possibility that leap seconds will be scrapped as they don't make sense when considering true time drifts by a quarter of a day each year.   


Input of position and date/time parameters Output of solar and lunar data

Project Details

Current Project Release

Release File: (967.56 KB)
Version: IGOR_9.00x_v101
Version Date:
Version Major: 1
Version Extra: 1
Version Patch Level: 0
OS Compatibility: Windows Mac-Intel
Release Notes:
  • Bug fixes:
  1. Fixed where the time of Nadir wasn't adjusted for UTC offset
  2. Kluged where secant solvers didn't converge or gave erroneous results due to whatever astronomical event being calculated not happening on the specified date e.g. sun never setting at high latitudes. Solvers are limited to 10 iterations - set by the iterations static constant in AstronomicalAlgorithms.ipf
  • Included:
  1. AstronomicalData.ipf
  2. AstronomicalDataWebTools.ipf
  3. AstronomicalAlgorithms.ipf
  4. EphemerisTimeDelta.ipf
View All Releases




Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More