IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 12, 2015, 9:26:15 PM (11 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20150419/Ohana/src/opihi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150419/Ohana/src/opihi

  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data

  • branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/rd.c

    r38062 r38443  
    99  Buffer *buf;
    1010
     11  int VERBOSE = FALSE;
     12  if ((N = get_argument (argc, argv, "-v"))) {
     13    remove_argument (N, &argc, argv);
     14    VERBOSE = TRUE;
     15  }
     16
    1117  int JustHead = FALSE;
    1218  if ((N = get_argument (argc, argv, "-head"))) {
    1319    remove_argument (N, &argc, argv);
    1420    JustHead = TRUE;
     21  }
     22
     23  int SwapRaw = FALSE;
     24  if ((N = get_argument (argc, argv, "-swap-raw"))) {
     25    remove_argument (N, &argc, argv);
     26    SwapRaw = TRUE;
    1527  }
    1628
     
    8597      return (FALSE);
    8698    }
    87     if (gfits_extension_is_compressed (&buf[0].header)) {
     99    if (gfits_extension_is_compressed_image (&buf[0].header)) {
    88100        IsCompressed = TRUE;
    89101    }
     
    118130      Nword = 1;
    119131      IsCompressed = FALSE;
    120       if (gfits_extension_is_compressed (&buf[0].header)) {
     132      if (gfits_extension_is_compressed_image (&buf[0].header)) {
    121133        if (!strcmp (CCDKeyword, "EXTNAME")) Nword = 1;
    122134        IsCompressed = TRUE;
     
    170182  if (plane >= 0) {
    171183    // we are requesting a specific plane (-1 : all data)
    172     int tooFar = Nz ? (plane >= Nz) : (plane > Nz);
     184    int tooFar = (Nz > 0) ? (plane >= Nz) : (plane > 0);
    173185    if (tooFar) {
    174186      gprint (GP_ERR, "-plane is too large: %d total planes\n", Nz);
     
    192204    ftable.header[0].buffer = NULL;
    193205    gfits_copy_header (&buf[0].header, ftable.header);
    194     status = gfits_fread_ftable_data (f, &ftable, FALSE);  // this just reads the bytes (not even a SWAP)
    195     status = gfits_uncompress_image (&buf[0].header, &buf[0].matrix, &ftable);
     206
     207    if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { gprint (GP_ERR, "problem reading compressed image table data\n"); fclose (f); return FALSE; }
     208    if (!gfits_byteswap_varlength_column (&ftable, 1)) { gprint (GP_ERR, "problem doing byteswap on compressed image metadata column\n"); fclose (f); gfits_free_table (&ftable); return FALSE; }
     209    if (!gfits_uncompress_image (&buf[0].header, &buf[0].matrix, &ftable)) { gprint (GP_ERR, "problem uncompressing the image data\n"); fclose (f); gfits_free_table (&ftable); return FALSE; }
     210
    196211    // uncompressing the image leaves the format as an extension
    197212    gfits_extended_to_primary (&buf[0].header, TRUE, "Standard FITS");
    198213    gfits_free_table (&ftable);
     214
     215    status = TRUE;
    199216    // XXX this currently does not work for a cube (we get a cube back, not a specific plane)
    200217  } else {
     
    233250  buf[0].unsign = buf[0].header.unsign;
    234251
    235   gprint (GP_LOG, "read "OFF_T_FMT" bytes from %s into buffer %s\n",
    236            buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]);
     252  if (VERBOSE) gprint (GP_LOG, "read "OFF_T_FMT" bytes from %s into buffer %s\n", buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]);
    237253
    238254  blank = 0xffff;
    239255  gfits_scan (&buf[0].header, "BLANK", "%d", 1, &blank);
    240256
     257  if (SwapRaw) {
     258    gfits_swap_raw (&buf[0].matrix);
     259  }
     260
    241261  /** now - convert the matrix values to floats for internal use **/
    242262  gfits_convert_format (&buf[0].header, &buf[0].matrix, -32, 1.0, 0.0, blank, gfits_get_unsign_mode());
Note: See TracChangeset for help on using the changeset viewer.