Package ucar.nc2.dataset
Class VariableEnhancer
java.lang.Object
ucar.nc2.dataset.VariableEnhancer
- All Implemented Interfaces:
IsMissingEvaluator,EnhanceScaleMissingUnsigned
Deprecated.
-
Method Summary
Modifier and TypeMethodDescriptiondoubleapplyScaleOffset(Number value) Deprecated.Apply scale and offset to the specified value ifEnhanceScaleMissingUnsigned.hasScaleOffset().Deprecated.Apply scale and offset to each element ofinand return the result as a new Array, but only ifEnhanceScaleMissingUnsigned.hasScaleOffset().Deprecated.Perform the specified conversions on each element ofinand return the result as a new Array.convertMissing(Number value) Deprecated.convertMissing(Array in) Deprecated.convertUnsigned(Number value) Deprecated.Convertvalueto the next largest integral data type by anunsigned conversion.convertUnsigned(Array in) Deprecated.Performs anunsigned conversionof each element ofinand returns the result as a new Array.doubleDeprecated.return value of _FillValue attributedouble[]Deprecated.return values of missing_value attributesdoubleDeprecated.The number to be added to the data after it is read.Deprecated.Return the data type for values that have undergone scale/offset conversion.doubleDeprecated.The data are to be multiplied by this value after the data are read.Deprecated.Returns the signedness of the decorated variable.Deprecated.Return the data type for values that have undergone unsigned conversion.doubleDeprecated.return the maximum value in the valid rangedoubleDeprecated.return the minimum value in the valid rangebooleanDeprecated.true if Variable has _FillValue attributebooleanDeprecated.true if Variable has missing data valuesbooleanDeprecated.true if Variable has missing_value attributebooleanDeprecated.true if Variable data will be converted using scale and offsetbooleanDeprecated.true if Variable has valid_range, valid_min or valid_max attributesbooleanisFillValue(double val) Deprecated.return true if val equals the _FillValuebooleanisInvalidData(double val) Deprecated.return true if val is outside the valid rangebooleanisMissing(double val) Deprecated.Returnstrueif the argument is a missing value.booleanisMissingValue(double val) Deprecated.return true if val equals a missing_value (low-level)static DataTypeDeprecated.Returns the data type that is the largest among the arguments.static DataTypenextLarger(DataType dataType) Deprecated.Returns the smallest numeric data type that: can hold a larger integer thandataTypecan if integral, has the same signedness asdataTypeThe relative sizes of data types are determined in a manner consistent withrank(DataType).static intDeprecated.Returns a distinct integer for each of thenumericdata types that can be used to (roughly) order them by the range of the DataType.voidsetFillValueIsMissing(boolean b) Deprecated.Set if _FillValue is considered isMissing().voidsetInvalidDataIsMissing(boolean b) Deprecated.set if valid_range is considered isMissing(); better set in constructor if possiblevoidsetMissingDataIsMissing(boolean b) Deprecated.set if missing_data is considered isMissing(); better set in constructor if possible
-
Method Details
-
rank
Deprecated.Returns a distinct integer for each of thenumericdata 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.-1will 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
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
Deprecated.Returns the smallest numeric data type that:- can hold a larger integer than
dataTypecan - if integral, has the same signedness as
dataType
rank(DataType).
The returned type is intended to be just big enough to hold the result of performing an unsigned conversion of a value of the smaller type. For example, theArgument Result BYTE SHORT UBYTE USHORT SHORT INT USHORT UINT INT LONG UINT ULONG LONG DOUBLE ULONG DOUBLE Any other data type Just return argument bytevalue-106equals150when 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:EnhanceScaleMissingUnsignedThe 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_FACTORattribute.- Specified by:
getScaleFactorin interfaceEnhanceScaleMissingUnsigned- Returns:
- the multiplier to apply to the data.
-
getOffset
public double getOffset()Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedThe number to be added to the data after it is read. If bothCDM.SCALE_FACTORandCDM.ADD_OFFSETattributes 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_FACTORattribute.- Specified by:
getOffsetin interfaceEnhanceScaleMissingUnsigned- Returns:
- the number to add to the data.
-
getSignedness
Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedReturns the signedness of the decorated variable.- Specified by:
getSignednessin interfaceEnhanceScaleMissingUnsigned- Returns:
- the signedness of the decorated variable.
-
getScaledOffsetType
Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedReturn the data type for values that have undergone scale/offset conversion. This will benullif the decorated variable lacksscale_factororadd_offsetattributes. You can check withEnhanceScaleMissingUnsigned.hasScaleOffset().- Specified by:
getScaledOffsetTypein interfaceEnhanceScaleMissingUnsigned- Returns:
- the data type for values that have undergone scale/offset conversion.
-
getUnsignedConversionType
Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedReturn 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:
getUnsignedConversionTypein interfaceEnhanceScaleMissingUnsigned- Returns:
- the data type for values that have undergone unsigned conversion.
-
hasValidData
public boolean hasValidData()Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedtrue if Variable has valid_range, valid_min or valid_max attributes- Specified by:
hasValidDatain interfaceEnhanceScaleMissingUnsigned
-
getValidMin
public double getValidMin()Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedreturn the minimum value in the valid range- Specified by:
getValidMinin interfaceEnhanceScaleMissingUnsigned
-
getValidMax
public double getValidMax()Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedreturn the maximum value in the valid range- Specified by:
getValidMaxin interfaceEnhanceScaleMissingUnsigned
-
isInvalidData
public boolean isInvalidData(double val) Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedreturn true if val is outside the valid range- Specified by:
isInvalidDatain interfaceEnhanceScaleMissingUnsigned
-
hasFillValue
public boolean hasFillValue()Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedtrue if Variable has _FillValue attribute- Specified by:
hasFillValuein interfaceEnhanceScaleMissingUnsigned
-
isFillValue
public boolean isFillValue(double val) Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedreturn true if val equals the _FillValue- Specified by:
isFillValuein interfaceEnhanceScaleMissingUnsigned
-
getFillValue
public double getFillValue()Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedreturn value of _FillValue attribute- Specified by:
getFillValuein interfaceEnhanceScaleMissingUnsigned
-
hasScaleOffset
public boolean hasScaleOffset()Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedtrue if Variable data will be converted using scale and offset- Specified by:
hasScaleOffsetin interfaceEnhanceScaleMissingUnsigned
-
hasMissingValue
public boolean hasMissingValue()Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedtrue if Variable has missing_value attribute- Specified by:
hasMissingValuein interfaceEnhanceScaleMissingUnsigned
-
isMissingValue
public boolean isMissingValue(double val) Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedreturn true if val equals a missing_value (low-level)- Specified by:
isMissingValuein interfaceEnhanceScaleMissingUnsigned
-
getMissingValues
public double[] getMissingValues()Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedreturn values of missing_value attributes- Specified by:
getMissingValuesin interfaceEnhanceScaleMissingUnsigned
-
setFillValueIsMissing
public void setFillValueIsMissing(boolean b) Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedSet if _FillValue is considered isMissing().- Specified by:
setFillValueIsMissingin interfaceEnhanceScaleMissingUnsigned
-
setInvalidDataIsMissing
public void setInvalidDataIsMissing(boolean b) Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedset if valid_range is considered isMissing(); better set in constructor if possible- Specified by:
setInvalidDataIsMissingin interfaceEnhanceScaleMissingUnsigned
-
setMissingDataIsMissing
public void setMissingDataIsMissing(boolean b) Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedset if missing_data is considered isMissing(); better set in constructor if possible- Specified by:
setMissingDataIsMissingin interfaceEnhanceScaleMissingUnsigned
-
hasMissing
public boolean hasMissing()Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedtrue if Variable has missing data values- Specified by:
hasMissingin interfaceEnhanceScaleMissingUnsigned- Specified by:
hasMissingin interfaceIsMissingEvaluator- Returns:
- true if Variable has missing data values
-
isMissing
public boolean isMissing(double val) Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedReturnstrueif the argument is a missing value. Note thatFloat.NaNandDouble.NaNare considered missing data.- Specified by:
isMissingin interfaceEnhanceScaleMissingUnsigned- Specified by:
isMissingin interfaceIsMissingEvaluator- Parameters:
val- an unpacked value.- Returns:
trueif the argument is a missing value.
-
convertUnsigned
Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedConvertvalueto the next largest integral data type by anunsigned conversion. The conversion only happens if the decorated variableis unsignedandvalueis a negative integer. Otherwise, simply returnvalue.- Specified by:
convertUnsignedin interfaceEnhanceScaleMissingUnsigned- Parameters:
value- an integral number to convert.- Returns:
- the result of an unsigned conversion of
value.
-
convertUnsigned
Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedPerforms anunsigned conversionof each element ofinand returns the result as a new Array. The data type of the returned array will beEnhanceScaleMissingUnsigned.getUnsignedConversionType().- Specified by:
convertUnsignedin interfaceEnhanceScaleMissingUnsigned- Parameters:
in- an Array containing integral Numbers to convert.- Returns:
- the result of an unsigned conversion of each element of
in.
-
applyScaleOffset
Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedApply scale and offset to the specified value ifEnhanceScaleMissingUnsigned.hasScaleOffset(). Otherwise, just returnvalue.- Specified by:
applyScaleOffsetin interfaceEnhanceScaleMissingUnsigned
-
applyScaleOffset
Deprecated.Description copied from interface:EnhanceScaleMissingUnsignedApply scale and offset to each element ofinand return the result as a new Array, but only ifEnhanceScaleMissingUnsigned.hasScaleOffset(). Otherwise, just returnvalue. Otherwise, just returndata.- Specified by:
applyScaleOffsetin interfaceEnhanceScaleMissingUnsigned- Parameters:
in- convert this- Returns:
- converted data.
-
convertMissing
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned- Specified by:
convertMissingin interfaceEnhanceScaleMissingUnsigned
-
convertMissing
Deprecated.Description copied from interface:EnhanceScaleMissingUnsigned- Specified by:
convertMissingin 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:EnhanceScaleMissingUnsignedPerform the specified conversions on each element ofinand 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 ofinis made.- Specified by:
convertin interfaceEnhanceScaleMissingUnsigned- Parameters:
in- a numeric array.convertUnsigned-trueif we shouldconvert unsigned.applyScaleOffset-trueif we shouldapply scale/offset.convertMissing-trueif we shouldconvert missing.- Returns:
- a new array, with the specified conversions performed.
-