Function: COTRANS
Purpose: Transformation from grid coordinates to physical coordinates
and vice versa.
Category: PHYSICAL COORDINATES
File: cotrans.c
Author: K.G. Begeman
Use: INTEGER COTRANS ( SET , Input character
SUBSET , Input integer
COORD1 , Input double precision array
COORD2 , Output double precision array
DIR ) Input integer
COTRANS Returns:
0 transformation successful
1 unknown projection
2 unknown mode
3 CROTA2 = 90.0 for mode 1 and 2
4 CDELT1 and/or CDELT2 equal to zero
5 input sky system unknown
6 output sky system unknown
7 input and output sky system unknown
8 skypro error
9 unknown velocity system
10 rest frequency less than or equal to zero
11 crval equal to zero
12 cdelt equal to zero
13 no matching axis pair found
14 incompatible sky systems
15 cannot do epoch transformations
SET Name of data set.
SUBSET Subset coordinate word.
COORD1 Array containing grid coordinates or physical
coordinates in substructure defined by SUBSET.
The number of coordinates must be equal to the
dimension of SUBSET.
COORD2 Array containing the corresponding physical
coordinates or grid coordinates of the coordinates
specified in COORD1 and by SUBSET. The units of the
physical coordinates is converted to the units
as defined by CUNIT and DUNIT in the set header.
The number of coordinates returned in COORD2
can be obtained via NCOORDS (see NCOORDS.DC2).
This number can be larger than the number of
axes in the set because hidden axes coordinates
are also returned. The order or coordinates
returned in COORD2 is the axis order, so the
coordinate of the first axis is in COORD2(1),
the coordinate of the secoind axis is in COORD2(2)
etc.
DIR Direction of transformation:
DIR == 0: physical coordinates -> grid coordinates
DIR != 0: grid coordinates -> physical coordinates
Related Docs: ncoords.dc2
Updates: Dec 19, 1989: KGB, Document created.
Nov 22, 1991: KGB, Hidden axes implemented.
Apr 9, 1992: KGB, Returns also hidden coordinates.
May 18, 1992: KGB, Bug in looking for matching axes repaired.
Nov 4, 1996: KGB, Epoch can be in single precision.
Apr 09, 2009: VOG, Replaced NINT definition with one that
uses floor(). Several other routines
dealing with coordinates now use the
same definition. These updated routines can deal
properly with CRPIX values that end on 0.5
(tested for both negative and positive CRPIX).