next up previous 264
Next: Representing Offsets from a Specified Sky Position
Up: Celestial Coordinate Systems (SkyFrames)
Previous: Formatting Celestial Coordinates


Reading Formatted Celestial Coordinates

The process of converting formatted celestial coordinates, such as might be produced by the AST_FORMAT function ([*]), into numerical (double precision) coordinate values is performed by using AST_UNFORMAT ([*]) and passing it a pointer to a SkyFrame. The use of a SkyFrame means that the range of input formats accepted is appropriate to positions on the sky expressed as angles and/or times, while the returned value is in radians.

The following describes the forms of celestial coordinate which are supported:

This final convention is intended to ensure that values formatted by AST_FORMAT which contain less than three fields will be correctly interpreted if read back using AST_UNFORMAT, even if they do not contain field identification characters. However, it also affects other forms of input. For example, if the Format(axis) string were set to ``mst.1'' (producing two fields representing minutes and seconds of time), then formatted input would be interpreted by AST_UNFORMAT as follows:

12 13 - minutes and seconds
12 - minutes
:13 - seconds
$-$18: - minutes
12.8 - minutes
1 2 3 - hours, minutes and seconds
     
4' - arc-minutes
60::" - degrees
$-$23:" - arc-minutes
$-$33h - hours

(in the last four cases, explicit field identification has been given which overrides the implicit identification).

Alternatively, if the Format(axis) string were set to ``s.3'' (producing only an arc-seconds field), then formatted input would be interpreted by AST_UNFORMAT as follows:

12.8 - arc-seconds
12 13 - arc-minutes and arc-seconds
:12 - arc-seconds
13: - arc-minutes
1 2 3 - degrees, arc-minutes and arc-seconds

In general, if you are preparing formatted input data containing celestial coordinates and wish to omit certain fields, then you are advised to identify clearly those that you do provide by using the appropriate field identification characters and/or extra colon separators. This prevents you depending on the implicit field identification described above which, in turn, depends on an appropriate Format(axis) string having been set.

When writing software, it is also a good idea to set the Format(axis) string so that data input will be as simple as possible for the user. Unless some special effect is desired, this normally means that it should contain ``d'' or ``h'' to ensure that the first field entered by the user will be interpreted as degrees or hours, unless otherwise identified. This is the normal behaviour unless an explicit Format(axis) value has been set to override the default.


next up previous 264
Next: Representing Offsets from a Specified Sky Position
Up: Celestial Coordinate Systems (SkyFrames)
Previous: Formatting Celestial Coordinates

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 210
R.F. Warren-Smith & D.S. Berry
24th May 2011
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2009 Science \& Technology Facilities Council