IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18208 for trunk/psLib


Ignore:
Timestamp:
Jun 19, 2008, 4:50:01 PM (18 years ago)
Author:
eugene
Message:

allow case where bscale/bzero cannot be determined

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFitsImage.c

    r18156 r18208  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2008-06-17 02:46:05 $
     9 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2008-06-20 02:50:01 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    534534    }
    535535
     536    bool useRequestedScale = true;
    536537    if (!isfinite(bscale) || !isfinite(bzero)) {
    537538        // Couldn't scale, so don't compress.  Save compression parameters for later
     539        useRequestedScale = false;
    538540        compress = psFitsCompressionGet(fits);
    539541        if (!psFitsSetCompression(fits, PS_FITS_COMPRESS_NONE, NULL, 0, 0, 0)) {
     
    556558        bzero = cfitsioBzero;
    557559    }
     560
    558561    psFitsOptions *options = fits->options; // FITS I/O options
    559     psAssert(!options || bitPix == options->bitpix || options->bitpix == 0, "impossible");
     562    psAssert(!useRequestedScale || !options || bitPix == options->bitpix || options->bitpix == 0, "impossible");
    560563
    561564    int naxis = 3;                      // Number of axes
     
    603606    fits_set_bscale(fits->fd, 1.0, cfitsioBzero, &status);
    604607
    605     if (bscale != 0.0) {
     608    if (isfinite(bzero) && isfinite(bscale) && (bscale != 0.0)) {
    606609        fits_write_key_dbl(fits->fd, "BZERO", bzero, 12,
    607610                           "Scaling: TRUE = BZERO + BSCALE * DISK", &status);
     
    693696    }
    694697
     698    bool useRequestedScale = true;
    695699    if (!isfinite(bscale) || !isfinite(bzero)) {
    696700        // Couldn't scale, so don't compress.  Save compression parameters for later
     701        useRequestedScale = false;
    697702        compress = psFitsCompressionGet(fits);
    698703        if (!psFitsSetCompression(fits, PS_FITS_COMPRESS_NONE, NULL, 0, 0, 0)) {
     
    716721    }
    717722    psFitsOptions *options = fits->options; // FITS I/O options
    718     psAssert(!options || bitPix == options->bitpix || options->bitpix == 0, "impossible");
     723    psAssert(!useRequestedScale || !options || bitPix == options->bitpix || options->bitpix == 0, "impossible");
    719724
    720725    // Check to see if the HDU has the same datatype
Note: See TracChangeset for help on using the changeset viewer.