public int[] getCurrentCounter() { return counter.getCurrentCounter(); }
public int[] getCurrentCounter() { return counter.getCurrentCounter(); }
public int[] getCurrentCounter() { return counter.getCurrentCounter(); }
/** * Use this when this is a one dimensional array of Structures, or you are doing the index calculation yourself for * a multidimension array. This will read only the ith structure, and return the data as a StructureData object. * @param index index into 1D array * @return ith StructureData * @throws java.io.IOException on read error * @throws ucar.ma2.InvalidRangeException if index out of range */ public StructureData readStructure(int index) throws IOException, ucar.ma2.InvalidRangeException { Section section = null; // works for scalars i think if (getRank() == 1) { section = new Section().appendRange(index,index); } else if (getRank() > 1) { Index ii = Index.factory(shape); // convert to nD index ii.setCurrentCounter(index); int[] origin = ii.getCurrentCounter(); section = new Section(); for (int anOrigin : origin) section.appendRange(anOrigin, anOrigin); } Array dataArray = read(section); ArrayStructure data = (ArrayStructure) dataArray; return data.getStructureData(0); }
/** * Use this when this is a one dimensional array of Structures, or you are doing the index calculation yourself for * a multidimension array. This will read only the ith structure, and return the data as a StructureData object. * @param index index into 1D array * @return ith StructureData * @throws java.io.IOException on read error * @throws ucar.ma2.InvalidRangeException if index out of range */ public StructureData readStructure(int index) throws IOException, ucar.ma2.InvalidRangeException { Section section = null; // works for scalars i think if (getRank() == 1) { section = new Section().appendRange(index,index); } else if (getRank() > 1) { Index ii = Index.factory(shape); // convert to nD index ii.setCurrentCounter(index); int[] origin = ii.getCurrentCounter(); section = new Section(); for (int i=0;i<origin.length;i++) section.appendRange(origin[i], origin[i]); } Array dataArray = read(section); ArrayStructure data = (ArrayStructure) dataArray; return data.getStructureData(0); }
/** * Use this when this is a one dimensional array of Structures, or you are doing the index calculation yourself for * a multidimension array. This will read only the ith structure, and return the data as a StructureData object. * @param index index into 1D array * @return ith StructureData * @throws java.io.IOException on read error * @throws ucar.ma2.InvalidRangeException if index out of range */ public StructureData readStructure(int index) throws IOException, ucar.ma2.InvalidRangeException { Section section = null; // works for scalars i think if (getRank() == 1) { section = new Section().appendRange(index,index); } else if (getRank() > 1) { Index ii = Index.factory(shape); // convert to nD index ii.setCurrentCounter(index); int[] origin = ii.getCurrentCounter(); section = new Section(); for (int anOrigin : origin) section.appendRange(anOrigin, anOrigin); } Array dataArray = read(section); ArrayStructure data = (ArrayStructure) dataArray; return data.getStructureData(0); }