public class VariableDS extends Variable implements VariableEnhanced, EnhanceScaleMissingUnsigned
NetcdfDataset| Modifier and Type | Class and Description |
|---|---|
static class |
VariableDS.Builder<T extends VariableDS.Builder<T>> |
Variable.Cache| Modifier and Type | Field and Description |
|---|---|
protected DataType |
orgDataType |
protected java.lang.String |
orgName |
protected Variable |
orgVar |
attributes, cache, dataType, debugCaching, defaultCoordsSizeToCache, defaultSizeToCache, dimensions, elementSize, hashCode, isVariableLength, ncfile, permitCaching, proxyReader, shape, sizeToCache, spiObjectannotations, dodsname, group, immutable, parentstruct, shortName, sort| Modifier | Constructor and Description |
|---|---|
|
VariableDS(Group group,
Structure parent,
java.lang.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,
java.lang.String shortName,
DataType dataType,
java.lang.String dims,
java.lang.String units,
java.lang.String desc)
Deprecated.
Use NetcdfDataset.builder()
|
protected |
VariableDS(VariableDS.Builder<?> builder,
Group parentGroup) |
protected |
VariableDS(VariableDS vds,
boolean isCopy)
Deprecated.
Use NetcdfDataset.builder()
|
| Modifier and Type | Method and Description |
|---|---|
protected Array |
_read() |
protected Array |
_read(Section section) |
void |
addCoordinateSystem(CoordinateSystem cs)
Deprecated.
Use VariableDS.builder()
|
boolean |
addEnhancement(NetcdfDataset.Enhance enhancement)
Deprecated.
Use NetcdfDataset.builder()
|
protected VariableDS.Builder<?> |
addLocalFieldsToBuilder(VariableDS.Builder<? extends VariableDS.Builder<?>> 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(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.
|
void |
clearCoordinateSystems()
Deprecated.
Use NetcdfDataset.builder()
|
Array |
convert(Array in,
boolean convertUnsigned,
boolean applyScaleOffset,
boolean convertMissing)
Deprecated.
use implementations in filters package
|
Array |
convertMissing(Array in)
|
java.lang.Number |
convertMissing(java.lang.Number value)
|
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) |
protected VariableDS |
copy()
Deprecated.
Use
toBuilder() |
void |
enhance(java.util.Set<NetcdfDataset.Enhance> enhancements)
Deprecated.
Use NetcdfDataset.builder()
|
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 |
hasCachedDataRecurse()
Deprecated.
Removed in v6
|
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 |
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()
|
java.lang.String |
setName(java.lang.String newName)
Deprecated.
Use NetcdfDataset.builder()
|
void |
setOriginalVariable(Variable orgVar)
Deprecated.
Use NetcdfDataset.builder()
|
void |
setUnitsString(java.lang.String units)
Deprecated.
Use NetcdfDataset.builder()
|
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.
|
_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, writeCDLannotate, annotation, getDODSName, getFullNameEscaped, getGroup, getImmutable, getName, getShortName, getSort, localhash, setDODSName, setParentStructure, setShortName, setSort, unwrapclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetFullName, getShortNamegetName, getShortNamefilter, findAttValueIgnoreCase, getName, hasAttribute, hasAttributeIgnoreCase, iteratorprotected Variable orgVar
protected DataType orgDataType
protected java.lang.String orgName
@Deprecated public VariableDS(NetcdfDataset ds, Group group, Structure parentStructure, java.lang.String shortName, DataType dataType, java.lang.String dims, java.lang.String units, java.lang.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, java.lang.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.@Deprecated protected VariableDS(VariableDS vds, boolean isCopy)
vds - copy from here.isCopy - called from copy()protected VariableDS(VariableDS.Builder<?> builder, Group parentGroup)
public NetcdfFile getNetcdfFile()
VariablegetNetcdfFile in class Variable@Deprecated protected VariableDS copy()
toBuilder()@Deprecated public void clearCoordinateSystems()
clearCoordinateSystems in interface VariableEnhanced@Deprecated public void enhance(java.util.Set<NetcdfDataset.Enhance> enhancements)
enhance in interface VariableEnhancedpublic java.util.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 VariableEnhancedorgVar - original Variable, must not be a Structurepublic DataType getOriginalDataType()
public java.lang.String getOriginalName()
getOriginalName in interface VariableEnhancedpublic java.lang.String lookupEnumString(int val)
VariablelookupEnumString in class Variableval - the integer value of this enum@Deprecated public java.lang.String setName(java.lang.String newName)
Variablepublic java.lang.String toStringDebug()
VariabletoStringDebug in class Variablepublic java.lang.String getDatasetLocation()
VariablegetDatasetLocation in class Variable@Deprecated public boolean hasCachedDataRecurse()
@Deprecated public void setCaching(boolean caching)
VariablesetCaching in class Variablecaching - set if caching.protected Array _read() throws java.io.IOException
protected Array _read(Section section) throws java.io.IOException, InvalidRangeException
_read in class Variablejava.io.IOExceptionInvalidRangeExceptionpublic Array reallyRead(Variable client, CancelTask cancelTask) throws java.io.IOException
VariablereallyRead in interface ProxyReaderreallyRead in class Variableclient - the client VariablecancelTask - user may canceljava.io.IOException - on errorpublic Array reallyRead(Variable client, Section section, CancelTask cancelTask) throws java.io.IOException, InvalidRangeException
VariablereallyRead in interface ProxyReaderreallyRead in class Variableclient - 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 long readToStream(Section section, java.io.OutputStream out) throws java.io.IOException, InvalidRangeException
VariablereadToStream in class Variablejava.io.IOExceptionInvalidRangeExceptionpublic Array getMissingDataArray(int[] shape)
shape - of this shapepublic void showScaleMissingProxy(java.util.Formatter f)
f - put info herepublic java.lang.String getDescription()
VariablegetDescription in interface EnhancementsgetDescription in interface VariableSimpleIFgetDescription in class Variablepublic java.lang.String getUnitsString()
VariablegetUnitsString in interface EnhancementsgetUnitsString in interface VariableSimpleIFgetUnitsString in class Variable@Deprecated public void setUnitsString(java.lang.String units)
VariableEnhancedsetUnitsString in interface VariableEnhancedunits - unit stringpublic com.google.common.collect.ImmutableList<CoordinateSystem> getCoordinateSystems()
EnhancementsgetCoordinateSystems in interface Enhancements@Deprecated public void addCoordinateSystem(CoordinateSystem cs)
EnhancementsaddCoordinateSystem in interface Enhancementscs - add this Coordinate System@Deprecated public void removeCoordinateSystem(CoordinateSystem cs)
EnhancementsremoveCoordinateSystem in interface Enhancementscs - remove this coordinate systempublic boolean hasScaleOffset()
EnhanceScaleMissingUnsignedhasScaleOffset in interface EnhanceScaleMissingUnsignedpublic double getScaleFactor()
EnhanceScaleMissingUnsigned1.0, i.e. no
scaling. It will remain that value if the variable defines no CDM.SCALE_FACTOR
attribute.getScaleFactor in interface EnhanceScaleMissingUnsignedpublic double getOffset()
EnhanceScaleMissingUnsignedCDM.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 EnhanceScaleMissingUnsignedpublic boolean hasMissing()
EnhanceScaleMissingUnsignedhasMissing in interface IsMissingEvaluatorhasMissing in interface EnhanceScaleMissingUnsignedpublic boolean isMissing(double val)
EnhanceScaleMissingUnsignedtrue if the argument is a missing value.
Note that Float.NaN and Double.NaN are considered missing data.isMissing in interface IsMissingEvaluatorisMissing in interface EnhanceScaleMissingUnsignedval - an unpacked value.true if the argument is a missing value.public boolean hasValidData()
EnhanceScaleMissingUnsignedhasValidData in interface EnhanceScaleMissingUnsignedpublic double getValidMin()
EnhanceScaleMissingUnsignedgetValidMin in interface EnhanceScaleMissingUnsignedpublic double getValidMax()
EnhanceScaleMissingUnsignedgetValidMax in interface EnhanceScaleMissingUnsignedpublic boolean isInvalidData(double val)
EnhanceScaleMissingUnsignedisInvalidData in interface EnhanceScaleMissingUnsignedpublic boolean hasFillValue()
EnhanceScaleMissingUnsignedhasFillValue in interface EnhanceScaleMissingUnsignedpublic double getFillValue()
EnhanceScaleMissingUnsignedgetFillValue in interface EnhanceScaleMissingUnsignedpublic boolean isFillValue(double val)
EnhanceScaleMissingUnsignedisFillValue in interface EnhanceScaleMissingUnsignedpublic boolean hasMissingValue()
EnhanceScaleMissingUnsignedhasMissingValue in interface EnhanceScaleMissingUnsignedpublic double[] getMissingValues()
EnhanceScaleMissingUnsignedgetMissingValues in interface EnhanceScaleMissingUnsignedpublic boolean isMissingValue(double val)
EnhanceScaleMissingUnsignedisMissingValue in interface EnhanceScaleMissingUnsigned@Deprecated public void setFillValueIsMissing(boolean b)
EnhanceScaleMissingUnsignedsetFillValueIsMissing in interface EnhanceScaleMissingUnsigned@Deprecated public void setInvalidDataIsMissing(boolean b)
EnhanceScaleMissingUnsignedsetInvalidDataIsMissing in interface EnhanceScaleMissingUnsignedpublic boolean missingDataIsMissing()
public boolean fillValueIsMissing()
public boolean invalidDataIsMissing()
@Deprecated public void setMissingDataIsMissing(boolean b)
EnhanceScaleMissingUnsignedsetMissingDataIsMissing in interface EnhanceScaleMissingUnsigned@Nullable public DataType getScaledOffsetType()
EnhanceScaleMissingUnsignednull if the
decorated variable lacks scale_factor or add_offset attributes. You can check with
EnhanceScaleMissingUnsigned.hasScaleOffset().getScaledOffsetType in interface EnhanceScaleMissingUnsignedpublic DataType getUnsignedConversionType()
EnhanceScaleMissingUnsignednull, 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 EnhanceScaleMissingUnsignedpublic DataType.Signedness getSignedness()
EnhanceScaleMissingUnsignedgetSignedness in interface EnhanceScaleMissingUnsignedpublic double applyScaleOffset(java.lang.Number value)
EnhanceScaleMissingUnsignedEnhanceScaleMissingUnsigned.hasScaleOffset(). Otherwise, just return value.applyScaleOffset in interface EnhanceScaleMissingUnsignedpublic Array applyScaleOffset(Array data)
EnhanceScaleMissingUnsignedin and return the result as a new Array, but only if
EnhanceScaleMissingUnsigned.hasScaleOffset(). Otherwise, just return value. Otherwise, just return data.applyScaleOffset in interface EnhanceScaleMissingUnsigneddata - convert thispublic java.lang.Number convertUnsigned(java.lang.Number value)
EnhanceScaleMissingUnsignedvalue 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 EnhanceScaleMissingUnsignedvalue - an integral number to convert.value.public java.lang.Number convertUnsigned(java.lang.Number value,
DataType dataType)
public Array convertUnsigned(Array in)
EnhanceScaleMissingUnsignedunsigned 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 EnhanceScaleMissingUnsignedin - an Array containing integral Numbers to convert.in.public java.lang.Number convertMissing(java.lang.Number value)
EnhanceScaleMissingUnsignedconvertMissing in interface EnhanceScaleMissingUnsignedpublic Array convertMissing(Array in)
EnhanceScaleMissingUnsignedconvertMissing in interface EnhanceScaleMissingUnsignedin - an array containing floating-point numbers to convert.in.@Deprecated public Array convert(Array in, boolean convertUnsigned, boolean applyScaleOffset, boolean convertMissing)
EnhanceScaleMissingUnsignedin 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 EnhanceScaleMissingUnsignedin - 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()
Variableprotected VariableDS.Builder<?> addLocalFieldsToBuilder(VariableDS.Builder<? extends VariableDS.Builder<?>> builder)
public static VariableDS.Builder<?> builder()