public class VariableDS extends Variable implements VariableEnhanced, ucar.nc2.dataset.EnhanceScaleMissingUnsigned
NetcdfDataset
Modifier and Type | Class and Description |
---|---|
static class |
VariableDS.Builder<T extends VariableDS.Builder<T>> |
defaultCoordsSizeToCache, defaultSizeToCache, permitCaching
Modifier and Type | Method and Description |
---|---|
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(java.lang.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.
|
Array |
convertMissing(Array in)
Returns a copy of
in , except that each missing value is replaced by
Double.NaN . |
java.lang.Number |
convertMissing(java.lang.Number value)
If
value is missing , return Double.NaN . |
Array |
convertUnsigned(Array in)
Performs an
unsigned conversion of each element of in and returns the
result as a new Array. |
java.lang.Number |
convertUnsigned(java.lang.Number value)
Convert
value to the next largest integral data type by an unsigned conversion . |
java.lang.Number |
convertUnsigned(java.lang.Number value,
DataType dataType) |
boolean |
fillValueIsMissing() |
com.google.common.collect.ImmutableList<CoordinateSystem> |
getCoordinateSystems()
Get the list of Coordinate Systems for this Variable.
|
java.lang.String |
getDatasetLocation()
The location of the dataset this belongs to.
|
java.lang.String |
getDescription()
Get the description of the Variable.
|
java.util.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.
|
java.lang.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.
|
java.lang.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 |
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 |
invalidDataIsMissing() |
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)
|
java.lang.String |
lookupEnumString(int val)
Lookup the enum string for this value.
|
boolean |
missingDataIsMissing() |
long |
readToStream(Section section,
java.io.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 |
showScaleMissingProxy(java.util.Formatter f)
public for debugging
|
VariableDS.Builder<?> |
toBuilder()
Turn into a mutable Builder.
|
java.lang.String |
toStringDebug()
String representation of Variable and its attributes.
|
attributes, compareTo, createNewCache, equals, findAttribute, findAttributeString, findDimensionIndex, getDataType, getDimension, getDimensions, getDimensionsString, getElementSize, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentStructure, getRanges, getRank, getShape, getShape, getShapeAsSection, getSize, getSizeToCache, getSPobject, hasCachedData, hashCode, isCaching, isCoordinateVariable, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isVariableLength, read, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, reduce, section, section, slice, toString
getFullName, getShortName
addCoordinateSystem, removeCoordinateSystem
getShortName
filter, findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, getName, hasAttribute, hasAttributeIgnoreCase, isEmpty, iterator
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 ucar.nc2.dataset.EnhanceScaleMissingUnsigned
data
- convert thispublic double applyScaleOffset(java.lang.Number value)
EnhanceScaleMissingUnsigned
EnhanceScaleMissingUnsigned.hasScaleOffset()
. Otherwise, just return value
.applyScaleOffset
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public static VariableDS.Builder<?> builder()
public Array convertMissing(Array in)
EnhanceScaleMissingUnsigned
in
, except that each missing
value is replaced by
Double.NaN
.convertMissing
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
in
- an array containing floating-point numbers to convert.in
.public java.lang.Number convertMissing(java.lang.Number value)
EnhanceScaleMissingUnsigned
value
is missing
, return Double.NaN
.
Otherwise, simply return value
convertMissing
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
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 ucar.nc2.dataset.EnhanceScaleMissingUnsigned
in
- an Array containing integral Numbers to convert.in
.public java.lang.Number convertUnsigned(java.lang.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 ucar.nc2.dataset.EnhanceScaleMissingUnsigned
value
- an integral number to convert.value
.public java.lang.Number convertUnsigned(java.lang.Number value, DataType dataType)
public boolean fillValueIsMissing()
public com.google.common.collect.ImmutableList<CoordinateSystem> getCoordinateSystems()
Enhancements
getCoordinateSystems
in interface ucar.nc2.dataset.Enhancements
public java.lang.String getDatasetLocation()
Variable
getDatasetLocation
in class Variable
public java.lang.String getDescription()
Variable
getDescription
in interface ucar.nc2.dataset.Enhancements
getDescription
in interface VariableSimpleIF
getDescription
in class Variable
public java.util.Set<NetcdfDataset.Enhance> getEnhanceMode()
public double getFillValue()
EnhanceScaleMissingUnsigned
getFillValue
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public Array getMissingDataArray(int[] shape)
shape
- of this shapepublic double[] getMissingValues()
EnhanceScaleMissingUnsigned
getMissingValues
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public NetcdfFile getNetcdfFile()
Variable
getNetcdfFile
in class Variable
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 ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public DataType getOriginalDataType()
public java.lang.String getOriginalName()
getOriginalName
in interface VariableEnhanced
public Variable getOriginalVariable()
getOriginalVariable
in interface VariableEnhanced
@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 ucar.nc2.dataset.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 ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public DataType.Signedness getSignedness()
EnhanceScaleMissingUnsigned
getSignedness
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public java.lang.String getUnitsString()
Variable
getUnitsString
in interface ucar.nc2.dataset.Enhancements
getUnitsString
in interface VariableSimpleIF
getUnitsString
in class Variable
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 ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public double getValidMax()
EnhanceScaleMissingUnsigned
getValidMax
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public double getValidMin()
EnhanceScaleMissingUnsigned
getValidMin
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public boolean hasFillValue()
EnhanceScaleMissingUnsigned
hasFillValue
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public boolean hasMissing()
EnhanceScaleMissingUnsigned
hasMissing
in interface IsMissingEvaluator
hasMissing
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public boolean hasMissingValue()
EnhanceScaleMissingUnsigned
hasMissingValue
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public boolean hasScaleOffset()
EnhanceScaleMissingUnsigned
hasScaleOffset
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public boolean hasValidData()
EnhanceScaleMissingUnsigned
hasValidData
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public boolean invalidDataIsMissing()
public boolean isFillValue(double val)
EnhanceScaleMissingUnsigned
isFillValue
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public boolean isInvalidData(double val)
EnhanceScaleMissingUnsigned
isInvalidData
in interface ucar.nc2.dataset.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 ucar.nc2.dataset.EnhanceScaleMissingUnsigned
val
- an unpacked value.true
if the argument is a missing value.public boolean isMissingValue(double val)
EnhanceScaleMissingUnsigned
isMissingValue
in interface ucar.nc2.dataset.EnhanceScaleMissingUnsigned
public java.lang.String lookupEnumString(int val)
Variable
lookupEnumString
in class Variable
val
- the integer value of this enumpublic boolean missingDataIsMissing()
public long readToStream(Section section, java.io.OutputStream out) throws java.io.IOException, InvalidRangeException
Variable
readToStream
in class Variable
java.io.IOException
InvalidRangeException
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 errorpublic 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 void showScaleMissingProxy(java.util.Formatter f)
f
- put info herepublic VariableDS.Builder<?> toBuilder()
Variable
public java.lang.String toStringDebug()
Variable
toStringDebug
in class Variable