##
Formatting Celestial Coordinates

SkyFrames use astFormatastFormat for formatting coordinate values in the same way as other Frames (§7.6). However, they offer a different set of formatting options more appropriate to celestial coordinates.

The Digits attribute of a SkyFrameSkyFrame behaves in essentially the same way as for a basic FrameFrame (§7.6), so the precision with which celestial coordinates are displayed can also be adjusted in this way. However, the range of format specifiers that can be given for the Format(axis)Format(axis) attribute, and the default format resulting from any particular Digits value, is different.

The syntax of SkyFrame format specifiers is detailed under the description of the Format(axis) attribute in Appendix C. Briefly, however, it allows celestial coordinates to be expressed either as angles or times and to include one or more of the fields:

- degrees or hours
- arc-minutes or minutes
- arc-seconds or seconds

with a specified number of decimal places for the final field. A range of field separators is also available, as the following examples show:

> Format Specifier | Example Formatted Value
> --- | ---
> d | 219
> d.3 | 219.123
> dm | 219:05
> dm.2 | 219:05.44
> dms | 219:05:42
> hms.1 | 15:44:13.8
> bdms.2 | 219 05 42.81
> lhms.3 | 15h44m13.88s
> +zlhms | +06h10m44s
> ms.1 | 13145:42.8
> lmst.3 | 876m22.854s
> s.2 | 788742.81

Note the following key points:

- The required fields are specified using characters chosen from either “dms” or “hms” according to whether the value is to be formatted as an angle (in degrees) or a time (in hours).

- If no degrees or hours field is required, the distinction between angle and time may be made by including “t” to request time.

- The number of decimal places (for the final field) is indicated using “.” followed by an integer. An asterisk can be used in place of an integer, in which case the number of decimal places is chosen so that the total number of digits in the formatted value is equal to the value of the Digits attribute.

- “b” causes fields to be separated by blanks, while “l” causes them to be separated by the appropriate letters (the default being a colon).

- “z” causes padding with leading zeros.

- “+” cause a plus sign to be prefixed to positive values (negative values always have a minus sign).

The formatting performed by a SkyFrame is also influenced by the AsTime(axis)AsTime(axis) attribute, which has a boolean (integer) value for each SkyFrame axis. It determines whether the default format specifier for an axis will present values as angles (e.g. in degrees) if it is zero, or as times (e.g. in hours) if it is non-zero.

The default AsTime value depends on the celestial coordinate system which the SkyFrame represents which, in turn, depends on its SystemSystem attribute value. For example, equatorial longitude values (right ascension) are normally expressed in hours, whereas ecliptic longitudes are normally expressed in degrees, so their default AsTime values will reflect this difference.

The value of the AsTime attribute may be set explicitly to over-ride these defaults if required, with the formatting precision being determined by the Digits/Digits(axis)Digits/Digits(axis) value. Alternatively, the Format(axis) attribute may be set explicitly to specify both the format and precision required. Setting an explicit Format value always over-rides the effects of both the Digits and AsTime attributes (unless the Format value does not specify the required number of decimal places, in which case Digits is used to determine the default number of decimal places)