Skip to content

Commit

Permalink
splat: handle table column switching when data are stored as a vector…
Browse files Browse the repository at this point in the history
… cell

still not handling SEDs correctly, need to look after row numbers somehow
  • Loading branch information
pwdraper committed Oct 23, 2013
1 parent 20d53b8 commit b829b38
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions splat/src/main/uk/ac/starlink/splat/data/TableSpecDataImpl.java
Expand Up @@ -69,7 +69,8 @@ public class TableSpecDataImpl
/**
* Create an object by opening a resource and reading its
* content. Note this throws a SEDSplatException, if the table is
* suspected of being an SED (that is it contain vector cells).
* suspected of being an SED (that is it contain vector cells)
* with more than one row.
*
* @param tablespec the name of the resource (file plus optional fragment).
*/
Expand Down Expand Up @@ -679,11 +680,14 @@ protected void readColumn( double[] data, int index )
catch (ClassCastException e) {
// Isn't a Number, is it a vector?
if ( isPrimitiveArray( cellData ) ) {
throw new SEDSplatException( dims[0],
"Table contains vector cells, assuming it is an SED" );
// Read vector data from first row. XXX handle SED.
double newdata[] = readCell( 0, index );
System.arraycopy( newdata, 0, data, 0, newdata.length );
}
else {
throw new SplatException
( "Table column ("+ index +")contains an unknown data type" );
}
throw new SplatException
( "Table column ("+ index +")contains an unknown data type" );
}
catch (Exception e) {
throw new SplatException( "Failed reading table column" , e );
Expand Down

0 comments on commit b829b38

Please sign in to comment.