next up previous 264
Next: Reading Native Objects From a FitsChan
Up: Storing AST Objects in FITS Headers (FitsChans)
Previous: Adding Individual Cards to a FitsChan


Adding Concatenated Cards to a FitsChan

If you have all your cards concatenated together into a single long string, each occupying 80 characters (with no delimiters), you can insert them into a FitsChan in a single call using astPutCards. This call first empties the supplied FitsChan of any existing cards, then inserts the new cards, and finally rewinds the FitsChan so that a subsequent call to astRead will start reading from the first supplied card. The astPutCards function uses astPutFits internally to interpret and store each individual card, and so the caveats in [*] should be read.

For instance, if you are using the CFITSIO library for access to FITS files, you can use the CFITSIO fits_hdr2str function to obtain a string suitable for passing to astPutCards:

if( !fits_hdr2str( fptr, 0, NULL, 0, &header, &nkeys, &status ) )
   fitschan = astFitsChan( NULL, NULL, "" );
   astPutCards( fitschan, header );
   header = free( header );
   wcsinfo = astRead( fitschan );

   ...
}



next up previous 264
Next: Reading Native Objects From a FitsChan
Up: Storing AST Objects in FITS Headers (FitsChans)
Previous: Adding Individual Cards to 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