Next: A System for Low-Cost Access to Very Large Catalogs
Up: Sky Surveys
Previous: The Uccle Direct Astronomical Plate Archive Centre UDAPAC--A New International Facility for Inherited Observations
Table of Contents - Subject Index - Author Index - Search - PS reprint - PDF reprint

Berry, D. S. 2001, in ASP Conf. Ser., Vol. 238, Astronomical Data Analysis Software and Systems X, eds. F. R. Harnden, Jr., F. A. Primini, & H. E. Payne (San Francisco: ASP), 129

Providing Improved WCS Facilities Through the Starlink AST and NDF Libraries

D. S. Berry
Centre for Astrophysics, University of Central Lancashire, Preston, Lancs, UK, PR1 2HE, Email:


The AST library provides a comprehensive range of facilities for creating and using world coordinate systems that describe astronomical data. This paper gives a brief over-view of these facilities and a description of the integration of these facilities with the Starlink ``Extensible N-Dimensional Data Format'' (NDF), which stores bulk data in the form of N-dimensional arrays of numbers. Most of the major Starlink applications have been updated to take advantage of the facilities provided by this integration of AST and NDF.

1. NDF--The Data Format

NDF is a data format for storing arrays of numbers with associated ancillary information. It is the native data format used by Starlink packages, and is based on the Hierarchical Data System (HDS), which allows data to be stored in the form of arbitrary structures of arrays and scalars, using character, integer, logical or floating point primitives.

The following components are recognized within an NDF structure:

DATA - An N-dimensional array of pixel values representing the spectrum, image, etc. stored in the NDF. This is the only mandatory component; all the others are optional.
TITLE - A character string for general use as a heading for such things as graphical output; e.g., ``M51 in good seeing''.
LABEL - A character string to be used on the axis of graphs to describe the quantity in the NDF's DATA component; e.g., ``Surface brightness''.
UNITS - A character string describing the physical units of the quantity in the NDF's DATA component.
QUALITY - An array of the same size and shape as the DATA array holding a set of unsigned bytes. These are used to assign additional ``quality'' attributes to each pixel (for instance, whether it is saturated, or part of an active area of a detector).
VARIANCE - An array of the same size and shape as the DATA array representing the measurement errors or uncertainties associated with each individual DATA value. If present, these are always interpreted as variance estimates.
AXIS - An array of 1-dimensional look-up tables, one for each pixel axis, used to transform pixel coordinates into an arbitrary user-defined rectangular coordinate system.
HISTORY - A structure used to keep a record of the processing history which the NDF undergoes.
MORE - A structure in which applications may store a collection of arbitrary HDS objects (which may include other NDFs). The interpretation of these objects is left up to the software which creates them.
WCS - A new component which provides facilities for storing an AST FrameSet. This holds a description of an arbitrary collection of coordinates frames, together with (potentially non-linear) mappings for converting between each of the frames, and the pixel coordinate frame.

2. NDF--The Data Access Library

Starlink distributes a library of routines which provide access to all the components of an NDF structure. The library is documented fully in Starlink User Note 33, available from the Starlink librarian,, or from the Starlink WWW site It includes facilities for doing on-the-fly data conversion so that a wide range of non-NDF data formats can be read and written transparently by NDF-based software. The library is written mainly in FORTRAN, but additional C and Perl interfaces are available. Since NDF is based on HDS, it transparently converts NDFs written on machines which have a different byte-ordering from that on which the data are read.

Figure 1: An AST FrameSet is a network of coordinate Frames with interconnecting Mappings. One Frame is nominated as the ``Base'' Frame (typically the pixel coordinate Frame), and another as the ``Current Frame'' (an R. A./Dec. Frame for instance).

3. AST--A Library for Handling World Coordinate Systems in Astronomy

The AST library provides a comprehensive range of facilities for attaching world coordinate systems to astronomical data, for retrieving and interpreting that information and for generating graphical output such as coordinate grids based upon it. Documentation is available in Starlink User Note 210 (FORTRAN) and 211 (C), available from the Starlink librarian or from the Starlink WWW site. One of the design goals of the AST library was to make it ``stand-alone''--it does not depend on any other Starlink libraries (with the exception of the SLALIB positional astronomy library). Although it is object-based, it has procedural interfaces for both C and FORTRAN.

One of the most important AST objects is the FrameSet, which represents an arbitrary collection of coordinate Frames, with associated Mappings describing how to convert positions from one Frame to another (see Figure 1). An AST Frame represents a coordinate system and can be:

An AST Mapping is a recipe for transforming position between Frames. Sub-classes of Mapping are available which provide basic linear transformations, a wide range of spherical projections, generalised algebraic expressions, and user-defined transformations. Mappings may be combined together to produce compound Mappings (see Figure 2).

Graphical facilities within AST include production of entire annotated coordinate grids from an arbitrary Mapping (any discontinuities and singularities in the Mapping are handled transparently). Any graphics package capable of drawing straight lines and text can be used with AST. A simple interface module needs to be written for each new graphics package. AST comes with a pre-written interface for PGPLOT.

Objects can be saved and retrieved as a set of ``keyword=value'' strings from any external data system capable of storing lines of text, but special support is provided for storing AST objects in the form of FITS header cards. FrameSets can be stored and retrieved using several different popular encodings of WCS information within FITS headers, including the standard proposed by Calabretta & Greisen.

Figure 2: AST Mappings can be combined together to form compound Mappings. These compound Mappings can be simplified to remove unnecessary processing. The above Mapping for instance would be simplified into a 3 axis UnitMap.

4. Putting it all Together: NDF + AST = WCS

The current version of the NDF access library has been modified to include a new standard item, the ``WCS'' component, which attaches an arbitrary collection of world coordinate systems to the data.

Each NDF now has a ``current coordinate Frame'' which can be Pixel coordinates, ``Axis'' coordinates (defined by the AXIS component of the NDF), or any other coordinate Frame which has been imported into the WCS component (e.g., R. A./Dec., focal plane position, offset from the field centre, etc.). Data reduction commands report positions in the current Frame of the NDF being processed, and expect the user to supply positions in the same Frame. User commands exist to change the current Frame in any NDF.

Most of the main Starlink packages (GAIA, KAPPA, CCDPACK, POLPACK, ESP, CONVERT, etc.) have been modified to take advantage of the facilities provided by AST and the WCS component. These include:

Through these packages, the Starlink Software Collection now provides a powerful, uniform interface for importing, modifying, exporting and displaying world coordinate information.


This project was funded by the Starlink Project,$^,$1 Rutherford Appleton Laboratory, Didcot, Oxfordshire, UK, OX11 0QX.



© Copyright 2001 Astronomical Society of the Pacific, 390 Ashton Avenue, San Francisco, California 94112, USA
Next: A System for Low-Cost Access to Very Large Catalogs
Up: Sky Surveys
Previous: The Uccle Direct Astronomical Plate Archive Centre UDAPAC--A New International Facility for Inherited Observations
Table of Contents - Subject Index - Author Index - Search - PS reprint - PDF reprint