Changeset 38340 for branches/eam_branches/ohana.20150429/src/opihi/cmd.data
- Timestamp:
- May 30, 2015, 7:59:48 PM (11 years ago)
- Location:
- branches/eam_branches/ohana.20150429/src/opihi/cmd.data
- Files:
-
- 4 edited
-
rd.c (modified) (3 diffs)
-
read_vectors.c (modified) (8 diffs)
-
wd.c (modified) (1 diff)
-
write_vectors.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/opihi/cmd.data/rd.c
r38338 r38340 85 85 return (FALSE); 86 86 } 87 if (gfits_extension_is_compressed (&buf[0].header)) {87 if (gfits_extension_is_compressed_image (&buf[0].header)) { 88 88 IsCompressed = TRUE; 89 89 } … … 118 118 Nword = 1; 119 119 IsCompressed = FALSE; 120 if (gfits_extension_is_compressed (&buf[0].header)) {120 if (gfits_extension_is_compressed_image (&buf[0].header)) { 121 121 if (!strcmp (CCDKeyword, "EXTNAME")) Nword = 1; 122 122 IsCompressed = TRUE; … … 194 194 195 195 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { fprintf (stderr, "problem reading compressed image table data\n"); fclose (f); return FALSE; } 196 fprintf (stderr, "rd 1: ");197 for (i = 0; i < 32; i++) {198 fprintf (stderr, "0x%0hhx ", ftable.buffer[i]);199 }200 fprintf (stderr, "\n");201 202 196 if (!gfits_byteswap_varlength_column (&ftable, 1)) { fprintf (stderr, "problem doing byteswap on compressed image metadata column\n"); fclose (f); gfits_free_table (&ftable); return FALSE; } 203 fprintf (stderr, "rd 2: ");204 for (i = 0; i < 32; i++) {205 fprintf (stderr, "0x%0hhx ", ftable.buffer[i]);206 }207 fprintf (stderr, "\n");208 209 197 if (!gfits_uncompress_image (&buf[0].header, &buf[0].matrix, &ftable)) { fprintf (stderr, "problem uncompressing the image data\n"); fclose (f); gfits_free_table (&ftable); return FALSE; } 210 198 -
branches/eam_branches/ohana.20150429/src/opihi/cmd.data/read_vectors.c
r38062 r38340 412 412 table.header = &header; 413 413 414 int IsCompressed = FALSE; 415 414 416 /* load appropriate extension (if extname is a number, use count) */ 415 417 if (Nextend > -1) { … … 430 432 if (!gfits_load_header (f, &header)) ESCAPE ("error reading header for extension %d\n", Nextend); 431 433 432 if (getSizes) { 434 IsCompressed = gfits_extension_is_compressed_table (&header); 435 436 if (getSizes && !IsCompressed) { 433 437 read_table_sizes (&header); 434 438 if (CCDKeyword != NULL) free (CCDKeyword); 435 439 gfits_free_header (&header); 436 440 return TRUE; 441 } 442 if (IsCompressed) { 443 if (getSizes) { 444 gprint (GP_ERR, "%s[%s] is compressed: -sizes is invalid\n", filename, extname); 445 gfits_free_header (&header); 446 return FALSE; 447 } 448 if ((start > 0) || (Nrows > -1)) { 449 gprint (GP_ERR, "%s[%s] is compressed: must read entire table\n", filename, extname); 450 gfits_free_header (&header); 451 return FALSE; 452 } 437 453 } 438 454 … … 483 499 } 484 500 485 if (getSizes) { 501 IsCompressed = gfits_extension_is_compressed_table (&header); 502 503 if (getSizes && !IsCompressed) { 486 504 read_table_sizes (&header); 487 505 if (CCDKeyword != NULL) free (CCDKeyword); … … 489 507 return TRUE; 490 508 } 509 if (IsCompressed) { 510 if (getSizes) { 511 gprint (GP_ERR, "%s[%s] is compressed: -sizes is invalid\n", filename, extname); 512 gfits_free_header (&header); 513 return FALSE; 514 } 515 if ((start > 0) || (Nrows > -1)) { 516 gprint (GP_ERR, "%s[%s] is compressed: must read entire table\n", filename, extname); 517 gfits_free_header (&header); 518 return FALSE; 519 } 520 } 491 521 492 522 if (Nrows == -1) { … … 503 533 504 534 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend); 505 506 // if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension\n");507 508 535 break; 509 536 } … … 518 545 Binary = !strcmp (type, "BINTABLE"); 519 546 Ny = header.Naxis[1]; 547 548 Header *outheader = &header; 549 FTable *outtable = &table; 550 551 Header rawheader; 552 FTable rawtable; 553 if (IsCompressed) { 554 rawtable.header = &rawheader; 555 if (!gfits_uncompress_table (&table, &rawtable)) ESCAPE ("failed to uncompress table"); 556 outheader = &rawheader; 557 outtable = &rawtable; 558 gfits_free_header (&header); 559 gfits_free_table (&table); 560 Ny = rawheader.Naxis[1]; 561 } 520 562 521 563 /* find columns which match requested vectors */ … … 527 569 Nval = 0; 528 570 if (Binary) { 529 if (!gfits_get_bintable_column_type ( &header, argv[i], type, &Nval)) ESCAPE ("requested field not found");530 if (!gfits_get_bintable_column ( &header, &table, argv[i], &data)) ESCAPE ("error reading data from specified field");571 if (!gfits_get_bintable_column_type (outheader, argv[i], type, &Nval)) ESCAPE ("requested field not found"); 572 if (!gfits_get_bintable_column (outheader, outtable, argv[i], &data)) ESCAPE ("error reading data from specified field"); 531 573 } else { 532 if (!gfits_get_table_column_type ( &header, argv[i], type)) ESCAPE ("requested field not found");533 if (!gfits_get_table_column ( &header, &table, argv[i], &data)) ESCAPE ("error reading data from specified field");574 if (!gfits_get_table_column_type (outheader, argv[i], type)) ESCAPE ("requested field not found"); 575 if (!gfits_get_table_column (outheader, outtable, argv[i], &data)) ESCAPE ("error reading data from specified field"); 534 576 } 535 577 if (Nval == 0) ESCAPE ("no data for field in table"); … … 594 636 } 595 637 if (CCDKeyword != NULL) free (CCDKeyword); 596 gfits_free_table ( &table);597 gfits_free_header ( &header);638 gfits_free_table (outtable); 639 gfits_free_header (outheader); 598 640 return (TRUE); 599 641 } -
branches/eam_branches/ohana.20150429/src/opihi/cmd.data/wd.c
r38338 r38340 205 205 ftable.header = &theader; 206 206 207 int i;208 207 gfits_compress_image (&temp_header, &temp_matrix, &ftable, NULL, CompressMode); 209 fprintf (stderr, "wd 1: ");210 for (i = 0; i < 32; i++) {211 fprintf (stderr, "0x%0hhx ", ftable.buffer[i]);212 }213 fprintf (stderr, "\n");214 215 208 gfits_byteswap_varlength_column (&ftable, 1); 216 fprintf (stderr, "wd 2: ");217 for (i = 0; i < 32; i++) {218 fprintf (stderr, "0x%0hhx ", ftable.buffer[i]);219 }220 fprintf (stderr, "\n");221 222 209 gfits_fwrite_Theader (f, &theader); 223 210 gfits_fwrite_table (f, &ftable); -
branches/eam_branches/ohana.20150429/src/opihi/cmd.data/write_vectors.c
r38330 r38340 63 63 } 64 64 65 int compress = FALSE; 66 if ((N = get_argument (argc, argv, "-compress"))) { 67 remove_argument (N, &argc, argv); 68 compress = TRUE; 65 char *compress = NULL; 66 if ((N = get_argument (argc, argv, "-compress-mode"))) { 67 remove_argument (N, &argc, argv); 68 compress = strcreate(argv[N]); 69 remove_argument (N, &argc, argv); 70 } else if ((N = get_argument (argc, argv, "-compress"))) { 71 remove_argument (N, &argc, argv); 72 compress = strcreate("GZIP_1"); 69 73 if (!FITS) { 70 74 fprintf (stderr, "NOTE: write_vectors -compress has no effect on non-FITS\n");
Note:
See TracChangeset
for help on using the changeset viewer.
