for (int i = 0; i < wrapper.ignoredDimensions.size(); i++) { ranges.add(new Range(0, 0, 1)); first = slice2DIndex.getNIndex(i); if (first != -1) { ranges.add(new Range(first, first, 1)); int length = srcRegion.height; int stride = strideY; ranges.add(new Range(first, first + length - 1, stride)); ranges.add(new Range(first, first + length - 1, stride)); } catch (InvalidRangeException e) { throw netcdfFailure(e); Range range = new Range(sourceBand, sourceBand, 1);
/** * Create a new Range by compacting this Range by removing the stride. * first = first/stride, last=last/stride, stride=1. * * @return compacted Range * @throws InvalidRangeException elements must be nonnegative, 0 <= first <= last */ public Range compact() throws InvalidRangeException { if (stride() == 1) return this; int first = first() / stride(); int last = first + length() - 1; return new Range(name, first, last, 1); }
/** * Create a new Range by compacting this Range by removing the stride. * first = first/stride, last=last/stride, stride=1. * * @return compacted Range * @throws InvalidRangeException elements must be nonnegative, 0 <= first <= last */ public Range compact() throws InvalidRangeException { if (stride == 1) return this; int first = first() / stride; // LOOK WTF ? int last = first + length() - 1; return new Range(name, first, last, 1); }
Dim(long byteStride, int maxSize, Range want) { this.stride = byteStride; this.maxSize = maxSize; this.wantSize = want.length(); this.want = want; } }
public int offset(Section intersect) throws InvalidRangeException { if (intersect.getRank() != getRank()) throw new InvalidRangeException("Invalid Section rank"); int result = 0; int stride = 1; for (int j = list.size() - 1; j >= 0; j--) { Range base = list.get(j); Range r = intersect.getRange(j); int offset = base.index(r.first()); result += offset * stride; stride *= base.length(); } return result; }
Dim(Range data, Range want, Range intersect, int dataStride, int wantStride) { //assert want.length() <= maxSize : want.last() +" > "+ maxSize ; this.data = data; this.want = want; this.intersect = intersect; this.dataStride = dataStride; this.wantStride = wantStride; this.ncontigElements = intersect.stride() == 1 ? intersect.length() : 1; this.wantNelems = intersect.length(); if (debugMerge) System.out.println("Dim="+this); }
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 }
public String toString() { if(this.n == 0) return "EMPTY"; else if(this.n < 0) return "VLEN"; else return first + ":" + last() + (stride > 1 ? ":" + stride : ""); }
public boolean isStrided() { for (Range r : list) { if (r != null && r.stride() != 1) return false; } return true; }
boolean wantRow(int row) { if (ama == null) return false; if (r == null) return true; return r.contains(row); } }
/** * Create a new Section by compacting each Range. * first = first/stride, last=last/stride, stride=1. * * @return compacted Section * @throws InvalidRangeException elements must be nonnegative, 0 <= first <= last */ public Section compact() throws InvalidRangeException { List<Range> results = new ArrayList<>(getRank()); for (Range r : list) { results.add(r.compact()); } return new Section(results); }
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(); if (r.first() != 0) rbuilder.setStart(r.first()); rbuilder.setSize(r.length()); if (r.stride() != 1) rbuilder.setStride(r.stride()); sbuilder.addRange(rbuilder); } return sbuilder.build(); }
Dim(long byteStride, int maxSize, Range want) { this.stride = byteStride; this.maxSize = maxSize; this.wantSize = want.length(); this.want = want; } }