IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38367


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

need to provide non-swapping options to handle compression

Location:
branches/eam_branches/ohana.20150429/src/opihi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/opihi/cmd.data/read_vectors.c

    r38341 r38367  
    522522
    523523    dump_cmp_table (&table, "rd cmp");
     524
     525    int Nfields;
     526    if (!gfits_scan (&header, "TFIELDS", "%d", 1, &Nfields)) ESCAPE ("cannot find TFIELDS in header");
     527    for (i = 0; i < Nfields; i++) {
     528      gfits_byteswap_varlength_column (&table, i+1);
     529    }
    524530    if (!gfits_uncompress_table (&table, &rawtable)) ESCAPE ("failed to uncompress table");
    525531    dump_raw_table (&rawtable, "rd raw");
     
    541547    if (Binary) {
    542548      if (!gfits_get_bintable_column_type (outheader, argv[i], type, &Nval)) ESCAPE ("requested field not found");
    543       if (!gfits_get_bintable_column (outheader, outtable, argv[i], &data)) ESCAPE ("error reading data from specified field");
     549      if (!gfits_get_bintable_column_raw (outheader, outtable, argv[i], &data, IsCompressed)) ESCAPE ("error reading data from specified field");
    544550    } else {
    545551      if (!gfits_get_table_column_type (outheader, argv[i], type)) ESCAPE ("requested field not found");
  • branches/eam_branches/ohana.20150429/src/opihi/lib.data/SplineOps.c

    r34584 r38367  
    178178  gfits_create_table (&theader, &ftable);
    179179
    180   gfits_set_bintable_column_reformat (&theader, &ftable, "X_KNOT", "double", myspline->xk, myspline->Nknots);
    181   gfits_set_bintable_column_reformat (&theader, &ftable, "Y_KNOT", "double", myspline->yk, myspline->Nknots);
    182   gfits_set_bintable_column_reformat (&theader, &ftable, "DY2_DX", "double", myspline->y2, myspline->Nknots);
     180  // NOTE: if we want to compress the output table, use native byte order here (last element)
     181  gfits_set_bintable_column_reformat (&theader, &ftable, "X_KNOT", "double", myspline->xk, myspline->Nknots, FALSE);
     182  gfits_set_bintable_column_reformat (&theader, &ftable, "Y_KNOT", "double", myspline->yk, myspline->Nknots, FALSE);
     183  gfits_set_bintable_column_reformat (&theader, &ftable, "DY2_DX", "double", myspline->y2, myspline->Nknots, FALSE);
    183184
    184185  if (!append) {
  • 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.