Skip to content

Commit

Permalink
uncompress and recompress now successful #61
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchieGitHub committed May 28, 2016
1 parent 57a471d commit 6f2e752
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 27 deletions.
3 changes: 3 additions & 0 deletions src/main/java/nom/tam/util/ColumnTable.java
Expand Up @@ -434,6 +434,9 @@ public void addRow(Object[] row) throws TableException {
}
initializePointers();
this.nrow += 1;
if (rowSize == 0) {
this.rowSize = this.nrow * ArrayFuncs.getBaseLength(getRow(this.nrow - 1));
}
}
}

Expand Down
Expand Up @@ -72,6 +72,8 @@ public void testBasicBinaryTable() throws Exception {
Fits fitsComp = new Fits("src/test/resources/nom/tam/table/comp/testBinaryTable.fits.fz");
CompressedTableHDU cfitsioTable = (CompressedTableHDU) fitsComp.getHDU(1);

cfitsioTable.info(System.out);

BinaryTableHDU binaryTable2HDU = cfitsioTable.asBinaryTableHDU();

Fits fits = new Fits();
Expand Down Expand Up @@ -105,43 +107,20 @@ public void testBasicBinaryTable() throws Exception {
assertStringCard(Standard.TFORMn.n(1), "25D", header.card(Standard.TFORMn.n(1)).card());
assertStringCard(Standard.TDIMn.n(1), "(5,5)", header.card(Standard.TDIMn.n(1)).card());
fits.close();
if (1 == 1) {
return;
}
/**
* <pre>
* XTENSION= 'BINTABLE' / marks beginning of new HDU
* BITPIX = 8 / bits per data value
* NAXIS = 2 / number of axes
* NAXIS1 = 16 / size of the n'th axis
* NAXIS2 = 1 / size of the n'th axis
* PCOUNT = 8800 / Required value
* GCOUNT = 1 / Required value
* TFIELDS = 1 / Number of table fields
* TFORM1 = '1QB(8800)' / column data format
* TDIM1 = '(5,5) ' / dimensionality of the array
* ZTABLE = T / this is a compressed table
* ZTILELEN= 50 / number of rows in each tile
* ZNAXIS1 = 200 / size of the n'th axis
* ZNAXIS2 = 50 / size of the n'th axis
* ZPCOUNT = 0 / Required value
* ZFORM1 = '25D ' / column data format
* ZCTYP1 = 'GZIP_2 ' / compression algorithm for column
* </pre>
*/

fits = new Fits("target/testBinaryTable_recompressed.fits");
header = fits.getHDU(1).getHeader();
iter = header.iterator();
assertStringCard(Standard.XTENSION, XTENSION_BINTABLE, iter.next());
assertIntCard(Standard.BITPIX, 8, iter.next());
assertIntCard(Standard.NAXIS, 2, iter.next());
assertIntCard(Standard.NAXISn.n(1), 16, iter.next());
assertIntCard(Standard.NAXISn.n(2), 1, iter.next());
assertIntCard(Standard.PCOUNT, 0, iter.next());
assertIntCard(Standard.NAXISn.n(2), 5, iter.next());
assertIntCard(Standard.PCOUNT, 1380, iter.next());
assertIntCard(Standard.GCOUNT, 1, iter.next());
assertIntCard(Standard.TFIELDS, 1, iter.next());
// the order of the next two fields is not fix
assertStringCard(Standard.TFORMn.n(1), "25D", header.card(Standard.TFORMn.n(1)).card());
assertStringCard(Standard.TFORMn.n(1), "1QB", header.card(Standard.TFORMn.n(1)).card());
assertStringCard(Standard.TDIMn.n(1), "(5,5)", header.card(Standard.TDIMn.n(1)).card());
fits.close();
}
Expand Down

0 comments on commit 6f2e752

Please sign in to comment.