public class VariableDS extends Variable implements VariableEnhanced, EnhanceScaleMissingUnsigned
NetcdfDataset
Modifier and Type | Class and Description |
---|---|
static class |
VariableDS.Builder<T extends VariableDS.Builder<T>> |
defaultCoordsSizeToCache, defaultSizeToCache, permitCaching
Constructor and Description |
---|
VariableDS(Group group,
Structure parent,
String shortName,
Variable orgVar)
Deprecated.
Use NetcdfDataset.builder()
|
VariableDS(Group g,
Variable orgVar,
boolean enhance)
Deprecated.
Use NetcdfDataset.builder()
|
VariableDS(NetcdfDataset ds,
Group group,
Structure parentStructure,
String shortName,
DataType dataType,
String dims,
String units,
String desc)
Deprecated.
Use NetcdfDataset.builder()
|
Modifier and Type | Method and Description |
---|---|
void |
addCoordinateSystem(CoordinateSystem cs)
Deprecated.
Use VariableDS.builder()
|
boolean |
addEnhancement(NetcdfDataset.Enhance enhancement)
Deprecated.
Use NetcdfDataset.builder()
|
Array |
applyScaleOffset(Array data)
Apply scale and offset to each element of
in and return the result as a new Array, but only if
EnhanceScaleMissingUnsigned.hasScaleOffset() . |
double |
applyScaleOffset(Number value)
Apply scale and offset to the specified value if
EnhanceScaleMissingUnsigned.hasScaleOffset() . |
static VariableDS.Builder<?> |
builder()
Get Builder for this class that allows subclassing.
|
void |
clearCoordinateSystems()
Deprecated.
Use NetcdfDataset.builder()
|
Array |
convert(Array in,
boolean convertUnsigned,
boolean applyScaleOffset,
boolean convertMissing)
Perform the specified conversions on each element of
in and return the result as a new Array. |
Array |
convertMissing(Array in)
|
Number |
convertMissing(Number value)
|
Array |
convertUnsigned(Array in)
Performs an
unsigned conversion of each element of in and returns the
result as a new Array. |
Number |
convertUnsigned(Number value)
Convert
value to the next largest integral data type by an unsigned conversion . |
void |
enhance(Set<NetcdfDataset.Enhance> enhancements)
Deprecated.
Use NetcdfDataset.builder()
|
List<CoordinateSystem> |
getCoordinateSystems()
Get the list of Coordinate Systems for this Variable.
|
String |
getDatasetLocation()
The location of the dataset this belongs to.
|
String |
getDescription()
Get the description of the Variable.
|
Set<NetcdfDataset.Enhance> |
getEnhanceMode()
Returns the enhancements applied to this variable.
|
double |
getFillValue()
return value of _FillValue attribute
|
Array |
getMissingDataArray(int[] shape)
Return Array with missing data
|
double[] |
getMissingValues()
return values of missing_value attributes
|
NetcdfFile |
getNetcdfFile()
Get the NetcdfFile that this variable is contained in.
|
double |
getOffset()
The number to be added to the data after it is read.
|
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.
|
DataType |
getScaledOffsetType()
Return the data type for values that have undergone scale/offset conversion.
|
double |
getScaleFactor()
The data are to be multiplied by this value after the data are read.
|
DataType.Signedness |
getSignedness()
Returns the signedness of the decorated variable.
|
String |
getUnitsString()
Get the Unit String for the Variable.
|
DataType |
getUnsignedConversionType()
Return the data type for values that have undergone unsigned conversion.
|
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 |
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 offset
|
boolean |
hasValidData()
true if Variable has valid_range, valid_min or valid_max attributes
|
boolean |
isFillValue(double val)
return true if val equals the _FillValue
|
boolean |
isInvalidData(double val)
return true if val is outside the valid range
|
boolean |
isMissing(double val)
Returns
true if the argument is a missing value. |
boolean |
isMissingValue(double val)
return true if val equals a missing_value (low-level)
|
String |
lookupEnumString(int val)
Lookup the enum string for this value.
|
long |
readToStream(Section section,
OutputStream out)
Read variable data to a stream.
|
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 cs)
Deprecated.
Use VariableDS.builder()
|
boolean |
removeEnhancement(NetcdfDataset.Enhance enhancement)
Deprecated.
Use NetcdfDataset.builder()
|
void |
setCaching(boolean caching)
Deprecated.
Use NetcdfDataset.builder()
|
void |
setFillValueIsMissing(boolean b)
Deprecated.
Use NetcdfDataset.builder()
|
void |
setInvalidDataIsMissing(boolean b)
Deprecated.
Use NetcdfDataset.builder()
|
void |
setMissingDataIsMissing(boolean b)
Deprecated.
Use NetcdfDataset.builder()
|
String |
setName(String newName)
Deprecated.
Use NetcdfDataset.builder()
|
void |
setOriginalVariable(Variable orgVar)
Deprecated.
Use NetcdfDataset.builder()
|
void |
setUnitsString(String units)
Deprecated.
Use NetcdfDataset.builder()
|
void |
showScaleMissingProxy(Formatter f)
public for debugging
|
VariableDS.Builder<?> |
toBuilder()
Turn into a mutable Builder.
|
String |
toStringDebug()
String representation of Variable and its attributes.
|
addAll, addAttribute, attributes, compareTo, createNewCache, equals, findAttribute, findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, findAttValueIgnoreCase, findDimensionIndex, getAttributes, getDAPName, getDAPName, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getElementSize, getEnumTypedef, getFileTypeId, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getParentGroup, getProxyReader, getRanges, getRank, getShape, getShape, getShapeAll, getShapeAsSection, getSize, getSizeToCache, getSPobject, hasCachedData, hashCode, invalidateCache, isCaching, isCoordinateVariable, isImmutable, isMetadata, isScalar, isUnknownLength, isUnlimited, 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, setValues, setValues, slice, toString, writeCDL
annotate, annotation, getDODSName, getFullName, getFullNameEscaped, getGroup, getImmutable, getName, getParentStructure, getShortName, getSort, isMemberOfStructure, localhash, setDODSName, setParentStructure, setShortName, setSort, unwrap
getFullName, getShortName
getFullName, getName, getShortName
getName, hasAttribute, iterator
forEach, spliterator
@Deprecated 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 null@Deprecated public 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.@Deprecated 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.public NetcdfFile getNetcdfFile()
Variable
getNetcdfFile
in class Variable
@Deprecated public void clearCoordinateSystems()
clearCoordinateSystems
in interface VariableEnhanced
@Deprecated public void enhance(Set<NetcdfDataset.Enhance> enhancements)
enhance
in interface VariableEnhanced
public Set<NetcdfDataset.Enhance> getEnhanceMode()
@Deprecated public boolean addEnhancement(NetcdfDataset.Enhance enhancement)
enhancement
to this variable. It may result in a change of data type.enhancement
- the enhancement to add.true
if the set of enhancements changed as a result of the call.@Deprecated public boolean removeEnhancement(NetcdfDataset.Enhance enhancement)
enhancement
from this variable. It may result in a change of data type.enhancement
- the enhancement to remove.true
if the set of enhancements changed as a result of the call.public Variable getOriginalVariable()
getOriginalVariable
in interface VariableEnhanced
@Deprecated 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@Deprecated public String setName(String newName)
Variable
public String toStringDebug()
Variable
toStringDebug
in class Variable
public String getDatasetLocation()
Variable
getDatasetLocation
in class Variable
public boolean hasCachedDataRecurse()
@Deprecated public void setCaching(boolean caching)
Variable
setCaching
in class Variable
caching
- set if caching.public Array reallyRead(Variable client, CancelTask cancelTask) throws IOException
Variable
reallyRead
in interface ProxyReader
reallyRead
in class Variable
client
- the client VariablecancelTask
- user may cancelIOException
- on errorpublic 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 cancelIOException
- on errorInvalidRangeException
- if section has incorrect rank or illegal shape.public long readToStream(Section section, OutputStream out) throws IOException, InvalidRangeException
Variable
readToStream
in class Variable
IOException
InvalidRangeException
public Array getMissingDataArray(int[] shape)
shape
- of this shapepublic void showScaleMissingProxy(Formatter f)
f
- put info herepublic String getDescription()
Variable
getDescription
in interface Enhancements
getDescription
in interface VariableSimpleIF
getDescription
in class Variable
public String getUnitsString()
Variable
getUnitsString
in interface Enhancements
getUnitsString
in interface VariableSimpleIF
getUnitsString
in class Variable
@Deprecated public void setUnitsString(String units)
VariableEnhanced
setUnitsString
in interface VariableEnhanced
units
- unit stringpublic List<CoordinateSystem> getCoordinateSystems()
Enhancements
getCoordinateSystems
in interface Enhancements
@Deprecated public void addCoordinateSystem(CoordinateSystem cs)
Enhancements
addCoordinateSystem
in interface Enhancements
cs
- add this Coordinate System@Deprecated public void removeCoordinateSystem(CoordinateSystem cs)
Enhancements
removeCoordinateSystem
in interface Enhancements
cs
- remove this coordinate systempublic boolean hasScaleOffset()
EnhanceScaleMissingUnsigned
hasScaleOffset
in interface EnhanceScaleMissingUnsigned
public double getScaleFactor()
EnhanceScaleMissingUnsigned
1.0
, i.e. no
scaling. It will remain that value if the variable defines no CDM.SCALE_FACTOR
attribute.getScaleFactor
in interface EnhanceScaleMissingUnsigned
public double getOffset()
EnhanceScaleMissingUnsigned
CDM.SCALE_FACTOR
and
CDM.ADD_OFFSET
attributes are present, the data are first scaled before the offset is
added. By default it is 0.0
, i.e. no offset. It will remain that value if the variable defines no
CDM.SCALE_FACTOR
attribute.getOffset
in interface EnhanceScaleMissingUnsigned
public boolean hasMissing()
EnhanceScaleMissingUnsigned
hasMissing
in interface IsMissingEvaluator
hasMissing
in interface EnhanceScaleMissingUnsigned
public boolean isMissing(double val)
EnhanceScaleMissingUnsigned
true
if the argument is a missing value.
Note that Float.NaN
and Double.NaN
are considered missing data.isMissing
in interface IsMissingEvaluator
isMissing
in interface EnhanceScaleMissingUnsigned
val
- an unpacked value.true
if the argument is a missing value.public boolean hasValidData()
EnhanceScaleMissingUnsigned
hasValidData
in interface EnhanceScaleMissingUnsigned
public double getValidMin()
EnhanceScaleMissingUnsigned
getValidMin
in interface EnhanceScaleMissingUnsigned
public double getValidMax()
EnhanceScaleMissingUnsigned
getValidMax
in interface EnhanceScaleMissingUnsigned
public boolean isInvalidData(double val)
EnhanceScaleMissingUnsigned
isInvalidData
in interface EnhanceScaleMissingUnsigned
public boolean hasFillValue()
EnhanceScaleMissingUnsigned
hasFillValue
in interface EnhanceScaleMissingUnsigned
public double getFillValue()
EnhanceScaleMissingUnsigned
getFillValue
in interface EnhanceScaleMissingUnsigned
public boolean isFillValue(double val)
EnhanceScaleMissingUnsigned
isFillValue
in interface EnhanceScaleMissingUnsigned
public boolean hasMissingValue()
EnhanceScaleMissingUnsigned
hasMissingValue
in interface EnhanceScaleMissingUnsigned
public double[] getMissingValues()
EnhanceScaleMissingUnsigned
getMissingValues
in interface EnhanceScaleMissingUnsigned
public boolean isMissingValue(double val)
EnhanceScaleMissingUnsigned
isMissingValue
in interface EnhanceScaleMissingUnsigned
@Deprecated public void setFillValueIsMissing(boolean b)
EnhanceScaleMissingUnsigned
setFillValueIsMissing
in interface EnhanceScaleMissingUnsigned
@Deprecated public void setInvalidDataIsMissing(boolean b)
EnhanceScaleMissingUnsigned
setInvalidDataIsMissing
in interface EnhanceScaleMissingUnsigned
@Deprecated public void setMissingDataIsMissing(boolean b)
EnhanceScaleMissingUnsigned
setMissingDataIsMissing
in interface EnhanceScaleMissingUnsigned
@Nullable public DataType getScaledOffsetType()
EnhanceScaleMissingUnsigned
null
if the
decorated variable lacks scale_factor
or add_offset
attributes. You can check with
EnhanceScaleMissingUnsigned.hasScaleOffset()
.getScaledOffsetType
in interface EnhanceScaleMissingUnsigned
public DataType getUnsignedConversionType()
EnhanceScaleMissingUnsigned
null
, even
when no unsigned conversion is necessary (because the underlying variable isn't unsigned). In such cases, this
data type will be the same as that of the underlying variable.getUnsignedConversionType
in interface EnhanceScaleMissingUnsigned
public DataType.Signedness getSignedness()
EnhanceScaleMissingUnsigned
getSignedness
in interface EnhanceScaleMissingUnsigned
public double applyScaleOffset(Number value)
EnhanceScaleMissingUnsigned
EnhanceScaleMissingUnsigned.hasScaleOffset()
. Otherwise, just return value
.applyScaleOffset
in interface EnhanceScaleMissingUnsigned
public Array applyScaleOffset(Array data)
EnhanceScaleMissingUnsigned
in
and return the result as a new Array, but only if
EnhanceScaleMissingUnsigned.hasScaleOffset()
. Otherwise, just return value
. Otherwise, just return data
.applyScaleOffset
in interface EnhanceScaleMissingUnsigned
data
- convert thispublic Number convertUnsigned(Number value)
EnhanceScaleMissingUnsigned
value
to the next largest integral data type by an unsigned conversion
. The conversion only happens if the decorated variable is unsigned
and value
is a negative integer. Otherwise, simply return value
.convertUnsigned
in interface EnhanceScaleMissingUnsigned
value
- an integral number to convert.value
.public Array convertUnsigned(Array in)
EnhanceScaleMissingUnsigned
unsigned conversion
of each element of in
and returns the
result as a new Array. The data type of the returned array will be EnhanceScaleMissingUnsigned.getUnsignedConversionType()
.convertUnsigned
in interface EnhanceScaleMissingUnsigned
in
- an Array containing integral Numbers to convert.in
.public Number convertMissing(Number value)
EnhanceScaleMissingUnsigned
convertMissing
in interface EnhanceScaleMissingUnsigned
public Array convertMissing(Array in)
EnhanceScaleMissingUnsigned
convertMissing
in interface EnhanceScaleMissingUnsigned
in
- an array containing floating-point numbers to convert.in
.public Array convert(Array in, boolean convertUnsigned, boolean applyScaleOffset, boolean convertMissing)
EnhanceScaleMissingUnsigned
in
and return the result as a new Array.
Note that this method is more efficient than calling EnhanceScaleMissingUnsigned.convertUnsigned(Array)
, followed by
EnhanceScaleMissingUnsigned.applyScaleOffset(Array)
, followed by EnhanceScaleMissingUnsigned.convertMissing(Array)
, as only one copy of in
is
made.convert
in interface EnhanceScaleMissingUnsigned
in
- a numeric array.convertUnsigned
- true
if we should convert unsigned
.applyScaleOffset
- true
if we should apply scale/offset
.convertMissing
- true
if we should convert missing
.public VariableDS.Builder<?> toBuilder()
Variable
public static VariableDS.Builder<?> builder()