- Timestamp:
- Jun 12, 2015, 9:26:15 PM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150419/Ohana/src/opihi
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150419/Ohana/src/opihi
-
Property svn:mergeinfo
set to
/branches/eam_branches/ipp-20150112/Ohana/src/opihi merged eligible /branches/eam_branches/ipp-20150405/Ohana/src/opihi merged eligible /trunk/Ohana/src/opihi merged eligible
-
Property svn:mergeinfo
set to
-
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/rd.c
r38062 r38443 9 9 Buffer *buf; 10 10 11 int VERBOSE = FALSE; 12 if ((N = get_argument (argc, argv, "-v"))) { 13 remove_argument (N, &argc, argv); 14 VERBOSE = TRUE; 15 } 16 11 17 int JustHead = FALSE; 12 18 if ((N = get_argument (argc, argv, "-head"))) { 13 19 remove_argument (N, &argc, argv); 14 20 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; 15 27 } 16 28 … … 85 97 return (FALSE); 86 98 } 87 if (gfits_extension_is_compressed (&buf[0].header)) {99 if (gfits_extension_is_compressed_image (&buf[0].header)) { 88 100 IsCompressed = TRUE; 89 101 } … … 118 130 Nword = 1; 119 131 IsCompressed = FALSE; 120 if (gfits_extension_is_compressed (&buf[0].header)) {132 if (gfits_extension_is_compressed_image (&buf[0].header)) { 121 133 if (!strcmp (CCDKeyword, "EXTNAME")) Nword = 1; 122 134 IsCompressed = TRUE; … … 170 182 if (plane >= 0) { 171 183 // 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); 173 185 if (tooFar) { 174 186 gprint (GP_ERR, "-plane is too large: %d total planes\n", Nz); … … 192 204 ftable.header[0].buffer = NULL; 193 205 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 196 211 // uncompressing the image leaves the format as an extension 197 212 gfits_extended_to_primary (&buf[0].header, TRUE, "Standard FITS"); 198 213 gfits_free_table (&ftable); 214 215 status = TRUE; 199 216 // XXX this currently does not work for a cube (we get a cube back, not a specific plane) 200 217 } else { … … 233 250 buf[0].unsign = buf[0].header.unsign; 234 251 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]); 237 253 238 254 blank = 0xffff; 239 255 gfits_scan (&buf[0].header, "BLANK", "%d", 1, &blank); 240 256 257 if (SwapRaw) { 258 gfits_swap_raw (&buf[0].matrix); 259 } 260 241 261 /** now - convert the matrix values to floats for internal use **/ 242 262 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.
