Even when coordinates can, in principle, be transformed in either direction by a Mapping, there may still be instances where specific coordinate values cannot be handled. For example, the Mapping may be mathematically intractable (e.g. singular) in certain places, or it may map a subset of one space on to another, so that some points in one space are not represented in the other. Sky projections often show this behaviour, since it is quite common to project only half of the celestial sphere on to two dimensions, omitting points on the opposite side of the sky. There are many other examples.
To indicate when coordinates cannot be transformed, for whatever reason, AST substitutes a special output coordinate value given by the macro AST__BAD (as defined in the ``ast.h'' header file). Before making use of coordinates generated by any of the AST transformation functions, therefore, you may need to check for the presence of this value.
Because coordinates with the value AST__BAD can be generated in this way, all other AST functions are also capable of recognising this value and handling it appropriately. The coordinate transformation functions do this by propagating any missing input coordinate information through to their output. This means that if you supply coordinates with the value AST__BAD, the returned coordinates are also likely to contain this value. Here, for example, is what happens if you use a ZoomMap (with Zoom factor 5) to transform such a set of coordinates:
(0, 0) --> (0, 0) (<bad>, 2) --> (<bad>, 10) (2, 4) --> (10, 20) (3, 6) --> (15, 30) (4, <bad>) --> (20, <bad>) (5, 10) --> (25, 50) (<bad>, <bad>) --> (<bad>, <bad>) (7, 14) --> (35, 70) (8, 16) --> (40, 80) (9, 18) --> (45, 90)
The AST__BAD value is represented by the string ``bad''. This is a case of ``garbage in, garbage out'' but at least it's consistent garbage that you can recognise!
Note how the presence of the AST__BAD value in one input dimension
does not necessarily result in the loss of information for all output
dimensions. Sometimes, such loss will be unavoidable, but in general
an attempt is made to preserve information as far as possible. The
exact behaviour will depend on the Mapping involved.
AST A Library for Handling World Coordinate Systems in Astronomy