Package ucar.nc2.dataset
Class VariableEnhancer
- java.lang.Object
-
- ucar.nc2.dataset.VariableEnhancer
-
- All Implemented Interfaces:
IsMissingEvaluator
,EnhanceScaleMissingUnsigned
@Deprecated public class VariableEnhancer extends Object implements EnhanceScaleMissingUnsigned
Deprecated.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description double
applyScaleOffset(Number value)
Deprecated.Apply scale and offset to the specified value ifEnhanceScaleMissingUnsigned.hasScaleOffset()
.Array
applyScaleOffset(Array in)
Deprecated.Apply scale and offset to each element ofin
and return the result as a new Array, but only ifEnhanceScaleMissingUnsigned.hasScaleOffset()
.Array
convert(Array in, boolean convertUnsigned, boolean applyScaleOffset, boolean convertMissing)
Deprecated.Perform the specified conversions on each element ofin
and return the result as a new Array.Number
convertMissing(Number value)
Deprecated.Array
convertMissing(Array in)
Deprecated.Number
convertUnsigned(Number value)
Deprecated.Convertvalue
to the next largest integral data type by anunsigned conversion
.Array
convertUnsigned(Array in)
Deprecated.Performs anunsigned conversion
of each element ofin
and returns the result as a new Array.double
getFillValue()
Deprecated.return value of _FillValue attributedouble[]
getMissingValues()
Deprecated.return values of missing_value attributesdouble
getOffset()
Deprecated.The number to be added to the data after it is read.DataType
getScaledOffsetType()
Deprecated.Return the data type for values that have undergone scale/offset conversion.double
getScaleFactor()
Deprecated.The data are to be multiplied by this value after the data are read.DataType.Signedness
getSignedness()
Deprecated.Returns the signedness of the decorated variable.DataType
getUnsignedConversionType()
Deprecated.Return the data type for values that have undergone unsigned conversion.double
getValidMax()
Deprecated.return the maximum value in the valid rangedouble
getValidMin()
Deprecated.return the minimum value in the valid rangeboolean
hasFillValue()
Deprecated.true if Variable has _FillValue attributeboolean
hasMissing()
Deprecated.true if Variable has missing data valuesboolean
hasMissingValue()
Deprecated.true if Variable has missing_value attributeboolean
hasScaleOffset()
Deprecated.true if Variable data will be converted using scale and offsetboolean
hasValidData()
Deprecated.true if Variable has valid_range, valid_min or valid_max attributesboolean
isFillValue(double val)
Deprecated.return true if val equals the _FillValueboolean
isInvalidData(double val)
Deprecated.return true if val is outside the valid rangeboolean
isMissing(double val)
Deprecated.Returnstrue
if the argument is a missing value.boolean
isMissingValue(double val)
Deprecated.return true if val equals a missing_value (low-level)static DataType
largestOf(DataType... dataTypes)
Deprecated.Returns the data type that is the largest among the arguments.static DataType
nextLarger(DataType dataType)
Deprecated.Returns the smallest numeric data type that: can hold a larger integer thandataType
can if integral, has the same signedness asdataType
The relative sizes of data types are determined in a manner consistent withrank(DataType)
.static int
rank(DataType dataType)
Deprecated.Returns a distinct integer for each of thenumeric
data types that can be used to (roughly) order them by the range of the DataType.void
setFillValueIsMissing(boolean b)
Deprecated.Set if _FillValue is considered isMissing().void
setInvalidDataIsMissing(boolean b)
Deprecated.set if valid_range is considered isMissing(); better set in constructor if possiblevoid
setMissingDataIsMissing(boolean b)
Deprecated.set if missing_data is considered isMissing(); better set in constructor if possible
-
-
-
Method Detail
-
rank
public static int rank(DataType dataType)
Deprecated.Returns a distinct integer for each of thenumeric
data types that can be used to (roughly) order them by the range of the DataType.BYTE < UBYTE < SHORT < USHORT < INT < UINT < LONG < ULONG < FLOAT < DOUBLE
.-1
will be returned for all non-numeric data types.- Parameters:
dataType
- a numeric data type.- Returns:
- a distinct integer for each of the numeric data types that can be used to (roughly) order them by size.
-
largestOf
public static DataType largestOf(DataType... dataTypes)
Deprecated.Returns the data type that is the largest among the arguments. Relative sizes of data types are determined viarank(DataType)
.- Parameters:
dataTypes
- an array of numeric data types.- Returns:
- the data type that is the largest among the arguments.
-
nextLarger
public static DataType nextLarger(DataType dataType)
Deprecated.Returns the smallest numeric data type that:- can hold a larger integer than
dataType
can - if integral, has the same signedness as
dataType
rank(DataType)
.Argument Result BYTE SHORT UBYTE USHORT SHORT INT USHORT UINT INT LONG UINT ULONG LONG DOUBLE ULONG DOUBLE Any other data type Just return argument byte
value-106
equals150
when interpreted as unsigned. That won't fit in a (signed)byte
, but it will fit in ashort
.- Parameters:
dataType
- an integral data type.- Returns:
- the next larger type.
- can hold a larger integer than
-
getScaleFactor
public double getScaleFactor()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
The data are to be multiplied by this value after the data are read. By default it is1.0
, i.e. no scaling. It will remain that value if the variable defines noCDM.SCALE_FACTOR
attribute.- Specified by:
getScaleFactor
in interfaceEnhanceScaleMissingUnsigned
- Returns:
- the multiplier to apply to the data.
-
getOffset
public double getOffset()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
The number to be added to the data after it is read. If bothCDM.SCALE_FACTOR
andCDM.ADD_OFFSET
attributes are present, the data are first scaled before the offset is added. By default it is0.0
, i.e. no offset. It will remain that value if the variable defines noCDM.SCALE_FACTOR
attribute.- Specified by:
getOffset
in interfaceEnhanceScaleMissingUnsigned
- Returns:
- the number to add to the data.
-
getSignedness
public DataType.Signedness getSignedness()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
Returns the signedness of the decorated variable.- Specified by:
getSignedness
in interfaceEnhanceScaleMissingUnsigned
- Returns:
- the signedness of the decorated variable.
-
getScaledOffsetType
public DataType getScaledOffsetType()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
Return the data type for values that have undergone scale/offset conversion. This will benull
if the decorated variable lacksscale_factor
oradd_offset
attributes. You can check withEnhanceScaleMissingUnsigned.hasScaleOffset()
.- Specified by:
getScaledOffsetType
in interfaceEnhanceScaleMissingUnsigned
- Returns:
- the data type for values that have undergone scale/offset conversion.
-
getUnsignedConversionType
@Nonnull public DataType getUnsignedConversionType()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
Return the data type for values that have undergone unsigned conversion. This will never benull
, 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.- Specified by:
getUnsignedConversionType
in interfaceEnhanceScaleMissingUnsigned
- Returns:
- the data type for values that have undergone unsigned conversion.
-
hasValidData
public boolean hasValidData()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
true if Variable has valid_range, valid_min or valid_max attributes- Specified by:
hasValidData
in interfaceEnhanceScaleMissingUnsigned
-
getValidMin
public double getValidMin()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
return the minimum value in the valid range- Specified by:
getValidMin
in interfaceEnhanceScaleMissingUnsigned
-
getValidMax
public double getValidMax()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
return the maximum value in the valid range- Specified by:
getValidMax
in interfaceEnhanceScaleMissingUnsigned
-
isInvalidData
public boolean isInvalidData(double val)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
return true if val is outside the valid range- Specified by:
isInvalidData
in interfaceEnhanceScaleMissingUnsigned
-
hasFillValue
public boolean hasFillValue()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
true if Variable has _FillValue attribute- Specified by:
hasFillValue
in interfaceEnhanceScaleMissingUnsigned
-
isFillValue
public boolean isFillValue(double val)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
return true if val equals the _FillValue- Specified by:
isFillValue
in interfaceEnhanceScaleMissingUnsigned
-
getFillValue
public double getFillValue()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
return value of _FillValue attribute- Specified by:
getFillValue
in interfaceEnhanceScaleMissingUnsigned
-
hasScaleOffset
public boolean hasScaleOffset()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
true if Variable data will be converted using scale and offset- Specified by:
hasScaleOffset
in interfaceEnhanceScaleMissingUnsigned
-
hasMissingValue
public boolean hasMissingValue()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
true if Variable has missing_value attribute- Specified by:
hasMissingValue
in interfaceEnhanceScaleMissingUnsigned
-
isMissingValue
public boolean isMissingValue(double val)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
return true if val equals a missing_value (low-level)- Specified by:
isMissingValue
in interfaceEnhanceScaleMissingUnsigned
-
getMissingValues
public double[] getMissingValues()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
return values of missing_value attributes- Specified by:
getMissingValues
in interfaceEnhanceScaleMissingUnsigned
-
setFillValueIsMissing
public void setFillValueIsMissing(boolean b)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
Set if _FillValue is considered isMissing().- Specified by:
setFillValueIsMissing
in interfaceEnhanceScaleMissingUnsigned
-
setInvalidDataIsMissing
public void setInvalidDataIsMissing(boolean b)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
set if valid_range is considered isMissing(); better set in constructor if possible- Specified by:
setInvalidDataIsMissing
in interfaceEnhanceScaleMissingUnsigned
-
setMissingDataIsMissing
public void setMissingDataIsMissing(boolean b)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
set if missing_data is considered isMissing(); better set in constructor if possible- Specified by:
setMissingDataIsMissing
in interfaceEnhanceScaleMissingUnsigned
-
hasMissing
public boolean hasMissing()
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
true if Variable has missing data values- Specified by:
hasMissing
in interfaceEnhanceScaleMissingUnsigned
- Specified by:
hasMissing
in interfaceIsMissingEvaluator
- Returns:
- true if Variable has missing data values
-
isMissing
public boolean isMissing(double val)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
Returnstrue
if the argument is a missing value. Note thatFloat.NaN
andDouble.NaN
are considered missing data.- Specified by:
isMissing
in interfaceEnhanceScaleMissingUnsigned
- Specified by:
isMissing
in interfaceIsMissingEvaluator
- Parameters:
val
- an unpacked value.- Returns:
true
if the argument is a missing value.
-
convertUnsigned
public Number convertUnsigned(Number value)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
Convertvalue
to the next largest integral data type by anunsigned conversion
. The conversion only happens if the decorated variableis unsigned
andvalue
is a negative integer. Otherwise, simply returnvalue
.- Specified by:
convertUnsigned
in interfaceEnhanceScaleMissingUnsigned
- Parameters:
value
- an integral number to convert.- Returns:
- the result of an unsigned conversion of
value
.
-
convertUnsigned
public Array convertUnsigned(Array in)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
Performs anunsigned conversion
of each element ofin
and returns the result as a new Array. The data type of the returned array will beEnhanceScaleMissingUnsigned.getUnsignedConversionType()
.- Specified by:
convertUnsigned
in interfaceEnhanceScaleMissingUnsigned
- Parameters:
in
- an Array containing integral Numbers to convert.- Returns:
- the result of an unsigned conversion of each element of
in
.
-
applyScaleOffset
public double applyScaleOffset(Number value)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
Apply scale and offset to the specified value ifEnhanceScaleMissingUnsigned.hasScaleOffset()
. Otherwise, just returnvalue
.- Specified by:
applyScaleOffset
in interfaceEnhanceScaleMissingUnsigned
-
applyScaleOffset
public Array applyScaleOffset(Array in)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
Apply scale and offset to each element ofin
and return the result as a new Array, but only ifEnhanceScaleMissingUnsigned.hasScaleOffset()
. Otherwise, just returnvalue
. Otherwise, just returndata
.- Specified by:
applyScaleOffset
in interfaceEnhanceScaleMissingUnsigned
- Parameters:
in
- convert this- Returns:
- converted data.
-
convertMissing
public Number convertMissing(Number value)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
- Specified by:
convertMissing
in interfaceEnhanceScaleMissingUnsigned
-
convertMissing
public Array convertMissing(Array in)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
- Specified by:
convertMissing
in interfaceEnhanceScaleMissingUnsigned
- Parameters:
in
- an array containing floating-point numbers to convert.- Returns:
- the result of a missing conversion of each element of
in
.
-
convert
public Array convert(Array in, boolean convertUnsigned, boolean applyScaleOffset, boolean convertMissing)
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned
Perform the specified conversions on each element ofin
and return the result as a new Array. Note that this method is more efficient than callingEnhanceScaleMissingUnsigned.convertUnsigned(Array)
, followed byEnhanceScaleMissingUnsigned.applyScaleOffset(Array)
, followed byEnhanceScaleMissingUnsigned.convertMissing(Array)
, as only one copy ofin
is made.- Specified by:
convert
in interfaceEnhanceScaleMissingUnsigned
- Parameters:
in
- a numeric array.convertUnsigned
-true
if we shouldconvert unsigned
.applyScaleOffset
-true
if we shouldapply scale/offset
.convertMissing
-true
if we shouldconvert missing
.- Returns:
- a new array, with the specified conversions performed.
-
-