/** Set whether this is unlimited, meaning length can increase. * @param b true if unlimited */ public void setUnlimited( boolean b) { if (immutable) throw new IllegalStateException("Cant modify"); this.isUnlimited = b; setLength(this.length); // check legal } /** Set whether the length is variable.
/** * Set whether this is unlimited, meaning length can increase. * * @param b true if unlimited */ public void setUnlimited(boolean b) { if (immutable) throw new IllegalStateException("Cant modify"); this.isUnlimited = b; setLength(this.length); // check legal }
/** * Set whether this is unlimited, meaning length can increase. * * @param b true if unlimited */ public void setUnlimited(boolean b) { if (immutable) throw new IllegalStateException("Cant modify"); this.isUnlimited = b; setLength(this.length); // check legal }
/** Set whether the length is variable. * @param b true if variable length */ public void setVariableLength( boolean b) { if (immutable) throw new IllegalStateException("Cant modify"); this.isVariableLength = b; if (b) { this.isShared = false; this.isUnlimited = false; } setLength(this.length); // check legal } /** Set whether this is shared.
/** * Set whether the length is variable. * * @param b true if variable length */ public void setVariableLength(boolean b) { if (immutable) throw new IllegalStateException("Cant modify"); this.isVariableLength = b; if (b) { this.isShared = false; this.isUnlimited = false; } setLength(this.length); // check legal }
/** * Set whether the length is variable. * * @param b true if variable length */ public void setVariableLength(boolean b) { if (immutable) throw new IllegalStateException("Cant modify"); this.isVariableLength = b; if (b) { this.isShared = false; this.isUnlimited = false; } setLength(this.length); // check legal }
/** * Constructor * @param name name must be unique within group. Can be null only if not shared. * @param length length, or UNLIMITED.length or UNKNOWN.length * @param isShared whether its shared or local to Variable. * @param isUnlimited whether the length can grow. * @param isVariableLength whether the length is unknown until the data is read. */ public Dimension(String name, int length, boolean isShared, boolean isUnlimited, boolean isVariableLength) { super(name); this.isShared = isShared; this.isUnlimited = isUnlimited; this.isVariableLength = isVariableLength; if (isVariableLength && (isUnlimited || isShared)) throw new IllegalArgumentException("variable length dimension cannot be shared or unlimited") ; setLength(length); assert (name != null) || !this.isShared; }
/** * Constructor * * @param name name must be unique within group. Can be null only if not shared. * @param length length, or UNLIMITED.length or UNKNOWN.length * @param isShared whether its shared or local to Variable. * @param isUnlimited whether the length can grow. * @param isVariableLength whether the length is unknown until the data is read. */ public Dimension(String name, int length, boolean isShared, boolean isUnlimited, boolean isVariableLength) { super(name); this.isShared = isShared; this.isUnlimited = isUnlimited; this.isVariableLength = isVariableLength; if (isVariableLength && (isUnlimited || isShared)) throw new IllegalArgumentException("variable length dimension cannot be shared or unlimited"); setLength(length); assert (name != null) || !this.isShared; }
/** * Constructor * * @param name name must be unique within group. Can be null only if not shared. * @param length length, or UNLIMITED.length or UNKNOWN.length * @param isShared whether its shared or local to Variable. * @param isUnlimited whether the length can grow. * @param isVariableLength whether the length is unknown until the data is read. */ public Dimension(String name, int length, boolean isShared, boolean isUnlimited, boolean isVariableLength) { super(name); this.isShared = isShared; this.isUnlimited = isUnlimited; this.isVariableLength = isVariableLength; if (isVariableLength && (isUnlimited || isShared)) throw new IllegalArgumentException("variable length dimension cannot be shared or unlimited"); setLength(length); assert (name != null) || !this.isShared; }
private String extendDimension(ucar.nc2.Group g, H5Group h5group, String name, int length) { int pos = name.lastIndexOf('/'); String dimName = (pos >= 0) ? name.substring(pos + 1) : name; Dimension d = h5group.dimMap.get(dimName); // first look in current group if (d == null) d = g.findDimension(dimName); // then look in parent groups if (d != null) { if (d.isUnlimited() && (length > d.getLength())) d.setLength(length); if (!d.isUnlimited() && (length != d.getLength())) { throw new IllegalStateException("extendDimension: DimScale has different length than dimension it references dimScale=" + dimName); } return d.getShortName(); } return dimName; }
private String extendDimension(ucar.nc2.Group g, H5Group h5group, String name, int length) { int pos = name.lastIndexOf('/'); String dimName = (pos >= 0) ? name.substring(pos + 1) : name; Dimension d = h5group.dimMap.get(dimName); // first look in current group if (d == null) d = g.findDimension(dimName); // then look in parent groups if (d != null) { if (d.isUnlimited() && (length > d.getLength())) d.setLength(length); if (!d.isUnlimited() && (length != d.getLength())) { throw new IllegalStateException("extendDimension: DimScale has different length than dimension it references dimScale=" + dimName); } return d.getShortName(); } return dimName; }
private String extendDimension(ucar.nc2.Group g, H5Group h5group, String name, int length) { int pos = name.lastIndexOf('/'); String dimName = (pos >= 0) ? name.substring(pos + 1) : name; Dimension d = h5group.dimMap.get(dimName); // first look in current group if (d == null) d = g.findDimension(dimName); // then look in parent groups if (d != null) { if (d.isUnlimited() && (length > d.getLength())) d.setLength(length); if (!d.isUnlimited() && (length != d.getLength())) { throw new IllegalStateException("extendDimension: DimScale has different length than dimension it references dimScale="+dimName); } return d.getShortName(); } return dimName; }
private Dimension checkUnknownDims(String wantDim, List<Dimension> unknownDims, Dimension oldDim, String location) { for (Dimension dim : unknownDims) { if (dim.getShortName().equals(wantDim)) { int len = oldDim.getLength(); if (len == 0) dim.setUnlimited( true); // allow zero length dimension !! dim.setLength(len); // use existing (anon) dimension Group parent = dim.getGroup(); parent.addDimensionIfNotExists(dim); // add to the parent unknownDims.remove(dim); // remove from list LOOK is this ok? log.warn("unknownDim {} length set to {}{}", new Object[] {wantDim, oldDim.getLength(), location}); return dim; } } return null; }
private Dimension checkUnknownDims(String wantDim, List<Dimension> unknownDims, Dimension oldDim, String location) { for (Dimension dim : unknownDims) { if (dim.getShortName().equals(wantDim)) { int len = oldDim.getLength(); if (len == 0) dim.setUnlimited( true); // allow zero length dimension !! dim.setLength(len); // use existing (anon) dimension Group parent = dim.getGroup(); parent.addDimensionIfNotExists(dim); // add to the parent unknownDims.remove(dim); // remove from list LOOK is this ok? log.warn("unknownDim {} length set to {}{}", new Object[] {wantDim, oldDim.getLength(), location}); return dim; } } return null; }
private Dimension checkUnknownDims(String wantDim, List<Dimension> unknownDims, Dimension oldDim, String location) { for (Dimension dim : unknownDims) { if (dim.getShortName().equals(wantDim)) { int len = oldDim.getLength(); if (len == 0) { dim.setUnlimited(true); // allow zero length dimension !! } dim.setLength(len); // use existing (anon) dimension Group parent = dim.getGroup(); parent.addDimensionIfNotExists(dim); // add to the parent unknownDims.remove(dim); // remove from list LOOK is this ok? log.warn("unknownDim {} length set to {}{}", wantDim, oldDim.getLength(), location); return dim; } } return null; }
synchronized boolean synchNumrecs() throws IOException { // check number of records in the header // gotta bypass the RAF buffer int n = raf.readIntUnbuffered(4); if (n == this.numrecs) return false; if (n < 0) // streaming return false; // update everything this.numrecs = n; // set it in the unlimited dimension udim.setLength(this.numrecs); // set it in all of the record variables for (Variable uvar : uvars) { uvar.resetShape(); uvar.invalidateCache(); } return true; }
synchronized boolean synchNumrecs() throws IOException { // check number of records in the header // gotta bypass the RAF buffer int n = raf.readIntUnbuffered(4); if (n == this.numrecs) return false; if (n < 0) // streaming return false; // update everything this.numrecs = n; // set it in the unlimited dimension udim.setLength(this.numrecs); // set it in all of the record variables for (Variable uvar : uvars) { uvar.resetShape(); uvar.invalidateCache(); } return true; }
synchronized boolean synchNumrecs() throws IOException { // check number of records in the header // gotta bypass the RAF buffer int n = raf.readIntUnbuffered(4); if (n == this.numrecs) return false; if (n < 0) // streaming return false; // update everything this.numrecs = n; // set it in the unlimited dimension udim.setLength(this.numrecs); // set it in all of the record variables for (Variable uvar : uvars) { uvar.resetShape(); uvar.invalidateCache(); } return true; }
public boolean syncExtend() throws IOException { //unlocked = false; if (agg != null) return agg.syncExtend(); // synch orgFile if it has an unlimited dimension if (orgFile != null) { boolean wasExtended = orgFile.syncExtend(); // propagate changes. LOOK rather ad-hoc if (wasExtended) { Dimension ndim = orgFile.getUnlimitedDimension(); int newLength = ndim.getLength(); Dimension udim = getUnlimitedDimension(); udim.setLength(newLength); for (Variable v : getVariables()) { if (v.isUnlimited()) // set it in all of the record variables v.setDimensions(v.getDimensions()); } return true; } } return false; }
public boolean syncExtend() throws IOException { //unlocked = false; if (agg != null) return agg.syncExtend(); // synch orgFile if it has an unlimited dimension if (orgFile != null) { boolean wasExtended = orgFile.syncExtend(); // propagate changes. LOOK rather ad-hoc if (wasExtended) { Dimension ndim = orgFile.getUnlimitedDimension(); int newLength = ndim.getLength(); Dimension udim = getUnlimitedDimension(); udim.setLength(newLength); for (Variable v : getVariables()) { if (v.isUnlimited()) // set it in all of the record variables v.setDimensions(v.getDimensions()); } return true; } } return false; }