In the current proposal, we regard the conversion of pixel coordinates to world coordinates as a multi-step process. This is illustrated conceptually in Fig. 1, which shows only the steps to be discussed here. Later extensions may interpose additional steps as required. For example, Paper II divides the final step into two with the computation of intermediate spherical coordinates that are subsequently converted to celestial coordinates via a spherical rotation. Paper IV interposes optional distortion corrections between the first and/or second steps of Fig. 1. Generally these are intended to account for small residuals that cannot be described by one of the standard world coordinate transformations. These may arise in a variety of ways; naturally (e.g. aberration or atmospheric refraction), via complex instrumental response functions (e.g. data cubes produced by a Fabry-Perot interferometer for which surfaces of constant wavelength are curved), by the intrinsic nature of the system under study (e.g. surface coordinates of the asteroid Eros), or as a result of instrumental peculiarities.
For all coordinate types, the first step is a linear transformation
applied via matrix multiplication of the vector of pixel
coordinate elements, pj:
The mij matrix is a non-singular square matrix of dimension
.
In the first instance, N is given by the NAXIS
keyword value, but this will be generalized with the introduction of
the WCSAXES keyword in Sect. 2.2 so that the
dimension of the world coordinates need not match that of the data
array.
The elements, qi, of the resulting intermediate pixel
coordinate vector are offsets, in dimensionless pixel units, from the
reference point along axes coincident with those of the intermediate world coordinates. Thus the conversion of qi to the
corresponding intermediate world coordinate element, xi, is a
simple scale:
The third step in the process of computing world coordinates depends on the CTYPE i. For simple linear axes, the xi are interpreted as offsets to be added to the coordinate value at the reference point given by CRVAL i. Otherwise, the CTYPE i define a function of the xi, the CRVAL i, and, perhaps, other parameters that must be established by convention and agreement. Any CTYPE i not covered by convention and agreement shall be taken to be linear.
Non-linear coordinate systems will be signaled by CTYPE i in "4-3'' form: the first four characters specify the coordinate type, the fifth character is a '-', and the remaining three characters specify an algorithm code for computing the world coordinate value, for example 'ABCD-XYZ'. We explicitly allow the possibility that the coordinate type may augment the algorithm code, for example 'FREQ-F2W' and 'VRAD-F2W' may denote somewhat different algorithms (see Paper III). Coordinate types with names of less than four characters are padded on the right with '-', and algorithm codes with less than three characters are padded on the right with blanks, for example 'RA--UV '. However, we encourage the use of three-letter algorithm codes.
Particular coordinate types and algorithm codes must be established by convention. Paper II constructs the framework for celestial coordinate systems, and Paper III does so for spectral axes (frequency-wavelength-velocity). CTYPE i values that are not in "4-3'' form should be interpreted as linear axes. It is possible that there may be old FITS files with a linear axis for which CTYPE i is, by chance, in 4-3 form. However, it is very unlikely that it will match a recognized algorithm code (use of three-letter codes will reduce the chances). In such a case the axis should be treated as linear.
The proposal to replace the CROTA i keywords of Wells et al. (1981) with a general linear transformation matrix dates from Hanisch & Wells (1988), although the details of its implementation have undergone considerable evolution. The main point of divergence has been whether the matrix should completely replace or simply augment the CDELT i, but there are also important differences relating to the default values of the matrix elements.
In defining a nomenclature which augments the CDELT i we have been guided by the following considerations:
header cards, and si as CDELT i. The i and jindices are used without leading zeroes, e.g. PC1_1 and
CDELT1. The default values for
are 1.0 for i = j and
0.0 otherwise. The
matrix must not be singular; it must have an
inverse. Furthermore, all CDELT i must be non-zero. In other
words, invertibility means that transformations which project from an
initial coordinate system of dimensionality WCSAXES to a world
coordinate system of dimensionality less than WCSAXES are
forbidden.
In the
formalism Eqs. (1) and (2) are
combined as
and the
keywords encode the product
si mij. The i and jindices are used without leading zeroes, e.g. CD1_1. The
matrix must not be singular; it must have an inverse.
CDELT i and CROTA i are allowed to coexist with
as an
aid to old FITS interpreters, but are to be ignored by new readers.
The default behavior for
differs from that for
;
if one
or more
cards are present then all unspecified
default
to zero. If no
cards are present then the header is assumed to
be in
form whether or not any
cards are present since
this results in an interpretation of CDELT i consistent with Wells
et al. (1981).
We specifically prohibit mixing of the
and
nomenclatures
in any FITS header data unit. With this restriction, translation from
the
formalism to the
formalism is effected simply in the
keyword parsing stage of header interpretation; the CDi_j should be considered equivalent to the
subject
to the considerations for default values noted above and with
CDELT i set to unity. Similarly,
can be calculated from
and CDELT i following Eq. (3).
The proposal presented in this and the subsequent papers is not simple and provides wide latitude for mistakes in describing the WCS and in writing the FITS headers. The result of an improperly described WCS is simply undefined; it is the job of the FITS writer to produce a correct description. A simple error which could be made in a WCS description, or with other parts of a header, is a repetition of keywords with different values assigned to them. If, for example, BUNIT were repeated with a new value, the data would have unknown units but would be read correctly. In binary tables, a second value for TFORM n would cause the tabular data to be read incorrectly.
This is a very general proposal! The linear transformation matrix allows for skew and fully general rotations. The reader should note that this allows dissimilar axes to be rotated into one another. This is meaningful in imaging; for example, one may wish to re-sample a spectral-line cube from some special viewing angle in the three-space of two celestial coordinates and one frequency coordinate. Such rotations are, however, forbidden into axes whose coordinate values are, by convention, only integral. Thus, if CTYPE i0 indicates a world coordinate of integral type, then row i0 of the linear transformation matrix must contain only one non-zero element, and this would normally be 1.0 or at least integral. Additionally, it must be the only non-zero element in the column containing it. The STOKES axis is one such coordinate; see Sect. 5.4.
The linear transformation matrix could also be used to represent
images that have been transposed, e.g.
Equations (1) and (2) allow considerable
flexibility in the way the linear transformation is partitioned
between the
and CDELT i. In the absence of any formal
constraints, the normal expectation would be that the CDELT i be
used as scaling parameters as in the past. This is straightforward if
is orthogonal, i.e. defines a pure rotation or simple
reflection, but not if it has an element of skewness. In general, a
reasonable approach is to choose CDELT i so that
Note that integer pixel numbers refer to the center of the pixel
in each axis, so that, for example, the first pixel runs from pixel
number 0.5 to pixel number 1.5 on every axis. Note also that the
reference point location need not be integer nor need it even occur
within the image. The original FITS paper (Wells et al. 1981)
defined the pixel numbers to be counted from 1 to NAXIS j
(
1) on each axis in a Fortran-like order as presented in the
FITS image
.
A WCS representation should be invertible in the sense that a
pixel coordinate, when transformed to a world coordinate, must be
uniquely recoverable from that world coordinate. Note that this does
not require that each pixel coordinate in an image have a valid world
coordinate; as an example, pixel coordinates in the corner of a
Hammer-Aitoff projection of the full sky fall outside the map
boundary. Nor need each valid world coordinate correspond to a pixel
coordinate; for example, the divergent poles of the Mercator
projection are inaccessible. In practical terms, it means that two or
more different pixel coordinates should not map to the same world
coordinate, as exemplified by a cylindrical projection in which the
longitude spans more than
.
Such coordinate systems, while
easy to construct, may be very difficult to interpret properly in all
respects, including that of drawing a coordinate grid. Thus, while
they are not explicitly prohibited, it may be expected that general
WCS interpreting software may not handle them properly.
An additional convention is needed where non-linear axes must be grouped, for example, the two axes which form a map plane. In general, all axes in the group must have identical algorithm codes and a scheme must be established by convention for associating members of the group and, if necessary, their order. For example, Paper II introduces the 'xLON/xLAT' and 'yzLN/yzLT' conventions for associating longitude/latitude coordinate pairs. This should serve as a model for other cases. Note that grouping is not required for linear axes which are always separable (in the mathematical sense) by means of a rotation or skew applied via the linear transformation matrix.
Some non-linear algorithms require parameter values, for example, conic projections require the latitudes of the two standard parallels. Where necessary, numeric parameter values will be specified via
| PV i_m (floating-valued) |
keywords, where i is the intermediate world coordinate axis number and m is the parameter number. Leading zeros are not allowed and m may have only those values defined for the particular non-linear algorithm in the range 0 through 99 only. There may also be auxiliary keywords which are required to define, for example, the frames of reference used for celestial and velocity coordinates.
A few non-linear algorithms may also require character-valued parameters, for example, table lookups require the names of the table extension and the columns to be used. Where necessary, character-valued parameters will be specified via
| PS i_m (character-valued) |
keywords, where i is the intermediate world coordinate axis number and m is the parameter number. Leading zeros are not allowed and m may have only those values defined for the particular non-linear algorithm in the range 0 through 99 only.
The keywords proposed above and throughout the main body of this manuscript apply to the relatively simple images stored in the main FITS image data and in IMAGE extensions Ponz et al. 1994). When coordinates are used to describe image fragments in BINTABLE extension tables (Cotton et al. 1995), additional nomenclature conventions are required. These are described in Sect. 3.
The number of world coordinate elements associated with a datum can exceed the number of pixel coordinate elements which locate it in the image data array. For example, long-slit optical spectra are naturally two-dimensional; normally the slit is aligned with one (spatial) pixel axis and the dispersion coincides with the other (spectral) pixel axis. While the spectral representation is straightforward - one spectral pixel coordinate transforms to just one spectral world coordinate (frequency, wavelength or velocity) - the spatial representation would appear to be problematic. Since the slit can be oriented at any angle on the sky, the single pixel coordinate which locates a datum along the length of the slit must transform to two spatial (angular) coordinates, typically a right ascension and a declination, neither of which need be constant.
In fact, this problem was solved very early in the history of FITS. Wells et al. (1981) illustrate headers containing degenerate axes, i.e. axes having NAXIS j = 1, and this, combined with the meaning assigned to CROTA i by Greisen (1983), provides a fully functional solution. While not previously documented outside the AIPS project, this solution is well known and has been used extensively. Basically the idea is simply to increment the number of pixel coordinate elements as required by introducing degenerate axes.
For the long slit example, we set NAXIS = 3 and NAXIS
= 1. Supposing without loss of generality that CTYPE1 is
the spectral axis, we represent CTYPE2 as right ascension and
CTYPE3 as declination. CROTA i in the original formulation
is here replaced by
,
so that pixel coordinates along the length
of the slit,
(p2, p3=1), transform to intermediate world
coordinates (x,y). Thus the slit's locus in the xy-plane is a
straight line whose orientation can be controlled via the
matrix. Details of the transformation of (x,y) to celestial
spherical coordinates are properly the subject of Paper II. However,
given that the xy-plane is to be interpreted as the map plane of a
spherical projection, it should be clear that rotating the slit in the
xy-plane via the
matrix corresponds to rotating it on
the sky. Paper II discusses this long slit example in detail.
There is concern that requiring the use of degenerate pixel axes would have severe repercussions for a significant fraction of existing software programs which were not written to deal with such usage. For example, some software intended to handle two-dimensional images would reject a FITS header with NAXIS = 3, even if the third axis is degenerate. At the same time, degenerate axes are a widespread and natural representation for images in a multi-dimensional space. Furthermore, as shown in Fig. 1 of Wells et al. (1981), explicit specification of degenerate axes allows them to appear in any order. Such usage may facilitate image building and sub-imaging operations.
To provide a solution for this world-coordinate dimensionality problem that does not require the use of degenerate axes, we reserve the keyword
WCSAXES (integer-valued)
to specify the highest value of the index of any WCS keyword
in the header (i.e. CRPIX j,
or
,
CDELT i, CTYPE i,
CRVAL i, or CUNIT i). The default value is the larger of NAXIS and the largest index of these keywords found in the FITS
header. This keyword, if present, must precede all WCS keywords
(other than the NAXIS j). The use of this keyword also solves the
problem posed by alternate axis descriptions (Sect. 2.5)
which may have an intrinsically different coordinate dimensionality.
In the slit example, an alternate description of the x,y coordinates
on the detector has no use for a third axis. It is a good idea to
provide a coordinate description, even if it is only a "pixel'' axis,
for all array axes having more than one pixel.
There is debate within the community as to whether the official definition of FITS (Hanisch et al. 2001) prohibits the occurrence of WCS-related keywords with indices greater than the value of NAXIS. We make no claims one way or the other, but rather assert that in order to accommodate WCS specifications whose dimensionality exceeds NAXIS without the use of degenerate coordinate axes, such use must be allowed. Consistent with Hanisch et al. (2001), however, no NAXIS j keywords may exist for j > NAXIS. Thus, calculations related to determining the total length of the data array, which relies upon a product of the NAXIS j values, are unaffected. Accordingly, all axes with axis number greater than NAXIS must be one pixel in length implicitly rather than explicitly.
The original FITS paper (Wells et al. 1981) assumed that the units along each axis could be implied simply by the contents of the CTYPE i keyword. This has not turned out to be true in general. Therefore, we propose adding a new indexed, keyword
| CUNIT i (character-valued) |
with which the units of CRVAL i and CDELT i may be specified. Restrictions on the nature and range of units, if any, will be determined by the agreements applying to the specific axes. If they are not so limited, units should conform with the recommendations of the IAU Style Manual (McNally 1988). Particular conventions for CUNIT i values are discussed in Sect. 4. Case will be significant in the values assigned to CUNIT i since, for example, it is necessary to represent both milli and Mega prefixes for units such as mJy and MJy. The values assigned to CUNIT i cannot exceed 68 characters, but may well be longer than the 8 characters which has been a traditional - but optional - limit for character-valued but non-mandatory keywords.
The original FITS paper also assumed that the coordinate keywords, if present, would all be present and, therefore did not define defaults for the standard keywords. We therefore define the defaults to be
| WCSAXES | NAXIS or largest i or j |
| CRVAL i | 0.0 |
| CRPIX j | 0.0 |
| CDELT i | 1.0 |
| CTYPE i | ' ' (i.e. a linear undefined axis) |
| CUNIT i | ' ' (i.e. undefined) |
| PC i_j | 1.0 when i = j |
| PC i_j | 0.0 when |
| CD i_j | 0.0 but see Sect. 2.1.2. |
In some cases, an axis of an image may be described as having more
than one coordinate type. An example of this would be the frequency,
velocity, and wavelength along a spectral axis (only one of which, of
course, could be linear). One can also describe the position on a
CCD camera chip (or photographic plate) in meters as well as in
degrees on the sky. To allow up to 26 additional descriptions of each
axis, we propose the addition of the following optional, but now
reserved, keywords defined in Table 1,
where j and i are pixel and intermediate world
coordinate axis numbers, respectively, and a is a character A through Z specifying the coordinate version. The axis numbers
are restricted by this convention to the range 1-99 and the
coordinate parameter m is restricted to the range 0-99, both
with no leading zeros. Note that the primary version of the
coordinate description is that specified with a as the blank
character. If an alternate coordinate description is specified, all
coordinate keywords for that version must be given even if they do not
differ from those of the primary version. Rules for the default
values of alternate coordinate descriptions are the same as those for
the primary description. The alternate coordinate descriptions are
computed in the same fashion as the primary coordinates. The type of
coordinate depends on the value of CTYPE
and may be linear in
one of the alternate descriptions and non-linear in another.
| WCSAXES a | number of axes in WCS description |
| (integer) | |
| CRVAL
|
coordinate value at reference point |
| (real floating) | |
| CRPIX
|
pixel coordinate of the reference point |
| (real floating) | |
| PC i_
|
linear transformation matrix |
| (real floating) | |
| CDELT
|
coordinate increment |
| (real floating) | |
| CD i_
|
linear transformation matrix (with scale) |
| (real floating) | |
| CTYPE |
axis type |
| (8 characters) | |
| CUNIT
|
units of CRVAL
|
| (character) | |
| PV i_
|
coordinate parameter m |
| (real floating) | |
| PS i_
|
coordinate parameter m |
| (character) |
Alternate axis descriptions are optional, but may only be specified if a primary axis description is specified. The alternate version codes are selected by the FITS writer; there is no requirement that the codes be used in alphabetic sequence and no requirement that one coordinate version differ in its parameter values from another.
An optional keyword
is also defined to name, and otherwise document, the various versions of world coordinate descriptions. This keyword can be used to give the user simple names by which to request the various versions of the coordinates. It may also be used, for example, to distinguish coordinates used during data acquisition from those determined later by astrometrically rigorous reductions. It might also be used to specify which are data pixels and which are calibration pixels in a CCD image.
The coordinates of a pixel may not always be known exactly. Instead, they are often subject to both random, statistical errors and various systematic errors. The former are not particularly correlated between pixels, whereas the latter may have a high degree of correlation across the whole data set. For example, single-dish radio images may be accurate on a pixel-to-pixel basis to a fraction of an arcsec, but have a 5-10 arcsec uncertainty in the reference point value. Two optional keywords are hereby reserved to specify these uncertainties in coordinates. They are
| CRDER i a | random error in coordinate |
| (real floating) | |
| CSYER i a | systematic error in coordinate |
| (real floating) |
where both are given in units of CUNIT
and
have default value zero. They are understood to give a representative
average value of the error over the range of the coordinate in the
data file. The total error in the coordinate would be given by
summing the two errors in quadrature.
The errors in actual coordinates may be very much more complex than this simple representation. In the most general case, one might require, at each pixel, a covariance matrix to describe the dependence of the uncertainty in one coordinate on the uncertainties in the others. Furthermore, the errors in one coordinate description may, or may not, be completely predictable from those of an alternate description. Such usages, while perhaps important under some circumstances, are well beyond the needs of most users and the scope of this manuscript.
Copyright ESO 2002