/** * Get origin array using the Range.first() values. * * @return int[] origin */ public int[] getOrigin() { int[] result = new int[list.size()]; for (int i = 0; i < list.size(); i++) { result[i] = list.get(i).first(); } return result; }
/** * If this range is completely past the wanted range * * @param want desired range * @return true if first() > want.last() */ public boolean past(Range want) { return (first() > want.last()); }
protected boolean isNeeded(Range totalRange) { int wantStart = totalRange.first(); int wantStop = totalRange.last() + 1; // Range has last inclusive, we use last exclusive return isNeeded(wantStart, wantStop); }
protected boolean isNeeded(Range totalRange) { int wantStart = totalRange.first(); int wantStop = totalRange.last() + 1; // Range has last inclusive, we use last exclusive return isNeeded(wantStart, wantStop); }
private void readOneScan(List<Ray> mapScan, Range radialRange, Range gateRange, IndexIterator ii) throws IOException { int siz = mapScan.size(); for (int i = radialRange.first(); i <= radialRange.last(); i += radialRange.stride()) { if (i >= siz) readOneRadial(null, gateRange, ii); else { Ray r = mapScan.get(i); readOneRadial(r, gateRange, ii); } } }
private void readOneScan(Level2Record[] mapScan, Range radialRange, Range gateRange, int datatype, IndexIterator ii) throws IOException { for (int i=radialRange.first(); i<=radialRange.last(); i+= radialRange.stride()) { Level2Record r = mapScan[i]; readOneRadial(r, datatype, gateRange, ii); } }
private void readOneScan(Level2Record[] mapScan, Range radialRange, Range gateRange, int datatype, IndexIterator ii) throws IOException { for (int i=radialRange.first(); i<=radialRange.last(); i+= radialRange.stride()) { Level2Record r = mapScan[i]; readOneRadial(r, datatype, gateRange, ii); } }
private void readOneScan(Cinrad2Record[] mapScan, Range radialRange, Range gateRange, int datatype, IndexIterator ii) throws IOException { for (int i=radialRange.first(); i<=radialRange.last(); i+= radialRange.stride()) { Cinrad2Record r = mapScan[i]; readOneRadial(r, datatype, gateRange, ii); } }
/** * Copy Constructor * * @param r copy from here */ public Range(Range r) { first = r.first(); n = r.length(); stride = r.stride(); name = r.getName(); }
private void readOneRadial(Ray r, Range gateRange, IndexIterator ii) throws IOException { if (r == null) { for (int i = gateRange.first(); i <= gateRange.last(); i += gateRange.stride()) ii.setFloatNext(Float.NaN); return; } r.readData(volScan.raf, gateRange, ii); }
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 }
private void readOneRadial(Cinrad2Record r, int datatype, Range gateRange, IndexIterator ii) throws IOException { if (r == null) { for (int i=gateRange.first(); i<=gateRange.last(); i+= gateRange.stride()) ii.setByteNext( Cinrad2Record.MISSING_DATA); return; } r.readData(this.raf, datatype, gateRange, ii); }
private void readOneRadial(Level2Record r, int datatype, Range gateRange, IndexIterator ii) throws IOException { if (r == null) { for (int i=gateRange.first(); i<=gateRange.last(); i+= gateRange.stride()) ii.setByteNext( MISSING_DATA); return; } r.readData(volScan.raf, datatype, gateRange, ii); }
private void readOneRadial(Ray r, String abbrev, Range gateRange, IndexIterator ii) throws IOException { if (r == null) { for (int i = gateRange.first(); i <= gateRange.last(); i += gateRange.stride()) ii.setShortNext(headerParser.getMissingData()); return; } r.readData(raf, abbrev, gateRange, ii); }
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; }
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; }
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 public NcStreamProto.Section encodeSection(Section section) { NcStreamProto.Section.Builder sbuilder = NcStreamProto.Section.newBuilder(); for (Range r : section.getRanges()) { NcStreamProto.Range.Builder rbuilder = NcStreamProto.Range.newBuilder(); rbuilder.setStart(r.first()); rbuilder.setSize(r.length()); rbuilder.setStride(r.stride()); sbuilder.addRange(rbuilder); } return sbuilder.build(); }
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; }