float b_name;
} ArrayOfStructures(30);
type = Layout(8); type= 2 (chunked) storageSize = (3,16) dataSize=0 dataAddress=1576
*/
public void testStructureArrayChunked() throws IOException {
NetcdfFile ncfile = TestH5.openH5("support/cuslab.h5");
Variable v = ncfile.findVariable("ArrayOfStructures");
assert( null != v);
assert( v.getDataType() == DataType.STRUCTURE);
assert( v instanceof Structure);
assert( v.getRank() == 1);
assert( v.getShape()[0] == 30);
Array data = null;
try {
data = v.read();
} catch (IOException e) { assert false; } // */
assert(data.getElementType() == StructureData.class);
assert (data instanceof ArrayStructure);
assert (data.getSize() == 30);
assert (data.getRank() == 1);
IndexIterator iter = data.getIndexIterator();
while (iter.hasNext()) {
Object o = iter.next();
assert (o instanceof StructureData) : o;
StructureData d = (StructureData) o;
Array arr = d.getArray("a_name");
assert (arr != null);
assert (arr.getElementType() == int.class);
assert (arr instanceof ArrayInt);
NCdump.printArray( arr, "a_name", out, null);
arr = d.getArray("b_name");
assert (arr != null);
assert (arr.getElementType() == float.class);
assert (arr instanceof ArrayFloat);
NCdump.printArray( arr, "b_name", out, null);
arr = d.getArray("c_name");
assert (arr != null);
assert (arr.getElementType() == double.class);
assert (arr instanceof ArrayDouble);
NCdump.printArray( arr, "c_name", out, null);
}
// this tests that we are using the btree ok
Index ima = data.getIndex();
StructureData sd = (StructureData) data.getObject( ima.set0(29));
assert (sd.getScalarDouble("c_name") == 9.0) : sd.getScalarDouble("c_name");
ncfile.close();
} // */