|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.nc2.Variable
ucar.nc2.dataset.VariableDS
public class VariableDS
An wrapper around a Variable, creating an "enhanced" Variable. The original Variable is used for the I/O. There are several distinct uses:
NetcdfDataset
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ucar.nc2.Variable |
---|
Variable.Cache |
Field Summary | |
---|---|
protected DataType |
orgDataType
|
protected String |
orgName
|
protected Variable |
orgVar
|
Fields inherited from class ucar.nc2.Variable |
---|
attributes, cache, dataType, debugCaching, defaultCoordsSizeToCache, defaultSizeToCache, dimensions, elementSize, group, hashCode, isMetadata, isVariableLength, ncfile, parent, proxyReader, shape, shapeAsSection, shortName, sizeToCache, spiObject |
Constructor Summary | |
---|---|
|
VariableDS(Group group,
Structure parent,
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,
String shortName,
DataType dataType,
String dims,
String units,
String desc)
Constructor when there's no underlying variable. |
protected |
VariableDS(VariableDS vds,
boolean isCopy)
Copy constructor, for subclasses. |
Method Summary | |
---|---|
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(Set<NetcdfDataset.Enhance> mode)
DO NOT USE DIRECTLY. |
List<CoordinateSystem> |
getCoordinateSystems()
Get the list of Coordinate Systems for this Variable. |
String |
getDescription()
Get the description of the Variable. |
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. |
String |
getOriginalName()
When this wraps another Variable, get the original Variable's name. |
Variable |
getOriginalVariable()
A VariableDS usually wraps another Variable. |
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 |
String |
lookupEnumString(int val)
Lookup the enum string for this value. |
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 |
String |
setName(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(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(Formatter f)
public for debugging |
String |
toStringDebug()
String representation of Variable and its attributes. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ucar.nc2.VariableSimpleIF |
---|
getName |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Field Detail |
---|
protected Variable orgVar
protected DataType orgDataType
protected String orgName
Constructor Detail |
---|
public VariableDS(NetcdfDataset ds, Group group, Structure parentStructure, String shortName, DataType dataType, String dims, String units, 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, 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()Method Detail |
---|
protected Variable copy()
copy
in class Variable
public void clearCoordinateSystems()
clearCoordinateSystems
in interface VariableEnhanced
public void enhance(Set<NetcdfDataset.Enhance> mode)
enhance
in interface VariableEnhanced
public 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 List<CoordinateSystem> getCoordinateSystems()
Enhancements
getCoordinateSystems
in interface Enhancements
public String getDescription()
Variable
getDescription
in interface Enhancements
getDescription
in interface VariableIF
getDescription
in interface VariableSimpleIF
getDescription
in class Variable
public String getUnitsString()
Variable
getUnitsString
in interface Enhancements
getUnitsString
in interface VariableIF
getUnitsString
in interface VariableSimpleIF
getUnitsString
in class Variable
public void setUnitsString(String units)
VariableEnhanced
setUnitsString
in interface VariableEnhanced
units
- unit stringpublic Array convertScaleOffsetMissing(Array data)
EnhanceScaleMissing
convertScaleOffsetMissing
in interface EnhanceScaleMissing
data
- convert this
public 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 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 EnhanceScaleMissing
val
- unpacked value
public boolean isMissingFast(double val)
EnhanceScaleMissing
isMissingFast
in interface EnhanceScaleMissing
val
- unpacked value
public 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 String getOriginalName()
getOriginalName
in interface VariableEnhanced
public String lookupEnumString(int val)
Variable
lookupEnumString
in class Variable
val
- the integer value of this enum
public String setName(String newName)
Variable
setName
in class Variable
newName
- set to this value
public String toStringDebug()
Variable
toStringDebug
in interface VariableIF
toStringDebug
in class Variable
public boolean hasCachedDataRecurse()
public void setCaching(boolean caching)
Variable
setCaching
in class Variable
caching
- set if caching.protected Array _read() throws IOException
_read
in class Variable
IOException
public Array reallyRead(Variable client, CancelTask cancelTask) throws IOException
Variable
reallyRead
in interface ProxyReader
reallyRead
in class Variable
client
- the client VariablecancelTask
- user may cancel
IOException
- on errorprotected Array _read(Section section) throws IOException, InvalidRangeException
_read
in class Variable
IOException
InvalidRangeException
public Array reallyRead(Variable client, Section section, CancelTask cancelTask) throws IOException, InvalidRangeException
Variable
reallyRead
in interface ProxyReader
reallyRead
in class Variable
client
- the client Variablesection
- the section of data to read.cancelTask
- user may cancel
IOException
- on error
InvalidRangeException
- if section has incorrect rank or illegal shape.public Array getMissingDataArray(int[] shape)
shape
- of this shape
public void showScaleMissingProxy(Formatter f)
f
- put info hereprotected Array convertEnums(Array values)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |