@Override Index reduce(int dim) { if ((dim < 0) || (dim >= rank)) throw new IllegalArgumentException("illegal reduce dim " + dim); if (shape[dim] != 1) throw new IllegalArgumentException("illegal reduce dim " + dim + " : length != 1"); Section curr = new Section(shape); Section want = curr.removeRange(dim); return new IndexConstant( want.getShape()); }
@Override Index reduce(int dim) { if ((dim < 0) || (dim >= rank)) throw new IllegalArgumentException("illegal reduce dim " + dim); if (shape[dim] != 1) throw new IllegalArgumentException("illegal reduce dim " + dim + " : length != 1"); Section curr = new Section(shape); Section want = curr.removeRange(dim); return new IndexConstant( want.getShape()); }
@Override Index reduce() { Section curr = new Section(shape); Section want = curr.reduce(); return new IndexConstant( want.getShape()); }
Iterator(int[] shape) { int ss = 1; for (int i = getRank() - 1; i >= 0; i--) { odo[i] = getRange(i).first(); stride[i] = ss; ss *= shape[i]; } done = 0; total = Index.computeSize(getShape()); // total in the section }
Iterator(int[] shape) { int ss = 1; for (int i = getRank() - 1; i >= 0; i--) { odo[i] = getRange(i).first(); stride[i] = ss; ss *= shape[i]; } done = 0; total = Index.computeSize(getShape()); // total in the section }
@Override Index sectionNoReduce(List<Range> ranges) throws InvalidRangeException { Section curr = new Section(shape); Section want = curr.compose(new Section(ranges)); return new IndexConstant( want.getShape()); }
public Array readData1(Variable v2, Section section, float[] values) { Array data = Array.factory(v2.getDataType(), section.getShape()); IndexIterator ii = data.getIndexIterator(); Range radialRange = section.getRange(0); // radial range can also be gate range for (int radialIdx : radialRange) { ii.setFloatNext(values[radialIdx]); } return data; }
@Override public Array reallyRead(Variable client, Section section, CancelTask cancelTask) throws IOException, InvalidRangeException { // see if its really a full read if ((null == section) || section.computeSize() == getSize()) return reallyRead(client, cancelTask); if (orgVar == null) return getMissingDataArray(section.getShape()); return orgVar.read(section); }
public Array readData2(Variable v2, Section section, double[] values) { Array data = Array.factory(v2.getDataType(), section.getShape()); IndexIterator ii = data.getIndexIterator(); Range radialRange = section.getRange(0); for (int radialIdx : radialRange) { ii.setDoubleNext(values[radialIdx]); } return data; }
private ucar.ma2.Array readNestedData(ucar.nc2.Variable v2, Section section) throws java.io.IOException, ucar.ma2.InvalidRangeException { N3header.Vinfo vinfo = (N3header.Vinfo) v2.getSPobject(); DataType dataType = v2.getDataType(); // construct the full shape for use by RegularIndexer int[] fullShape = new int[v2.getRank() + 1]; fullShape[0] = header.numrecs; // the first dimension System.arraycopy(v2.getShape(), 0, fullShape, 1, v2.getRank()); // the remaining dimensions Layout layout = new LayoutRegularSegmented(vinfo.begin, v2.getElementSize(), header.recsize, fullShape, section); Object dataObject = readData(layout, dataType); return Array.factory(dataType, section.getShape(), dataObject); }
private ucar.ma2.Array readNestedData(ucar.nc2.Variable v2, Section section) throws java.io.IOException, ucar.ma2.InvalidRangeException { N3header.Vinfo vinfo = (N3header.Vinfo) v2.getSPobject(); DataType dataType = v2.getDataType(); // construct the full shape for use by RegularIndexer int[] fullShape = new int[v2.getRank() + 1]; fullShape[0] = header.numrecs; // the first dimension System.arraycopy(v2.getShape(), 0, fullShape, 1, v2.getRank()); // the remaining dimensions Layout layout = new LayoutRegularSegmented(vinfo.begin, v2.getElementSize(), header.recsize, fullShape, section); Object dataObject = readData(layout, dataType); return Array.factory(dataType.getPrimitiveClassType(), section.getShape(), dataObject); }
public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException { Vgroup vgroup = (Vgroup) v2.getSPobject(); Range scanRange = section.getRange(0); Range radialRange = section.getRange(1); Range gateRange = section.getRange(2); Array data = Array.factory(v2.getDataType(), section.getShape()); IndexIterator ii = data.getIndexIterator(); for (int scanIdx : scanRange) { Level2Record[] mapScan = vgroup.map[scanIdx]; readOneScan(mapScan, radialRange, gateRange, vgroup.datatype, ii); } return data; }
public Array readData2(Variable v2, Section section, double[] values) { Array data = Array.factory(v2.getDataType().getPrimitiveClassType(), section.getShape()); IndexIterator ii = data.getIndexIterator(); Range radialRange = section.getRange(0); for (int r = radialRange.first(); r <= radialRange.last(); r += radialRange.stride()) { ii.setDoubleNext(values[r]); } return data; }
static private ArrayStructure sectionArrayStructure(ParsedSectionSpec child, ArrayStructure innerData, StructureMembers.Member m) throws IOException, InvalidRangeException { StructureMembers membersw = new StructureMembers(m.getStructureMembers()); // no data arrays get propagated ArrayStructureW result = new ArrayStructureW(membersw, child.section.getShape()); int count = 0; Section.Iterator iter = child.section.getIterator(child.v.getShape()); while (iter.hasNext()) { int recno = iter.next(null); StructureData sd = innerData.getStructureData(recno); result.setStructureData(sd, count++); } return result; }
static private ArrayStructure sectionArrayStructure(ParsedSectionSpec child, ArrayStructure innerData, StructureMembers.Member m) throws IOException, InvalidRangeException { StructureMembers membersw = new StructureMembers(m.getStructureMembers()); // no data arrays get propagated ArrayStructureW result = new ArrayStructureW(membersw, child.section.getShape()); int count = 0; Section.Iterator iter = child.section.getIterator(child.v.getShape()); while (iter.hasNext()) { int recno = iter.next(null); StructureData sd = innerData.getStructureData(recno); result.setStructureData(sd, count++); } return result; }
public Array readData1(Variable v2, Section section, float[] values) { Array data = Array.factory(v2.getDataType().getPrimitiveClassType(), section.getShape()); IndexIterator ii = data.getIndexIterator(); Range radialRange = section.getRange(0); // radial range can also be gate range for (int r = radialRange.first(); r <= radialRange.last(); r += radialRange.stride()) { ii.setFloatNext(values[r]); } return data; }
public Array readData1(Variable v2, Section section, float[] values) { Array data = Array.factory(v2.getDataType().getPrimitiveClassType(), section.getShape()); IndexIterator ii = data.getIndexIterator(); Range radialRange = section.getRange(0); // radial range can also be gate range for (int r = radialRange.first(); r <= radialRange.last(); r += radialRange.stride()) { ii.setFloatNext(values[r]); } return data; }
static private ArrayStructure sectionArrayStructure(ParsedSectionSpec child, ArrayStructure innerData, StructureMembers.Member m) throws IOException, InvalidRangeException { StructureMembers membersw = new StructureMembers(m.getStructureMembers()); // no data arrays get propagated ArrayStructureW result = new ArrayStructureW(membersw, child.section.getShape()); int count = 0; Section.Iterator iter = child.section.getIterator(child.v.getShape()); while (iter.hasNext()) { int recno = iter.next(); StructureData sd = innerData.getStructureData(recno); result.setStructureData(sd, count++); } return result; }
public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException { Vgroup vgroup = (Vgroup) v2.getSPobject(); Range scanRange = section.getRange(0); Range radialRange = section.getRange(1); Range gateRange = section.getRange(2); Array data = Array.factory(v2.getDataType().getPrimitiveClassType(), section.getShape()); IndexIterator ii = data.getIndexIterator(); for (int i=scanRange.first(); i<=scanRange.last(); i+= scanRange.stride()) { Level2Record[] mapScan = vgroup.map[i]; readOneScan(mapScan, radialRange, gateRange, vgroup.datatype, ii); } return data; }
public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException { Vgroup vgroup = (Vgroup) v2.getSPobject(); Range scanRange = section.getRange(0); Range radialRange = section.getRange(1); Range gateRange = section.getRange(2); Array data = Array.factory(v2.getDataType().getPrimitiveClassType(), section.getShape()); IndexIterator ii = data.getIndexIterator(); for (int i=scanRange.first(); i<=scanRange.last(); i+= scanRange.stride()) { Level2Record[] mapScan = vgroup.map[i]; readOneScan(mapScan, radialRange, gateRange, vgroup.datatype, ii); } return data; }