Package ucar.nc2.dataset
Class VariableDS
- java.lang.Object
-
- ucar.nc2.CDMNode
-
- ucar.nc2.Variable
-
- ucar.nc2.dataset.VariableDS
-
- All Implemented Interfaces:
Comparable<VariableSimpleIF>,Iterable<Attribute>,IsMissingEvaluator,AttributeContainer,Enhancements,EnhanceScaleMissingUnsigned,VariableEnhanced,ProxyReader,VariableSimpleIF
- Direct Known Subclasses:
CoordinateAxis
public class VariableDS extends Variable implements VariableEnhanced, EnhanceScaleMissingUnsigned
A wrapper around a Variable, creating an "enhanced" Variable. The original Variable is used for the I/O. There are several distinct uses:- Handle scale/offset/missing/enum/unsigned conversion; this can change DataType and data values
- Container for coordinate system information
- NcML modifications to underlying Variable
- See Also:
NetcdfDataset
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVariableDS.Builder<T extends VariableDS.Builder<T>>-
Nested classes/interfaces inherited from class ucar.nc2.Variable
Variable.Cache
-
-
Field Summary
Fields Modifier and Type Field Description protected DataTypeorgDataTypeprotected StringorgNameprotected VariableorgVar-
Fields inherited from class ucar.nc2.Variable
attributes, cache, dataType, debugCaching, defaultCoordsSizeToCache, defaultSizeToCache, dimensions, elementSize, hashCode, isVariableLength, ncfile, permitCaching, proxyReader, shape, sizeToCache, spiObject
-
Fields inherited from class ucar.nc2.CDMNode
annotations, dodsname, group, immutable, parentstruct, shortName, sort
-
-
Constructor Summary
Constructors Modifier Constructor Description VariableDS(NetcdfDataset ds, Group group, Structure parentStructure, String shortName, DataType dataType, String dims, String units, String desc)Deprecated.Use NetcdfDataset.builder()protectedVariableDS(VariableDS.Builder<?> builder, Group parentGroup)protectedVariableDS(VariableDS vds, boolean isCopy)Deprecated.Use NetcdfDataset.builder()VariableDS(Group group, Structure parent, String shortName, Variable orgVar)Deprecated.Use NetcdfDataset.builder()VariableDS(Group g, Variable orgVar, boolean enhance)Deprecated.Use NetcdfDataset.builder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Array_read()protected Array_read(Section section)voidaddCoordinateSystem(CoordinateSystem cs)Deprecated.Use VariableDS.builder()booleanaddEnhancement(NetcdfDataset.Enhance enhancement)Deprecated.Use NetcdfDataset.builder()protected VariableDS.Builder<?>addLocalFieldsToBuilder(VariableDS.Builder<? extends VariableDS.Builder<?>> builder)doubleapplyScaleOffset(Number value)Apply scale and offset to the specified value ifEnhanceScaleMissingUnsigned.hasScaleOffset().ArrayapplyScaleOffset(Array data)Apply scale and offset to each element ofinand return the result as a new Array, but only ifEnhanceScaleMissingUnsigned.hasScaleOffset().static VariableDS.Builder<?>builder()Get Builder for this class that allows subclassing.voidclearCoordinateSystems()Deprecated.Use NetcdfDataset.builder()Arrayconvert(Array in, boolean convertUnsigned, boolean applyScaleOffset, boolean convertMissing)Perform the specified conversions on each element ofinand return the result as a new Array.NumberconvertMissing(Number value)ArrayconvertMissing(Array in)NumberconvertUnsigned(Number value)Convertvalueto the next largest integral data type by anunsigned conversion.ArrayconvertUnsigned(Array in)Performs anunsigned conversionof each element ofinand returns the result as a new Array.protected VariableDScopy()voidenhance(Set<NetcdfDataset.Enhance> enhancements)Deprecated.Use NetcdfDataset.builder()com.google.common.collect.ImmutableList<CoordinateSystem>getCoordinateSystems()Get the list of Coordinate Systems for this Variable.StringgetDatasetLocation()The location of the dataset this belongs to.StringgetDescription()Get the description of the Variable.Set<NetcdfDataset.Enhance>getEnhanceMode()Returns the enhancements applied to this variable.doublegetFillValue()return value of _FillValue attributeArraygetMissingDataArray(int[] shape)Return Array with missing datadouble[]getMissingValues()return values of missing_value attributesNetcdfFilegetNetcdfFile()Get the NetcdfFile that this variable is contained in.doublegetOffset()The number to be added to the data after it is read.DataTypegetOriginalDataType()When this wraps another Variable, get the original Variable's DataType.StringgetOriginalName()When this wraps another Variable, get the original Variable's name.VariablegetOriginalVariable()A VariableDS usually wraps another Variable.DataTypegetScaledOffsetType()Return the data type for values that have undergone scale/offset conversion.doublegetScaleFactor()The data are to be multiplied by this value after the data are read.DataType.SignednessgetSignedness()Returns the signedness of the decorated variable.StringgetUnitsString()Get the Unit String for the Variable.DataTypegetUnsignedConversionType()Return the data type for values that have undergone unsigned conversion.doublegetValidMax()return the maximum value in the valid rangedoublegetValidMin()return the minimum value in the valid rangebooleanhasCachedDataRecurse()Deprecated.Removed in v6booleanhasFillValue()true if Variable has _FillValue attributebooleanhasMissing()true if Variable has missing data valuesbooleanhasMissingValue()true if Variable has missing_value attributebooleanhasScaleOffset()true if Variable data will be converted using scale and offsetbooleanhasValidData()true if Variable has valid_range, valid_min or valid_max attributesbooleanisFillValue(double val)return true if val equals the _FillValuebooleanisInvalidData(double val)return true if val is outside the valid rangebooleanisMissing(double val)Returnstrueif the argument is a missing value.booleanisMissingValue(double val)return true if val equals a missing_value (low-level)StringlookupEnumString(int val)Lookup the enum string for this value.longreadToStream(Section section, OutputStream out)Read variable data to a stream.ArrayreallyRead(Variable client, Section section, CancelTask cancelTask)public by accident, do not call directly.ArrayreallyRead(Variable client, CancelTask cancelTask)public by accident, do not call directly.voidremoveCoordinateSystem(CoordinateSystem cs)Deprecated.Use VariableDS.builder()booleanremoveEnhancement(NetcdfDataset.Enhance enhancement)Deprecated.Use NetcdfDataset.builder()voidsetCaching(boolean caching)Deprecated.Use NetcdfDataset.builder()voidsetFillValueIsMissing(boolean b)Deprecated.Use NetcdfDataset.builder()voidsetInvalidDataIsMissing(boolean b)Deprecated.Use NetcdfDataset.builder()voidsetMissingDataIsMissing(boolean b)Deprecated.Use NetcdfDataset.builder()StringsetName(String newName)Deprecated.Use NetcdfDataset.builder()voidsetOriginalVariable(Variable orgVar)Deprecated.Use NetcdfDataset.builder()voidsetUnitsString(String units)Deprecated.Use NetcdfDataset.builder()voidshowScaleMissingProxy(Formatter f)public for debuggingVariableDS.Builder<?>toBuilder()Turn into a mutable Builder.StringtoStringDebug()String representation of Variable and its attributes.-
Methods inherited from class ucar.nc2.Variable
_readScalarData, addAll, addAttribute, addLocalFieldsToBuilder, attributes, compareTo, createNewCache, equals, extraInfo, findAttribute, findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, findAttributeString, findDimensionIndex, getAttributes, getDAPName, getDAPName, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getElementSize, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentGroupOrRoot, getParentStructure, getProxyReader, getRanges, getRank, getScalarData, getShape, getShape, getShapeAll, getShapeAsSection, getSize, getSizeToCache, getSPobject, hasCachedData, hashCode, invalidateCache, isCaching, isCoordinateVariable, isEmpty, isImmutable, isMemberOfStructure, 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, writeCDL
-
Methods inherited from class ucar.nc2.CDMNode
annotate, annotation, getDODSName, getFullNameEscaped, getGroup, getImmutable, getName, getShortName, getSort, localhash, setDODSName, setParentStructure, setShortName, setSort, unwrap
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ucar.nc2.AttributeContainer
findAttValueIgnoreCase, getName, hasAttribute, hasAttributeIgnoreCase, iterator
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface ucar.nc2.dataset.VariableEnhanced
getFullName, getShortName
-
Methods inherited from interface ucar.nc2.VariableSimpleIF
getName, getShortName
-
-
-
-
Constructor Detail
-
VariableDS
@Deprecated public VariableDS(NetcdfDataset ds, Group group, Structure parentStructure, String shortName, DataType dataType, String dims, String units, String desc)
Deprecated.Use NetcdfDataset.builder()Constructor when there's no underlying variable. You must also set the values by doing one of:- set the values with setCachedData()
- set a proxy reader with setProxyReader()
- Parameters:
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
-
VariableDS
@Deprecated public VariableDS(Group group, Structure parent, String shortName, Variable orgVar)
Deprecated.Use NetcdfDataset.builder()Make a new VariableDS, delegate data reading to the original variable, but otherwise dont take any info from it. This is used by NcML explicit mode.- Parameters:
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.
-
VariableDS
@Deprecated public VariableDS(Group g, Variable orgVar, boolean enhance)
Deprecated.Use NetcdfDataset.builder()Wrap the given Variable, making it into a VariableDS. Delegate data reading to the original variable. Take all metadata from original variable. Does not share cache, iosp.- Parameters:
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.
-
VariableDS
@Deprecated protected VariableDS(VariableDS vds, boolean isCopy)
Deprecated.Use NetcdfDataset.builder()Copy constructor, for subclasses. Used by copy() and CoordinateAxis Share everything except the coord systems.- Parameters:
vds- copy from here.isCopy- called from copy()
-
VariableDS
protected VariableDS(VariableDS.Builder<?> builder, Group parentGroup)
-
-
Method Detail
-
getNetcdfFile
public NetcdfFile getNetcdfFile()
Description copied from class:VariableGet the NetcdfFile that this variable is contained in. May be null.- Overrides:
getNetcdfFilein classVariable
-
copy
protected VariableDS copy()
-
clearCoordinateSystems
@Deprecated public void clearCoordinateSystems()
Deprecated.Use NetcdfDataset.builder()Remove coordinate system info.- Specified by:
clearCoordinateSystemsin interfaceVariableEnhanced
-
enhance
@Deprecated public void enhance(Set<NetcdfDataset.Enhance> enhancements)
Deprecated.Use NetcdfDataset.builder()Calculate scale/offset/missing/enum/unsigned value info. This may change the DataType.- Specified by:
enhancein interfaceVariableEnhanced
-
getEnhanceMode
public Set<NetcdfDataset.Enhance> getEnhanceMode()
Returns the enhancements applied to this variable. If this variable wraps another variable, the returned set will also contain the enhancements applied to the nested variable, recursively.- Returns:
- the enhancements applied to this variable.
-
addEnhancement
@Deprecated public boolean addEnhancement(NetcdfDataset.Enhance enhancement)
Deprecated.Use NetcdfDataset.builder()Addenhancementto this variable. It may result in a change of data type.- Parameters:
enhancement- the enhancement to add.- Returns:
trueif the set of enhancements changed as a result of the call.
-
removeEnhancement
@Deprecated public boolean removeEnhancement(NetcdfDataset.Enhance enhancement)
Deprecated.Use NetcdfDataset.builder()Removeenhancementfrom this variable. It may result in a change of data type.- Parameters:
enhancement- the enhancement to remove.- Returns:
trueif the set of enhancements changed as a result of the call.
-
getOriginalVariable
public Variable getOriginalVariable()
A VariableDS usually wraps another Variable.- Specified by:
getOriginalVariablein interfaceVariableEnhanced- Returns:
- original Variable or null
-
setOriginalVariable
@Deprecated public void setOriginalVariable(Variable orgVar)
Deprecated.Use NetcdfDataset.builder()Set the Variable to wrap. Used by NcML explicit mode.- Specified by:
setOriginalVariablein interfaceVariableEnhanced- Parameters:
orgVar- original Variable, must not be a Structure
-
getOriginalDataType
public DataType getOriginalDataType()
When this wraps another Variable, get the original Variable's DataType.- Returns:
- original Variable's DataType, or current data type if it doesnt wrap another variable
-
getOriginalName
public String getOriginalName()
When this wraps another Variable, get the original Variable's name.- Specified by:
getOriginalNamein interfaceVariableEnhanced- Returns:
- original Variable's name
-
lookupEnumString
public String lookupEnumString(int val)
Description copied from class:VariableLookup the enum string for this value. Can only be called on enum types, where dataType.isEnum() is true.- Overrides:
lookupEnumStringin classVariable- Parameters:
val- the integer value of this enum- Returns:
- the String value
-
setName
@Deprecated public String setName(String newName)
Deprecated.Use NetcdfDataset.builder()Description copied from class:VariableSet the short name, converting to valid CDM object name if needed.
-
toStringDebug
public String toStringDebug()
Description copied from class:VariableString representation of Variable and its attributes.- Overrides:
toStringDebugin classVariable
-
getDatasetLocation
public String getDatasetLocation()
Description copied from class:VariableThe location of the dataset this belongs to. Labeling purposes only.- Overrides:
getDatasetLocationin classVariable
-
hasCachedDataRecurse
@Deprecated public boolean hasCachedDataRecurse()
Deprecated.Removed in v6
-
setCaching
@Deprecated public void setCaching(boolean caching)
Deprecated.Use NetcdfDataset.builder()Description copied from class:VariableSet whether to cache or not. Implies that the entire array will be stored, once read. Normally this is set automatically based on size of data.- Overrides:
setCachingin classVariable- Parameters:
caching- set if caching.
-
_read
protected Array _read() throws IOException
- Overrides:
_readin classVariable- Throws:
IOException
-
_read
protected Array _read(Section section) throws IOException, InvalidRangeException
- Overrides:
_readin classVariable- Throws:
IOExceptionInvalidRangeException
-
reallyRead
public Array reallyRead(Variable client, CancelTask cancelTask) throws IOException
Description copied from class:Variablepublic by accident, do not call directly.- Specified by:
reallyReadin interfaceProxyReader- Overrides:
reallyReadin classVariable- Parameters:
client- the client VariablecancelTask- user may cancel- Returns:
- Array
- Throws:
IOException- on error
-
reallyRead
public Array reallyRead(Variable client, Section section, CancelTask cancelTask) throws IOException, InvalidRangeException
Description copied from class:Variablepublic by accident, do not call directly.- Specified by:
reallyReadin interfaceProxyReader- Overrides:
reallyReadin classVariable- Parameters:
client- the client Variablesection- the section of data to read.cancelTask- user may cancel- Returns:
- Array
- Throws:
IOException- on errorInvalidRangeException- if section has incorrect rank or illegal shape.
-
readToStream
public long readToStream(Section section, OutputStream out) throws IOException, InvalidRangeException
Description copied from class:VariableRead variable data to a stream. Support for NcStreamWriter.- Overrides:
readToStreamin classVariable- Throws:
IOExceptionInvalidRangeException
-
getMissingDataArray
public Array getMissingDataArray(int[] shape)
Return Array with missing data- Parameters:
shape- of this shape- Returns:
- Array with given shape
-
showScaleMissingProxy
public void showScaleMissingProxy(Formatter f)
public for debugging- Parameters:
f- put info here
-
getDescription
public String getDescription()
Description copied from class:VariableGet the description of the Variable. Default is to use CDM.LONG_NAME attribute value. If not exist, look for "description", "title", or "standard_name" attribute value (in that order).- Specified by:
getDescriptionin interfaceEnhancements- Specified by:
getDescriptionin interfaceVariableSimpleIF- Overrides:
getDescriptionin classVariable- Returns:
- description, or null if not found.
-
getUnitsString
public String getUnitsString()
Description copied from class:VariableGet the Unit String for the Variable. Looks for the CDM.UNITS attribute value- Specified by:
getUnitsStringin interfaceEnhancements- Specified by:
getUnitsStringin interfaceVariableSimpleIF- Overrides:
getUnitsStringin classVariable- Returns:
- unit string, or null if not found.
-
setUnitsString
@Deprecated public void setUnitsString(String units)
Deprecated.Use NetcdfDataset.builder()Description copied from interface:VariableEnhancedSet the Unit String for this Variable. Default is to use the CDM.UNITS attribute.- Specified by:
setUnitsStringin interfaceVariableEnhanced- Parameters:
units- unit string
-
getCoordinateSystems
public com.google.common.collect.ImmutableList<CoordinateSystem> getCoordinateSystems()
Description copied from interface:EnhancementsGet the list of Coordinate Systems for this Variable.- Specified by:
getCoordinateSystemsin interfaceEnhancements- Returns:
- list of type CoordinateSystem; may be empty but not null.
-
addCoordinateSystem
@Deprecated public void addCoordinateSystem(CoordinateSystem cs)
Deprecated.Use VariableDS.builder()Description copied from interface:EnhancementsAdd a CoordinateSystem to the dataset.- Specified by:
addCoordinateSystemin interfaceEnhancements- Parameters:
cs- add this Coordinate System
-
removeCoordinateSystem
@Deprecated public void removeCoordinateSystem(CoordinateSystem cs)
Deprecated.Use VariableDS.builder()Description copied from interface:EnhancementsRemove a CoordinateSystem from the dataset.- Specified by:
removeCoordinateSystemin interfaceEnhancements- Parameters:
cs- remove this coordinate system
-
hasScaleOffset
public boolean hasScaleOffset()
Description copied from interface:EnhanceScaleMissingUnsignedtrue if Variable data will be converted using scale and offset- Specified by:
hasScaleOffsetin interfaceEnhanceScaleMissingUnsigned
-
getScaleFactor
public double getScaleFactor()
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()
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.
-
hasMissing
public boolean hasMissing()
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)
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.
-
hasValidData
public boolean hasValidData()
Description copied from interface:EnhanceScaleMissingUnsignedtrue if Variable has valid_range, valid_min or valid_max attributes- Specified by:
hasValidDatain interfaceEnhanceScaleMissingUnsigned
-
getValidMin
public double getValidMin()
Description copied from interface:EnhanceScaleMissingUnsignedreturn the minimum value in the valid range- Specified by:
getValidMinin interfaceEnhanceScaleMissingUnsigned
-
getValidMax
public double getValidMax()
Description copied from interface:EnhanceScaleMissingUnsignedreturn the maximum value in the valid range- Specified by:
getValidMaxin interfaceEnhanceScaleMissingUnsigned
-
isInvalidData
public boolean isInvalidData(double val)
Description copied from interface:EnhanceScaleMissingUnsignedreturn true if val is outside the valid range- Specified by:
isInvalidDatain interfaceEnhanceScaleMissingUnsigned
-
hasFillValue
public boolean hasFillValue()
Description copied from interface:EnhanceScaleMissingUnsignedtrue if Variable has _FillValue attribute- Specified by:
hasFillValuein interfaceEnhanceScaleMissingUnsigned
-
getFillValue
public double getFillValue()
Description copied from interface:EnhanceScaleMissingUnsignedreturn value of _FillValue attribute- Specified by:
getFillValuein interfaceEnhanceScaleMissingUnsigned
-
isFillValue
public boolean isFillValue(double val)
Description copied from interface:EnhanceScaleMissingUnsignedreturn true if val equals the _FillValue- Specified by:
isFillValuein interfaceEnhanceScaleMissingUnsigned
-
hasMissingValue
public boolean hasMissingValue()
Description copied from interface:EnhanceScaleMissingUnsignedtrue if Variable has missing_value attribute- Specified by:
hasMissingValuein interfaceEnhanceScaleMissingUnsigned
-
getMissingValues
public double[] getMissingValues()
Description copied from interface:EnhanceScaleMissingUnsignedreturn values of missing_value attributes- Specified by:
getMissingValuesin interfaceEnhanceScaleMissingUnsigned
-
isMissingValue
public boolean isMissingValue(double val)
Description copied from interface:EnhanceScaleMissingUnsignedreturn true if val equals a missing_value (low-level)- Specified by:
isMissingValuein interfaceEnhanceScaleMissingUnsigned
-
setFillValueIsMissing
@Deprecated public void setFillValueIsMissing(boolean b)
Deprecated.Use NetcdfDataset.builder()Description copied from interface:EnhanceScaleMissingUnsignedSet if _FillValue is considered isMissing().- Specified by:
setFillValueIsMissingin interfaceEnhanceScaleMissingUnsigned
-
setInvalidDataIsMissing
@Deprecated public void setInvalidDataIsMissing(boolean b)
Deprecated.Use NetcdfDataset.builder()Description copied from interface:EnhanceScaleMissingUnsignedset if valid_range is considered isMissing(); better set in constructor if possible- Specified by:
setInvalidDataIsMissingin interfaceEnhanceScaleMissingUnsigned
-
setMissingDataIsMissing
@Deprecated public void setMissingDataIsMissing(boolean b)
Deprecated.Use NetcdfDataset.builder()Description copied from interface:EnhanceScaleMissingUnsignedset if missing_data is considered isMissing(); better set in constructor if possible- Specified by:
setMissingDataIsMissingin interfaceEnhanceScaleMissingUnsigned
-
getScaledOffsetType
@Nullable public DataType getScaledOffsetType()
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
public DataType getUnsignedConversionType()
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.
-
getSignedness
public DataType.Signedness getSignedness()
Description copied from interface:EnhanceScaleMissingUnsignedReturns the signedness of the decorated variable.- Specified by:
getSignednessin interfaceEnhanceScaleMissingUnsigned- Returns:
- the signedness of the decorated variable.
-
applyScaleOffset
public double applyScaleOffset(Number value)
Description copied from interface:EnhanceScaleMissingUnsignedApply scale and offset to the specified value ifEnhanceScaleMissingUnsigned.hasScaleOffset(). Otherwise, just returnvalue.- Specified by:
applyScaleOffsetin interfaceEnhanceScaleMissingUnsigned
-
applyScaleOffset
public Array applyScaleOffset(Array data)
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:
data- convert this- Returns:
- converted data.
-
convertUnsigned
public Number convertUnsigned(Number value)
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
public Array convertUnsigned(Array in)
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.
-
convertMissing
public Number convertMissing(Number value)
Description copied from interface:EnhanceScaleMissingUnsigned- Specified by:
convertMissingin interfaceEnhanceScaleMissingUnsigned
-
convertMissing
public Array convertMissing(Array in)
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)
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.
-
toBuilder
public VariableDS.Builder<?> toBuilder()
Description copied from class:VariableTurn into a mutable Builder. Can use toBuilder().build() to copy.
-
addLocalFieldsToBuilder
protected VariableDS.Builder<?> addLocalFieldsToBuilder(VariableDS.Builder<? extends VariableDS.Builder<?>> builder)
-
builder
public static VariableDS.Builder<?> builder()
Get Builder for this class that allows subclassing.- See Also:
- "https://community.oracle.com/blogs/emcmanus/2010/10/24/using-builder-pattern-subclasses"
-
-