/** * Constructor. * @param parentStructure get data from this Structure * @param parentIndex name of member variable in leaf StructureData */ public JoinParentIndex(StructureDS parentStructure, String parentIndex) { this.parentStructure = parentStructure; this.parentIndex = parentIndex; try { parentData = (ArrayStructure) parentStructure.read(); // cache entire ArrayStructure LOOK } catch (IOException e) { e.printStackTrace(); } }
/** * Constructor. * @param parentStructure get data from this Structure * @param dimLength structure index is recnum % dimlength */ public JoinMuiltdimStructure(StructureDS parentStructure, int dimLength) { this.parentStructure = parentStructure; this.dimLength = dimLength; try { parentData = (ArrayStructure) parentStructure.read(); // cache entire ArrayStructure LOOK } catch (IOException e) { e.printStackTrace(); } }
/** * Constructor. * @param parentStructure get data from this Structure * @param parentIndex name of member variable in leaf StructureData */ public JoinParentIndex(StructureDS parentStructure, String parentIndex) { this.parentStructure = parentStructure; this.parentIndex = parentIndex; try { parentData = (ArrayStructure) parentStructure.read(); // cache entire ArrayStructure LOOK } catch (IOException e) { e.printStackTrace(); } }
/** * Constructor. * @param parentStructure get data from this Structure * @param parentIndex name of member variable in leaf StructureData */ public JoinParentIndex(StructureDS parentStructure, String parentIndex) { this.parentStructure = parentStructure; this.parentIndex = parentIndex; try { parentData = (ArrayStructure) parentStructure.read(); // cache entire ArrayStructure LOOK } catch (IOException e) { e.printStackTrace(); } }
/** * Constructor. * @param parentStructure get data from this Structure * @param dimLength structure index is recnum % dimlength */ public JoinMuiltdimStructure(StructureDS parentStructure, int dimLength) { this.parentStructure = parentStructure; this.dimLength = dimLength; try { parentData = (ArrayStructure) parentStructure.read(); // cache entire ArrayStructure LOOK } catch (IOException e) { e.printStackTrace(); } }
/** * Constructor. * @param parentStructure get data from this Structure * @param dimLength structure index is recnum % dimlength */ public JoinMuiltdimStructure(StructureDS parentStructure, int dimLength) { this.parentStructure = parentStructure; this.dimLength = dimLength; try { parentData = (ArrayStructure) parentStructure.read(); // cache entire ArrayStructure LOOK } catch (IOException e) { e.printStackTrace(); } }
public StructureDataIterator getStructureDataIterator(Cursor cursor, int bufferSize) throws IOException { int recnum = cursor.getParentRecnum(); try { Section section = new Section().appendRange(recnum, recnum); int count = 1; while (count++ < struct.getRank()) // handles multidim case section.appendRange(null); ArrayStructure data = (ArrayStructure) struct.read(section); // read all the data for a fixed outer index return data.getStructureDataIterator(); } catch (InvalidRangeException e) { throw new IllegalStateException(e); } }
public StructureDataIterator getStructureDataIterator(Cursor cursor, int bufferSize) throws IOException { int recnum = cursor.getParentRecnum(); try { Section section = new Section().appendRange(recnum, recnum); int count = 1; while (count++ < struct.getRank()) // handles multidim case section.appendRange(null); ArrayStructure data = (ArrayStructure) struct.read(section); // read all the data for a fixed outer index return data.getStructureDataIterator(); } catch (InvalidRangeException e) { throw new IllegalStateException(e); } }
@Override public StructureDataIterator getStructureDataIterator(Cursor cursor) throws IOException { int recnum = cursor.getParentRecnum(); try { Section section = new Section().appendRange(recnum, recnum); int count = 1; while (count++ < struct.getRank()) // handles multidim case section.appendRange(null); ArrayStructure data = (ArrayStructure) struct.read(section); // read all the data for a fixed outer index return data.getStructureDataIterator(); } catch (InvalidRangeException e) { throw new IllegalStateException(e); } }
public StructureDataIterator getStructureDataIterator(Cursor cursor, int bufferSize) throws IOException { int outerIndex = cursor.recnum[2]; int middleIndex = cursor.recnum[1]; try { Section s = new Section().appendRange(outerIndex,outerIndex).appendRange(middleIndex,middleIndex); ArrayStructure result = (ArrayStructure) struct.read(s); assert result.getSize() == 1; StructureData sdata = result.getStructureData(0); // should only be one ArrayStructureMA asma = new ArrayStructureMA(sm, new int[]{inner.getLength()}); for (String colName : cols.keySet()) { Array data = sdata.getArray(colName); StructureMembers.Member childm = sm.findMember(colName); childm.setDataArray(data); } return asma.getStructureDataIterator(); } catch (InvalidRangeException e) { throw new IllegalStateException(e); } }
@Override public StructureDataIterator getStructureDataIterator(Cursor cursor) throws IOException { int outerIndex = cursor.recnum[2]; int middleIndex = cursor.recnum[1]; try { Section s = new Section().appendRange(outerIndex, outerIndex).appendRange(middleIndex, middleIndex); ArrayStructure result = (ArrayStructure) struct.read(s); assert result.getSize() == 1; StructureData sdata = result.getStructureData(0); // should only be one ArrayStructureMA asma = new ArrayStructureMA(sm, new int[]{inner.getLength()}); for (String colName : cols.keySet()) { Array data = sdata.getArray(colName); StructureMembers.Member childm = sm.findMember(colName); childm.setDataArray(data); } return asma.getStructureDataIterator(); } catch (InvalidRangeException e) { throw new IllegalStateException(e); } }
public StructureDataIterator getStructureDataIterator(Cursor cursor, int bufferSize) throws IOException { int outerIndex = cursor.recnum[2]; int middleIndex = cursor.recnum[1]; try { Section s = new Section().appendRange(outerIndex,outerIndex).appendRange(middleIndex,middleIndex); ArrayStructure result = (ArrayStructure) struct.read(s); assert result.getSize() == 1; StructureData sdata = result.getStructureData(0); // should only be one ArrayStructureMA asma = new ArrayStructureMA(sm, new int[]{inner.getLength()}); for (VariableSimpleIF v : cols) { Array data = sdata.getArray(v.getShortName()); StructureMembers.Member childm = sm.findMember(v.getShortName()); childm.setDataArray(data); } return asma.getStructureDataIterator(); } catch (InvalidRangeException e) { throw new IllegalStateException(e); } }
public void testDatasetAddRecordAfter() throws InvalidRangeException, IOException { NetcdfDataset nc = NetcdfDataset.openDataset(TestDir.cdmLocalTestDataDir + "testWriteRecord.nc"); assert (Boolean) nc.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); // record variable Variable record = nc.findVariable("record"); assert record instanceof StructureDS; StructureDS rs = (StructureDS) record; assert rs.getRank() == 1; assert rs.getDimension(0).getLength() == 2; /* Read a record */ Array rsValues = rs.read("1:1:2"); assert (rsValues instanceof ArrayStructure); assert rsValues.getRank() == 1; assert rsValues.getShape()[0] == 1; StructureData sdata = (StructureData) rsValues.getObject(rsValues.getIndex()); Array gdata = sdata.getArray("time"); assert gdata instanceof ArrayInt.D0 : gdata.getClass().getName(); ArrayInt.D0 tdata = (ArrayInt.D0) gdata; int t = tdata.get(); assert t == 18; int t2 = sdata.getScalarInt("time"); assert t2 == 18; /* Read the times: unlimited dimension */ Variable time = rs.findVariable("time"); Array timeValues = time.read(); assert (timeValues instanceof ArrayInt.D0); ArrayInt.D0 ta = (ArrayInt.D0) timeValues; assert (ta.get() == 6) : ta.get(); nc.close(); }
Array rsValues = rs.read("1:1:2"); assert (rsValues instanceof ArrayStructure); assert rsValues.getRank() == 1;