SLALIB1 is a library of routines intended to make accurate and reliable positional-astronomy applications easier to write. Most SLALIB routines are concerned with astronomical position and time, but a number have wider trigonometrical, numerical or general applications. The applications ASTROM, COCO, RV and TPOINT all make extensive use of the SLALIB routines, as do a number of telescope control systems around the world. The SLALIB versions currently in service are written in Fortran 77 and run on VAX/VMS, several Unix platforms and PC. A proprietary ANSI C version is also available from the author; it is functionally similar to the Fortran version upon which the present document concentrates.
Here is a simple example of an application program written using SLALIB calls:
In this example, SLALIB not only provides the complicated FK4 to FK5 transformation but also simplifies the tedious and error-prone tasks of decoding and formatting angles expressed as hours, minutes etc. The example incorporates range checking, and avoids the notorious “minus zero” problem (an often-perpetrated bug where declinations between and lose their minus sign). With a little extra elaboration and a few more calls to SLALIB, defaulting can be provided (enabling unused fields to be replaced with commas to avoid retyping), proper motions can be handled, different epochs can be specified, and so on. See the program COCO (SUN/56) for further ideas.
SLALIB contains 188 routines covering the following topics:
SLALIB was designed to give application programmers a basic set of positional-astronomy tools which were accurate and easy to use. To this end, the library is:
A few caveats:
The Fortran versions of SLALIB use ANSI Fortran 77 with a few commonplace extensions. Just three out of the 188 routines require platform-specific techniques and accordingly are supplied in different forms. SLALIB has been implemented on the following platforms: VAX/VMS, PC (Microsoft Fortran, Linux), DECstation (Ultrix), DEC Alpha (DEC Unix), Sun (SunOS, Solaris), Hewlett Packard (HP-UX), CONVEX, Perkin-Elmer and Fujitsu.
An ANSI C version of SLALIB is available from the author but is not part of the Starlink release. The
functionality of this (proprietary) C version closely matches that of the Starlink Fortran SLALIB, partly
for the convenience of existing users of the Fortran version, some of whom have in the past
implemented C “wrappers”. The function names cannot be the same as the Fortran versions because
of potential linking problems when both forms of the library are present; the C routine which is the
equivalent of (for example)
slaRefro. The types of arguments follow the Fortran version,
except that integers are
int rather than
long (the one exception being
slaIntin, which returns a
and is supplemented by an additional routine, not present in the Fortran SLALIB, called
which returns an
int). Argument passing is by value (except for arrays and strings of
course) for given arguments and by pointer for returned arguments. All the C functions are
The Fortran routines
sla_WAIT have no C counterparts.
Further details of the C version of SLALIB are available from the author. The definitive guide to the
calling sequences is the file
The homogeneity and ease of use of SLALIB could perhaps be improved in the future by turning to object-oriented techniques, in particular through the C++ and Java languages. For example “celestial position” could be a class and many of the transformations could happen automatically. This requires further study and would result in a complete redesign. Various attempts have been made to do this, but none as yet has the author’s seal of approval. Furthermore, the impact of Fortran 90 has yet to be assessed. Should compilers become widely available, some internal recoding may be worthwhile in order to simplify parts of the code. However, as with C++, a redesign of the application interfaces will be needed if the capabilities of the new language are to be exploited to the full.
In a package like SLALIB it is difficult to know how far to go. Is it enough to provide the primitive operations, or should more complicated functions be packaged? Is it worth encroaching on specialist areas, where individual experts have all written their own software already? To what extent should CPU efficiency be an issue? How much support of different numerical precisions is required? And so on.
In practice, almost all the routines in SLALIB are there because they were needed for some specific application, and this is likely to remain the pattern for any enhancements in the future. Suggestions for additional SLALIB routines should be addressed to the author.
SLALIB is descended from a package of routines written for the AAO 16-bit minicomputers in the mid-1970s. The coming of the VAX allowed a much more comprehensive and thorough package to be designed for Starlink, especially important at a time when the adoption of the IAU 1976 resolutions meant that astronomers would have to cope with a mixture of reference frames, time scales and nomenclature.
Much of the preparatory work on SLALIB was done by Althea Wilkinson of Manchester University. During its development, Andrew Murray, Catherine Hohenkerk, Andrew Sinclair, Bernard Yallop and Brian Emerson of Her Majesty’s Nautical Almanac Office were consulted on many occasions; their advice was indispensable. I am especially grateful to Catherine Hohenkerk for supplying preprints of papers, and test data. A number of enhancements to SLALIB were at the suggestion of Russell Owen, University of Washington, the late Phil Hill, St Andrews University, Bill Vacca, JILA, Boulder and Ron Maddalena, NRAO. Mark Calabretta, CSIRO Radiophysics, Sydney supplied changes to suit Convex. I am indebted to Derek Jones (RGO) for introducing me to the “universal variables” method of calculating orbits.
The first C version of SLALIB was a hand-coded transcription of the Starlink Fortran version carried out by Steve Eaton (University of Leeds) in the course of MSc work. This was later enhanced by John Straede (AAO) and Martin Shepherd (Caltech). The current C SLALIB is a complete rewrite by the present author and includes a comprehensive validation suite. Additional comments on the C version came from Bob Payne (NRAO) and Jeremy Bailey (AAO).
1The name isn’t an acronym; it just stands for “Subprogram Library A”.