IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 28, 2015, 8:27:00 PM (11 years ago)
Author:
eugene
Message:

adding code for table compress/uncompress; image compress works (but is not quite compatible with cfitsio for some reason and byteswap is broken)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/libfits/table/F_read_T.c

    r37807 r38329  
    4545    if (Nread < gfits_data_min_size (table[0].header)) {
    4646      fprintf (stderr, "error: fits read error in %s, read "OFF_T_FMT", need "OFF_T_FMT"\n", __func__,  Nread,  gfits_data_min_size (table[0].header));
    47       if (padIfShort) {
    48         memset (&table[0].buffer[Nread], 0, Nbytes - Nread);
    49         fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n");
    50         table[0].validsize = Nread;
    51         table[0].datasize = Nbytes;
    52         return (TRUE);
    53       } else {
    54         gfits_free_table  (table);
     47      if (!padIfShort) {
     48        gfits_free_table (table);
    5549        return (FALSE);
    5650      }
    57     }
    58     fprintf (stderr, "warning: file missing pad\n");
     51      memset (&table[0].buffer[Nread], 0, Nbytes - Nread);
     52      fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n");
     53    } else {
     54      fprintf (stderr, "warning: file missing pad\n");
     55    }
    5956  }
    6057  table[0].validsize = Nread;
    6158  table[0].datasize = Nbytes;
     59  table[0].heap_start = gfits_heap_start (table->header);
    6260  return (TRUE);
    6361}       
     
    9391    }
    9492    fprintf (stderr, "error: fits read error in %s, read "OFF_T_FMT", need "OFF_T_FMT"\n", __func__,  Nread,  Nbytes);
    95     if (padIfShort) {
    96       memset (&table[0].buffer[Nread], 0, Nbytes - Nread);
    97       fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n");
    98       table[0].validsize = Nread;
    99       table[0].datasize = Nbytes;
    100     } else {
     93    if (!padIfShort) {
    10194      free (table[0].buffer);
    10295      return (FALSE);
    10396    }
     97    memset (&table[0].buffer[Nread], 0, Nbytes - Nread);
     98    fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n");
    10499  }
    105100
     
    107102  table[0].header[0].Naxis[1] = Nrows;
    108103  gfits_modify (table[0].header, "NAXIS2",  OFF_T_FMT, 1,  Nrows);
    109   table[0].datasize = gfits_data_size (table[0].header);
     104  table[0].validsize = Nread;
     105  table[0].datasize = Nbytes;
     106  table[0].heap_start = gfits_heap_start (table->header);
    110107
    111108  return (TRUE);
     
    122119  Ny = table[0].header[0].Naxis[1];
    123120  table[0].datasize = gfits_data_size (table[0].header);
     121  // table[0].heap_start = gfits_heap_start (table[0].header);
    124122  table[0].pad = table[0].datasize - Nx*Ny;
    125123
     
    206204    for (i = 0; i < Nrow; i++) table[0].row[i] = row[i];
    207205    table[0].datasize = gfits_data_size (table[0].header);
     206    // table[0].heap_start = gfits_heap_start (table[0].header);
    208207    table[0].pad      = table[0].datasize - Nx*Ny;
    209208    return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.