public class VariableDS extends Variable implements VariableEnhanced, EnhanceScaleMissing
NetcdfDataset
Variable.Cache
Modifier and Type | Field and Description |
---|---|
protected DataType |
orgDataType |
protected java.lang.String |
orgName |
protected Variable |
orgVar |
attributes, cache, dataType, debugCaching, defaultCoordsSizeToCache, defaultSizeToCache, dimensions, elementSize, hashCode, isMetadata, isVariableLength, ncfile, permitCaching, proxyReader, shape, shapeAsSection, sizeToCache, spiObject
annotations, dodsname, group, immutable, parentstruct, shortName, sort
Modifier | Constructor and Description |
---|---|
|
VariableDS(Group group,
Structure parent,
java.lang.String shortName,
Variable orgVar)
Make a new VariableDS, delegate data reading to the original variable, but otherwise
dont take any info from it.
|
|
VariableDS(Group g,
Variable orgVar,
boolean enhance)
Wrap the given Variable, making it into a VariableDS.
|
|
VariableDS(NetcdfDataset ds,
Group group,
Structure parentStructure,
java.lang.String shortName,
DataType dataType,
java.lang.String dims,
java.lang.String units,
java.lang.String desc)
Constructor when there's no underlying variable.
|
protected |
VariableDS(VariableDS vds,
boolean isCopy)
Copy constructor, for subclasses.
|
Modifier and Type | Method and Description |
---|---|
protected Array |
_read() |
protected Array |
_read(Section section) |
void |
addCoordinateSystem(CoordinateSystem p0)
Add a CoordinateSystem to the dataset.
|
void |
clearCoordinateSystems()
Remove coordinate system info.
|
protected Array |
convertEnums(Array values) |
Array |
convertScaleOffsetMissing(Array data)
Convert data if hasScaleOffset, using scale and offset.
|
double |
convertScaleOffsetMissing(byte value)
Convert this byte value to a double, using scale/offset/missing value if applicable
|
double |
convertScaleOffsetMissing(double value)
Convert this double value using scale/offset/missing value if applicable
|
double |
convertScaleOffsetMissing(int value)
Convert this int value to a double, using scale/offset/missing value if applicable
|
double |
convertScaleOffsetMissing(long value)
Convert this long value to a double, using scale/offset/missing value if applicable
|
double |
convertScaleOffsetMissing(short value)
Convert this short value to a double, using scale/offset/missing value if applicable
|
protected Variable |
copy() |
void |
enhance(java.util.Set<NetcdfDataset.Enhance> mode)
DO NOT USE DIRECTLY.
|
java.util.List<CoordinateSystem> |
getCoordinateSystems()
Get the list of Coordinate Systems for this Variable.
|
java.lang.String |
getDatasetLocation() |
java.lang.String |
getDescription()
Get the description of the Variable.
|
java.util.EnumSet<NetcdfDataset.Enhance> |
getEnhanceMode()
Get the enhancement mode
|
Array |
getMissingDataArray(int[] shape)
Return Array with missing data
|
DataType |
getOriginalDataType()
When this wraps another Variable, get the original Variable's DataType.
|
java.lang.String |
getOriginalName()
When this wraps another Variable, get the original Variable's name.
|
Variable |
getOriginalVariable()
A VariableDS usually wraps another Variable.
|
java.lang.String |
getUnitsString()
Get the Unit String for the Variable.
|
boolean |
getUseNaNs()
get whether to use NaNs for missing float/double values (for efficiency)
|
double |
getValidMax()
return the maximum value in the valid range
|
double |
getValidMin()
return the minimum value in the valid range
|
boolean |
hasCachedDataRecurse() |
boolean |
hasFillValue()
true if Variable has _FillValue attribute
|
boolean |
hasInvalidData()
true if Variable has valid_range, valid_min or valid_max attributes
|
boolean |
hasMissing()
true if Variable has missing data values
|
boolean |
hasMissingValue()
true if Variable has missing_value attribute
|
boolean |
hasScaleOffset()
true if Variable data will be converted using scale and offet
|
boolean |
isFillValue(double p0)
return true if val equals the _FillValue
|
boolean |
isInvalidData(double p0)
return true if val is outside the valid range
|
boolean |
isMissing(double val)
true if val is a missing data value.
|
boolean |
isMissingFast(double val)
true if val is a missing data value.
|
boolean |
isMissingValue(double p0)
return true if val equals a missing_value
|
java.lang.String |
lookupEnumString(int val)
Lookup the enum string for this value.
|
long |
readToStream(Section section,
java.io.OutputStream out) |
Array |
reallyRead(Variable client,
CancelTask cancelTask)
public by accident, do not call directly.
|
Array |
reallyRead(Variable client,
Section section,
CancelTask cancelTask)
public by accident, do not call directly.
|
void |
removeCoordinateSystem(CoordinateSystem p0)
Remove a CoordinateSystem from the dataset.
|
void |
setCaching(boolean caching)
Set whether to cache or not.
|
void |
setFillValueIsMissing(boolean p0)
set if _FillValue is considered isMissing(); better set in constructor if possible
|
void |
setInvalidDataIsMissing(boolean p0)
set if valid_range is considered isMissing(); better set in constructor if possible
|
void |
setMissingDataIsMissing(boolean p0)
set if missing_data is considered isMissing(); better set in constructor if possible
|
java.lang.String |
setName(java.lang.String newName)
Set the short name, converting to valid CDM object name if needed.
|
void |
setOriginalVariable(Variable orgVar)
Set the Variable to wrap.
|
void |
setUnitsString(java.lang.String units)
Set the Unit String for this Variable.
|
void |
setUseNaNs(boolean useNaNs)
set whether to use NaNs for missing float/double values, for efficiency
|
void |
showScaleMissingProxy(java.util.Formatter f)
public for debugging
|
java.lang.String |
toStringDebug()
String representation of Variable and its attributes.
|
addAll, addAttribute, compareTo, createNewCache, equals, extraInfo, findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getDAPName, getDAPName, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getElementSize, getEnumTypedef, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNetcdfFile, getParentGroup, getProxyReader, getRanges, getRank, getScalarData, getShape, getShape, getShapeAll, getShapeAsSection, getShapeNotScalar, getSize, getSizeToCache, getSPobject, hasCachedData, hashCode, hashCodeShow, invalidateCache, isCaching, isCoordinateVariable, isImmutable, isMetadata, isScalar, isUnknownLength, isUnlimited, isUnsigned, isVariableLength, read, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, readToByteChannel, reduce, remove, removeAttribute, removeAttributeIgnoreCase, resetDimensions, resetShape, section, section, setCachedData, setCachedData, setDataType, setDimension, setDimensions, setDimensions, setDimensionsAnonymous, setElementSize, setEnumTypedef, setImmutable, setIsScalar, setParentGroup, setProxyReader, setSizeToCache, setSPobject, setUnsigned, setValues, setValues, slice, toString, writeCDL, writeCDL
annotate, getAnnotation, getAnnotations, getDODSName, getFullName, getFullNameEscaped, getGroup, getImmutable, getName, getParentStructure, getShortName, getSort, isMemberOfStructure, localhash, setDODSName, setImmutable, setParentStructure, setShortName, setSort, unwrap
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getDataType, getDimension, getDimensions, getDimensionsAll, getElementSize, getEnumTypedef, getFullName, getFullNameEscaped, getNameAndDimensions, getParentGroup, getParentStructure, getRanges, getRank, getShape, getShapeAsSection, getShortName, getSize, isCoordinateVariable, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isUnsigned, isVariableLength, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, section
getName
protected Variable orgVar
protected DataType orgDataType
protected java.lang.String orgName
public VariableDS(NetcdfDataset ds, Group group, Structure parentStructure, java.lang.String shortName, DataType dataType, java.lang.String dims, java.lang.String units, java.lang.String desc)
ds
- the containing datasetgroup
- the containing groupparentStructure
- the containing Structure (may be null)shortName
- the (short) namedataType
- the data typedims
- list of dimension names, these must already exist in the Group; empty String = scalarunits
- String value of units, may be nulldesc
- String value of description, may be nullpublic VariableDS(Group group, Structure parent, java.lang.String shortName, Variable orgVar)
group
- the containing group; may not be nullparent
- parent Structure, may be nullshortName
- variable shortName, must be unique within the GrouporgVar
- the original Variable to wrap. The original Variable is not modified.
Must not be a Structure, use StructureDS instead.public VariableDS(Group g, Variable orgVar, boolean enhance)
g
- logical container, if null use orgVar's grouporgVar
- the original Variable to wrap. The original Variable is not modified.
Must not be a Structure, use StructureDS instead.enhance
- if true, use NetcdfDataset.defaultEnhanceMode to define what enhancements are made.
Note that this can change DataType and data values.
You can also call enhance() later. If orgVar is VariableDS, then enhance is inherited from there,
and this parameter is ignored.protected VariableDS(VariableDS vds, boolean isCopy)
vds
- copy from here.isCopy
- called from copy()public void clearCoordinateSystems()
clearCoordinateSystems
in interface VariableEnhanced
public void enhance(java.util.Set<NetcdfDataset.Enhance> mode)
enhance
in interface VariableEnhanced
public java.util.EnumSet<NetcdfDataset.Enhance> getEnhanceMode()
public void addCoordinateSystem(CoordinateSystem p0)
Enhancements
addCoordinateSystem
in interface Enhancements
p0
- add this Coordinate Systempublic void removeCoordinateSystem(CoordinateSystem p0)
Enhancements
removeCoordinateSystem
in interface Enhancements
p0
- remove this coordinate systempublic java.util.List<CoordinateSystem> getCoordinateSystems()
Enhancements
getCoordinateSystems
in interface Enhancements
public java.lang.String getDescription()
Variable
getDescription
in interface Enhancements
getDescription
in interface VariableIF
getDescription
in interface VariableSimpleIF
getDescription
in class Variable
public java.lang.String getUnitsString()
Variable
getUnitsString
in interface Enhancements
getUnitsString
in interface VariableIF
getUnitsString
in interface VariableSimpleIF
getUnitsString
in class Variable
public void setUnitsString(java.lang.String units)
VariableEnhanced
setUnitsString
in interface VariableEnhanced
units
- unit stringpublic Array convertScaleOffsetMissing(Array data)
EnhanceScaleMissing
convertScaleOffsetMissing
in interface EnhanceScaleMissing
data
- convert thispublic double getValidMax()
EnhanceScaleMissing
getValidMax
in interface EnhanceScaleMissing
public double getValidMin()
EnhanceScaleMissing
getValidMin
in interface EnhanceScaleMissing
public boolean hasFillValue()
EnhanceScaleMissing
hasFillValue
in interface EnhanceScaleMissing
public boolean hasInvalidData()
EnhanceScaleMissing
hasInvalidData
in interface EnhanceScaleMissing
public boolean hasMissing()
EnhanceScaleMissing
hasMissing
in interface IsMissingEvaluator
hasMissing
in interface EnhanceScaleMissing
public boolean hasMissingValue()
EnhanceScaleMissing
hasMissingValue
in interface EnhanceScaleMissing
public boolean hasScaleOffset()
EnhanceScaleMissing
hasScaleOffset
in interface EnhanceScaleMissing
public boolean isFillValue(double p0)
EnhanceScaleMissing
isFillValue
in interface EnhanceScaleMissing
public boolean isInvalidData(double p0)
EnhanceScaleMissing
isInvalidData
in interface EnhanceScaleMissing
public boolean isMissing(double val)
EnhanceScaleMissing
isMissing
in interface IsMissingEvaluator
isMissing
in interface EnhanceScaleMissing
val
- unpacked valuepublic boolean isMissingFast(double val)
EnhanceScaleMissing
isMissingFast
in interface EnhanceScaleMissing
val
- unpacked valuepublic boolean isMissingValue(double p0)
EnhanceScaleMissing
isMissingValue
in interface EnhanceScaleMissing
public void setFillValueIsMissing(boolean p0)
EnhanceScaleMissing
setFillValueIsMissing
in interface EnhanceScaleMissing
public void setInvalidDataIsMissing(boolean p0)
EnhanceScaleMissing
setInvalidDataIsMissing
in interface EnhanceScaleMissing
public void setMissingDataIsMissing(boolean p0)
EnhanceScaleMissing
setMissingDataIsMissing
in interface EnhanceScaleMissing
public void setUseNaNs(boolean useNaNs)
EnhanceScaleMissing
setUseNaNs
in interface EnhanceScaleMissing
public boolean getUseNaNs()
EnhanceScaleMissing
getUseNaNs
in interface EnhanceScaleMissing
public double convertScaleOffsetMissing(byte value)
EnhanceScaleMissing
convertScaleOffsetMissing
in interface EnhanceScaleMissing
public double convertScaleOffsetMissing(short value)
EnhanceScaleMissing
convertScaleOffsetMissing
in interface EnhanceScaleMissing
public double convertScaleOffsetMissing(int value)
EnhanceScaleMissing
convertScaleOffsetMissing
in interface EnhanceScaleMissing
public double convertScaleOffsetMissing(long value)
EnhanceScaleMissing
convertScaleOffsetMissing
in interface EnhanceScaleMissing
public double convertScaleOffsetMissing(double value)
EnhanceScaleMissing
convertScaleOffsetMissing
in interface EnhanceScaleMissing
public Variable getOriginalVariable()
getOriginalVariable
in interface VariableEnhanced
public void setOriginalVariable(Variable orgVar)
setOriginalVariable
in interface VariableEnhanced
orgVar
- original Variable, must not be a Structurepublic DataType getOriginalDataType()
public java.lang.String getOriginalName()
getOriginalName
in interface VariableEnhanced
public java.lang.String lookupEnumString(int val)
Variable
lookupEnumString
in class Variable
val
- the integer value of this enumpublic java.lang.String setName(java.lang.String newName)
Variable
public java.lang.String toStringDebug()
Variable
toStringDebug
in interface VariableIF
toStringDebug
in class Variable
public java.lang.String getDatasetLocation()
getDatasetLocation
in class Variable
public boolean hasCachedDataRecurse()
public void setCaching(boolean caching)
Variable
setCaching
in class Variable
caching
- set if caching.protected Array _read() throws java.io.IOException
public Array reallyRead(Variable client, CancelTask cancelTask) throws java.io.IOException
Variable
reallyRead
in interface ProxyReader
reallyRead
in class Variable
client
- the client VariablecancelTask
- user may canceljava.io.IOException
- on errorprotected Array _read(Section section) throws java.io.IOException, InvalidRangeException
_read
in class Variable
java.io.IOException
InvalidRangeException
public Array reallyRead(Variable client, Section section, CancelTask cancelTask) throws java.io.IOException, InvalidRangeException
Variable
reallyRead
in interface ProxyReader
reallyRead
in class Variable
client
- the client Variablesection
- the section of data to read.cancelTask
- user may canceljava.io.IOException
- on errorInvalidRangeException
- if section has incorrect rank or illegal shape.public long readToStream(Section section, java.io.OutputStream out) throws java.io.IOException, InvalidRangeException
readToStream
in class Variable
java.io.IOException
InvalidRangeException
public Array getMissingDataArray(int[] shape)
shape
- of this shapepublic void showScaleMissingProxy(java.util.Formatter f)
f
- put info here