Changeset 7227 for trunk/psLib/src/fits/psFitsHeader.c
- Timestamp:
- May 25, 2006, 5:24:49 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/fits/psFitsHeader.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/fits/psFitsHeader.c
r7226 r7227 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-05-26 0 2:48:47$9 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-05-26 03:24:49 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 218 218 } 219 219 220 bool psFitsWriteHeader(psMetadata* output, 221 psFits* fits) 222 { 223 220 221 // Do the work of writing out the header. 222 // Doesn't check to see if a new HDU needs to be created 223 bool p_psFitsWriteHeader(psMetadata *output, // Metadata that is to be output into the FITS file 224 psFits *fits // The FITS file handle 225 ) 226 { 224 227 if (!fits) { 225 228 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psFits_NULL); … … 230 233 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psFits_METADATA_NULL); 231 234 return false; 232 }233 234 int status = 0; // Status of cfitsio calls235 236 // Check to see if there are any extant HDUs237 int hdus = psFitsGetSize(fits); // Number of HDUs238 if (hdus == 0) {239 // Need to create a dummy image HDU for the primary HDU240 fits_create_img(fits->fd, 16, 0, NULL, &status);241 if (status) {242 char fitsErr[MAX_STRING_LENGTH];243 (void)fits_get_errstatus(status, fitsErr);244 psError(PS_ERR_IO, true, "Unable to create primary header.\n%s\n", fitsErr);245 return false;246 }247 235 } 248 236 … … 250 238 psListIterator* iter = psListIteratorAlloc(output->list, PS_LIST_HEAD, true); // Iterator 251 239 psMetadataItem* item; // Item from iteration 240 int status = 0; // Status of cfitsio calls 252 241 while ((item = psListGetAndIncrement(iter))) { 253 242 // Check to see if the item should be ignored … … 325 314 } 326 315 316 bool psFitsWriteHeader(psMetadata* output, 317 psFits* fits) 318 { 319 if (!fits) { 320 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psFits_NULL); 321 return false; 322 } 323 324 if (!output) { 325 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psFits_METADATA_NULL); 326 return false; 327 } 328 329 // Check to see if there are any extant HDUs 330 int hdus = psFitsGetSize(fits); // Number of HDUs 331 if (hdus == 0) { 332 // Need to create a dummy image HDU for the primary HDU 333 int status = 0; // Status of cfitsio 334 fits_create_img(fits->fd, 16, 0, NULL, &status); 335 if (status) { 336 char fitsErr[MAX_STRING_LENGTH]; 337 (void)fits_get_errstatus(status, fitsErr); 338 psError(PS_ERR_IO, true, "Unable to create primary header.\n%s\n", fitsErr); 339 return false; 340 } 341 } 342 343 return p_psFitsWriteHeader(output, fits); 344 } 345 327 346 bool psFitsHeaderValidate(psMetadata *header) 328 347 {
Note:
See TracChangeset
for help on using the changeset viewer.
