Range range = trajDt.getFullRange();
startDate = System.currentTimeMillis();
for ( Iterator it = trajDt.getDataVariables().iterator(); it.hasNext(); )
{
VariableSimpleIF var = (VariableSimpleIF) it.next();
Array a = trajDt.getData( range, var.getShortName() );
}
endDate = System.currentTimeMillis();
System.out.println( "Variable-oriented read of record written data: " + ( (endDate - startDate) / 1000.0 ) + " seconds" );
// Read all data in point oriented manner.
startDate = System.currentTimeMillis();
for ( int i = 0; i < trajDt.getNumberPoints(); i++ )
{
StructureData structData = trajDt.getData( i );
}
endDate = System.currentTimeMillis();
System.out.println( "Point-oriented read of record written data: " + ( ( endDate - startDate ) / 1000.0 ) + " seconds" );
// Read all data in point oriented manner with iterator.
startDate = System.currentTimeMillis();
for ( DataIterator it = trajDt.getDataIterator( 0); it.hasNext(); )
{
PointObsDatatype pointOb = (PointObsDatatype) it.nextData();
}
endDate = System.currentTimeMillis();
System.out.println( "Point-oriented iterator read of record written data: " + ( ( endDate - startDate ) / 1000.0 ) + " seconds" );
//================ non-record written data ====================
location = testFilePath + "/" + test_Raf_1_3_NoRecvar_FileName;
assertTrue( "Test file <" + location + "> does not exist.",
new File( location ).exists() );
try
{
StringBuilder errlog = new StringBuilder();
me = (TrajectoryObsDataset) TypedDatasetFactory.open(FeatureType.TRAJECTORY, location, null, errlog);
}
catch ( IOException e )
{
String tmpMsg = "Couldn't create TrajectoryObsDataset from RAF aircraft file <" + location + ">: " + e.getMessage();
assertTrue( tmpMsg,
false );
}
assertTrue( "Null TrajectoryObsDataset after open <" + location + "> ",
me != null );
assertTrue( "Dataset <" + location + "> not a RafTrajectoryObsDataset.",
me instanceof RafTrajectoryObsDataset );
// Read all data in variable oriented manner.
trajDt = me.getTrajectory( "1Hz data" );
range = trajDt.getFullRange();
startDate = System.currentTimeMillis();
for ( Iterator it = trajDt.getDataVariables().iterator(); it.hasNext(); )
{
VariableSimpleIF var = (VariableSimpleIF) it.next();
Array a = trajDt.getData( range, var.getShortName() );
}
endDate = System.currentTimeMillis();
System.out.println( "Variable-oriented read of non-record written data: " + ( ( endDate - startDate ) / 1000.0 ) + " seconds" );
// Read all data in point oriented manner.