2.2. Coordinate dimensionality
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. () illustrate headers containing degenerate axes, i.e. axes having NAXISj = 1, and this, combined with the meaning assigned to CROTAi by Greisen (), 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 NAXIS3 = 1. Supposing without loss of generality that CTYPE1 is the spectral axis, we represent CTYPE2 as right ascension and CTYPE3 as declination. CROTAi in the original formulation is here replaced by PCi_j, 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 PCi_j 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 PCi_j 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. (), 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
to specify the highest value of the index of any WCS keyword in the header (i.e. CRPIXj, PCi_j or CD i_j, CDELTi, CTYPEi, CRVALi, or CUNITi). 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 NAXISj). 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. ) 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. (), however, no NAXISj 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 NAXISj values, are unaffected. Accordingly, all axes with axis number greater than NAXIS must be one pixel in length implicitly rather than explicitly.