/** * Copy constructor, for subclasses. * Used by copy() and CoordinateAxis * Share everything except the coord systems. * * @param vds copy from here. * @param isCopy called from copy() */ protected VariableDS(VariableDS vds, boolean isCopy) { super(vds); this.orgVar = vds; this.orgDataType = vds.orgDataType; this.orgName = vds.orgName; this.enhanceProxy = new EnhancementsImpl(this); //decouple coordinate systems this.scaleMissingUnsignedProxy = vds.scaleMissingUnsignedProxy; if (!isCopy) { createNewCache(); // dont share cache unless its a copy } }
/** * Copy constructor, for subclasses. * Used by copy() and CoordinateAxis * Share everything except the coord systems. * @param vds copy from here. * @param isCopy called from copy() */ protected VariableDS( VariableDS vds, boolean isCopy) { super(vds); this.orgVar = vds; this.orgDataType = vds.orgDataType; this.orgName = vds.orgName; this.scaleMissingProxy = vds.scaleMissingProxy; this.enhanceProxy = new EnhancementsImpl( this); //decouple coordinate systems this.enhanceMode = vds.enhanceMode; if (isCopy) { // enhancement done in orgVar //this.needScaleOffsetMissing = vds.needScaleOffsetMissing; //this.needEnumConversion = vds.needEnumConversion; } else { createNewCache(); // dont share cache unless its a copy } }
/** * Copy constructor, for subclasses. * Used by copy() and CoordinateAxis * Share everything except the coord systems. * @param vds copy from here. * @param isCopy called from copy() */ protected VariableDS( VariableDS vds, boolean isCopy) { super(vds); this.orgVar = vds; this.orgDataType = vds.orgDataType; this.orgName = vds.orgName; this.scaleMissingProxy = vds.scaleMissingProxy; this.enhanceProxy = new EnhancementsImpl( this); //decouple coordinate systems this.enhanceMode = vds.enhanceMode; if (isCopy) { // enhancement done in orgVar //this.needScaleOffsetMissing = vds.needScaleOffsetMissing; //this.needEnumConversion = vds.needEnumConversion; } else { createNewCache(); // dont share cache unless its a copy } }
/** * Make a new VariableDS, delegate data reading to the original variable, but otherwise * dont take any info from it. This is used by NcML explicit mode. * * @param group the containing group; may not be null * @param parent parent Structure, may be null * @param shortName variable shortName, must be unique within the Group * @param orgVar the original Variable to wrap. The original Variable is not modified. * Must not be a Structure, use StructureDS instead. */ public VariableDS(Group group, Structure parent, String shortName, Variable orgVar) { super(null, group, parent, shortName); setDimensions(getDimensionsString()); // reset the dimensions if (orgVar instanceof Structure) throw new IllegalArgumentException("VariableDS must not wrap a Structure; name=" + orgVar.getFullName()); // dont share cache, iosp : all IO is delegated this.ncfile = null; this.spiObject = null; createNewCache(); this.orgVar = orgVar; this.orgDataType = orgVar.getDataType(); this.enhanceProxy = new EnhancementsImpl(this); }
/** * Make a new VariableDS, delegate data reading to the original variable, but otherwise * dont take any info from it. This is used by NcML explicit mode. * * @param group the containing group; may not be null * @param parent parent Structure, may be null * @param shortName variable shortName, must be unique within the Group * @param orgVar the original Variable to wrap. The original Variable is not modified. * Must not be a Structure, use StructureDS instead. */ public VariableDS(Group group, Structure parent, String shortName, Variable orgVar) { super(null, group, parent, shortName); setDimensions( getDimensionsString()); // reset the dimensions if (orgVar instanceof Structure) throw new IllegalArgumentException("VariableDS must not wrap a Structure; name="+orgVar.getFullName()); // dont share cache, iosp : all IO is delegated this.ncfile = null; this.spiObject = null; createNewCache(); this.orgVar = orgVar; this.orgDataType = orgVar.getDataType(); this.enhanceProxy = new EnhancementsImpl( this); this.scaleMissingProxy = new EnhanceScaleMissingImpl(); }
/** * Make a new VariableDS, delegate data reading to the original variable, but otherwise * dont take any info from it. This is used by NcML explicit mode. * * @param group the containing group; may not be null * @param parent parent Structure, may be null * @param shortName variable shortName, must be unique within the Group * @param orgVar the original Variable to wrap. The original Variable is not modified. * Must not be a Structure, use StructureDS instead. */ public VariableDS(Group group, Structure parent, String shortName, Variable orgVar) { //coverity[FORWARD_NULL] super(null, group, parent, shortName); setDimensions( getDimensionsString()); // reset the dimensions if (orgVar instanceof Structure) throw new IllegalArgumentException("VariableDS must not wrap a Structure; name="+orgVar.getFullName()); // dont share cache, iosp : all IO is delegated this.ncfile = null; this.spiObject = null; createNewCache(); this.orgVar = orgVar; this.orgDataType = orgVar.getDataType(); this.enhanceProxy = new EnhancementsImpl( this); this.scaleMissingProxy = new EnhanceScaleMissingImpl(); }
public void readDoubleMissing() throws Exception { VariableDS v = null; assert( null != (v = (VariableDS) dsRead.findVariable("m1"))); assert( v.getDataType() == DataType.DOUBLE); Array A = v.read(); Index ima = A.getIndex(); double val = A.getFloat(ima.set(1,1)); assert Double.isNaN(val); assert v.isMissing(val); // Reread without converting missing values to NaNs. v.removeEnhancement(NetcdfDataset.Enhance.ConvertMissing); v.createNewCache(); A = v.read(); ima = A.getIndex(); val = A.getFloat(ima.set(1,1)); Assert2.assertNearlyEquals(val, -999.99); assert v.isMissing(val); }