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_set_column.c

    r38325 r38329  
    1818int gfits_set_bintable_column (Header *header, FTable *table, char *label, void *data, off_t Nrow) {
    1919
    20   off_t Nx, Ny, nbytes;
     20  off_t Nx, Ny;
    2121  int i, N, Nfields;
    2222  int Nval, Nbytes, Nstart, Nv, Nb;
     
    5555  gfits_scan (header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
    5656  gfits_scan (header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
     57
     58  // if no rows have yet been assigned, we need to allocate the full data buffer
    5759  if (Ny == 0) {
    5860    Ny = Nrow;
    59     header[0].Naxis[1] = Ny;
    60     gfits_modify (header, "NAXIS2", OFF_T_FMT, 1,  Ny);
    61 
    62     nbytes = gfits_data_size (header);
    63     REALLOCATE (table[0].buffer, char, MAX (nbytes, 1));
    64     bzero (table[0].buffer, nbytes);
    65     table[0].datasize = nbytes;
     61    gfits_set_table_rows (header, table, Ny);
    6662  }
    6763  if (Ny != Nrow) return (FALSE);
     
    181177int gfits_set_bintable_column_reformat (Header *header, FTable *table, char *label, char *intype, void *data, off_t Nrow) {
    182178
    183   off_t Nx, Ny, nbytes;
     179  off_t Nx, Ny;
    184180  int i, N, Nfields;
    185181  int Nval, NbytesOut, Nstart, Nv, Nb;
     
    220216  if (Ny == 0) {
    221217    Ny = Nrow;
    222     header[0].Naxis[1] = Ny;
    223     gfits_modify (header, "NAXIS2", OFF_T_FMT, 1,  Ny);
    224 
    225     nbytes = gfits_data_size (header);
    226     REALLOCATE (table[0].buffer, char, MAX (nbytes, 1));
    227     bzero (table[0].buffer, nbytes);
    228     table[0].datasize = nbytes;
     218    gfits_set_table_rows (header, table, Ny);
    229219  }
    230220  if (Ny != Nrow) return (FALSE);
     
    701691int gfits_set_table_column (Header *header, FTable *table, char *label, void *data, off_t Nrow) {
    702692
    703   off_t Nx, Ny, nbytes;
     693  off_t Nx, Ny;
    704694  int i, N, Nfields, Nval, Nbytes, Nstart, Nv, Nb;
    705695  char tlabel[80], field[80], format[80], cformat[80], type[16], tmp[16];
     
    731721  if (Ny == 0) {
    732722    Ny = Nrow;
    733     header[0].Naxis[1] = Ny;
    734     gfits_modify (header, "NAXIS2", OFF_T_FMT, 1,  Ny);
    735 
    736     nbytes = gfits_data_size (header);
    737     REALLOCATE (table[0].buffer, char, MAX (nbytes, 1));
    738     bzero (table[0].buffer, nbytes);
    739     table[0].datasize = nbytes;
     723    gfits_set_table_rows (header, table, Ny);
    740724  }
    741725  if (Ny != Nrow) return (FALSE);
Note: See TracChangeset for help on using the changeset viewer.