Changeset 17048 for trunk/psLib/src/fits/psFitsHeader.c
- Timestamp:
- Mar 18, 2008, 2:11:36 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/fits/psFitsHeader.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/fits/psFitsHeader.c
r16822 r17048 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.4 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2008-03- 05 02:19:28$9 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2008-03-19 00:11:36 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 18 18 19 19 #include <unistd.h> 20 #include <string.h> 21 #include <strings.h> 20 22 21 23 #include "psAssert.h" 22 24 #include "psFits.h" 23 #include "string.h"24 #include "strings.h"25 25 #include "psError.h" 26 26 … … 479 479 int status = 0; // Status of cfitsio calls 480 480 bool simple = true; // If SIMPLE is T, then the file should conform to the FITS standard 481 psFitsCompressionType compress = psFitsCompressionGetType(fits); // Compression type 481 482 if (psFitsGetExtNum(fits) == 0) { 482 483 // We allow the user to write SIMPLE, but it must be boolean … … 485 486 if (simpleItem->type != PS_DATA_BOOL) { 486 487 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "SIMPLE in a FITS header must be of boolean type: " 487 "not %x --- assuming TRUE.\n", simpleItem->type);488 "not %x --- assuming FALSE.\n", simpleItem->type); 488 489 int value = false; // Temporary holder for boolean 489 490 fits_update_key(fits->fd, TLOGICAL, "SIMPLE", &value, … … 492 493 } else if (!simpleItem->data.B) { 493 494 simple = false; 494 int value = false; // Temporary holder for boolean495 int value = false; // Temporary holder for boolean 495 496 fits_update_key(fits->fd, TLOGICAL, "SIMPLE", &value, 496 497 "File does not conform to FITS standard", &status); 497 498 } 498 // SIMPLE = T is taken care of by cfitsio. 499 } 499 // Uncompressed SIMPLE = T is taken care of by cfitsio. 500 } 501 } 502 if ((!fits->options || fits->options->conventions.compression) && compress != PS_FITS_COMPRESS_NONE) { 503 psMetadataItem *simpleItem = psMetadataLookup(output, "SIMPLE"); // SIMPLE in the header 504 if (simpleItem) { 505 if (simpleItem->type != PS_DATA_BOOL) { 506 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "SIMPLE in a FITS header must be of boolean type: " 507 "not %x --- assuming FALSE.\n", simpleItem->type); 508 simple = false; 509 } else { 510 simple = simpleItem->data.B; 511 } 512 } 513 // int value = simple; // Temporary holder for boolean 514 // fits_update_key(fits->fd, TLOGICAL, "ZSIMPLE", &value, 515 // "Uncompressed file's conformance to FITS standard", &status); 500 516 } 501 517 502 518 // Traverse the metadata list and add each key. 503 psFitsCompressionType compress = psFitsCompressionGetType(fits); // Compression type504 519 psListIterator* iter = psListIteratorAlloc(output->list, PS_LIST_HEAD, true); // Iterator 505 520 psMetadataItem* item; // Item from iteration … … 513 528 // changed) so we'll take care of that for them. 514 529 if (keywordInList(name, noWriteFitsKeys)) { 515 if ( (fits->options && !fits->options->conventions.compression)||516 compress == PS_FITS_COMPRESS_NONE) {530 if (strcmp(name, "SIMPLE") == 0 || compress == PS_FITS_COMPRESS_NONE || 531 (fits->options && !fits->options->conventions.compression)) { 517 532 // No compression happening, so don't write keyword 518 533 continue;
Note:
See TracChangeset
for help on using the changeset viewer.
