IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 4, 2015, 5:44:39 PM (11 years ago)
Author:
eugene
Message:

need to provide non-swapping options to handle compression

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/opihi/lib.shell/VectorIO.c

    r38341 r38367  
    22 
    33// write a set of vectors to a FITS FTable structure (vectors names become fits column names)
    4 static int WriteVectorTable (FTable *ftable, char *extname, Vector **vec, int Nvec, char *format) {
     4static int WriteVectorTable (FTable *ftable, char *extname, Vector **vec, int Nvec, char *format, char nativeOrder) {
    55 
    66  int j;
     
    5959  for (j = 0; j < Nvec; j++) {
    6060    if (vec[j][0].type == OPIHI_FLT) {
    61       gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "double", vec[j][0].elements.Flt, vec[j][0].Nelements);
     61      gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "double", vec[j][0].elements.Flt, vec[j][0].Nelements, nativeOrder);
    6262    } else {
    63       gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int", vec[j][0].elements.Int, vec[j][0].Nelements);
     63      gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int", vec[j][0].elements.Int, vec[j][0].Nelements, nativeOrder);
    6464    }
    6565  }
     
    130130
    131131  rawtable.header = &rawheader;
    132   if (!WriteVectorTable (&rawtable, extname, vec, Nvec, format)) goto escape;
     132  if (!WriteVectorTable (&rawtable, extname, vec, Nvec, format, (compress != NULL))) goto escape;
     133  // NOTE : for compression, the table is constructed in native by order
    133134
    134135  FTable *outtable = &rawtable;
     
    139140
    140141    dump_raw_table (&rawtable, "wd raw");
    141     if (!gfits_compress_table (&rawtable, &cmptable, 10, compress)) goto escape;
     142    if (!gfits_compress_table (&rawtable, &cmptable, 0, compress)) goto escape;
     143
     144    int i, Nfields;
     145    if (!gfits_scan (&cmpheader, "TFIELDS", "%d", 1, &Nfields)) goto escape;
     146    for (i = 0; i < Nfields; i++) {
     147      gfits_byteswap_varlength_column (&cmptable, i+1);
     148    }
    142149    dump_cmp_table (&cmptable, "wd cmp");
    143150
Note: See TracChangeset for help on using the changeset viewer.