next up previous 264
Next: Extracting Individual Cards from a FitsChan
Up: Storing AST Objects in FITS Headers (FitsChans)
Previous: Addressing Cards in a FitsChan


Writing Native Objects to a FitsChan

Having created an empty FitsChan ([*]), you can write any AST Object to it in the native encoding using the astWrite function. Let us assume we are writing a SkyFrame,23 as follows:

AstSkyFrame *skyframe;
int nobj;

...

nobj = astWrite( fitschan, skyframe );

Since we have selected the native encoding ([*]), there are no restrictions on the class of Object we may write, so astWrite should always return a value of one, unless an error occurs. Unlike a basic Channel ([*]), this write operation will not produce any output from our program. The FITS headers produced are simply stored inside the FitsChan.

After this write operation, the Ncard attribute will be updated to reflect the number of new cards added to the FitsChan and the Card attribute will point at the card immediately after the last one written. Since our FitsChan was initially empty, the Card attribute will, in this example, point at the end-of-file ([*]).

The FITS standard imposes a limit of 68 characters on the length of strings which may be stored in a single header card. Sometimes, a description of an AST Object involves the use of strings which exceed this limit (e.g. a Frame title can be of arbitrary length). If this occurs, the long string will be split over two or more header cards. Each ``continuation'' card will have the keyword CONTINUE in columns 1 to 8, and will contain a space in column 9 (instead of the usual equals sign). An ampersand (``&'') is appended to the end of each of the strings (except the last one) to indicate that the string is continued on the next card.

Note, this splitting of long strings over several cards only occurs when writing AST Objects to a FitsChan using the astWrite function and the native encoding. If a long string is stored in a FitsChan using (for instance) the astPutFits or astPutCards function, it will simply be truncated.



next up previous 264
Next: Extracting Individual Cards from a FitsChan
Up: Storing AST Objects in FITS Headers (FitsChans)
Previous: Addressing Cards in a FitsChan

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

Copyright (C) 2009 Science \& Technology Facilities Council