Package ucar.nc2.dataset
Class StructureDS
- java.lang.Object
-
- ucar.nc2.CDMNode
-
- ucar.nc2.Variable
-
- ucar.nc2.Structure
-
- ucar.nc2.dataset.StructureDS
-
- All Implemented Interfaces:
Comparable<VariableSimpleIF>
,Iterable<Attribute>
,AttributeContainer
,Enhancements
,VariableEnhanced
,ProxyReader
,VariableSimpleIF
- Direct Known Subclasses:
SequenceDS
,StructurePseudoDS
public class StructureDS extends Structure implements VariableEnhanced
An "enhanced" Structure.- See Also:
NetcdfDataset
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StructureDS.Builder<T extends StructureDS.Builder<T>>
-
Nested classes/interfaces inherited from class ucar.nc2.Variable
Variable.Cache
-
-
Field Summary
Fields Modifier and Type Field Description protected String
orgName
protected Structure
orgVar
protected ucar.nc2.dataset.EnhancementsImpl
proxy
-
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 StructureDS(NetcdfDataset ds, Group group, Structure parentStructure, String shortName, String dims, String units, String desc)
Deprecated.Use StructureDS.builder()StructureDS(NetcdfDataset ds, Group group, Structure parent, String shortName, Structure orgVar)
Deprecated.Use StructureDS.builder()protected
StructureDS(StructureDS.Builder<?> builder, Group parentGroup)
StructureDS(Group g, Structure orgVar)
Deprecated.Use StructureDS.builder()protected
StructureDS(NetcdfFile ncfile, Group group, String shortName)
Deprecated.Use StructureDS.builder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCoordinateSystem(CoordinateSystem p0)
Deprecated.Use StructureDS.builder()protected StructureDS.Builder<?>
addLocalFieldsToBuilder(StructureDS.Builder<? extends StructureDS.Builder<?>> b)
static StructureDS.Builder<?>
builder()
void
clearCoordinateSystems()
Deprecated.Use StructureDS.builder()protected ArrayStructure
convert(Array data, Section section)
protected StructureData
convert(StructureData orgData, int recno)
protected StructureDS
copy()
Deprecated.UsetoBuilder()
void
enhance(Set<NetcdfDataset.Enhance> mode)
Deprecated.do not usecom.google.common.collect.ImmutableList<CoordinateSystem>
getCoordinateSystems()
Get the list of Coordinate Systems for this Variable.String
getDescription()
Get the description of the Variable.DataType
getOriginalDataType()
When this wraps another Variable, get the original Variable's DataType.String
getOriginalName()
When this wraps another Variable, get the original Variable's DataType.Variable
getOriginalVariable()
A StructureDS may wrap another Structure.String
getUnitsString()
Get the Unit String for the Variable.Array
reallyRead(Variable client, Section section, CancelTask cancelTask)
public by accident, do not call directly.Array
reallyRead(Variable client, CancelTask cancelTask)
public by accident, do not call directly.void
removeCoordinateSystem(CoordinateSystem p0)
Deprecated.Use StructureDS.builder()Structure
select(List<String> memberNames)
Create a subset of the Structure consisting only of the given member variablesString
setName(String newName)
Deprecated.void
setOriginalVariable(Variable orgVar)
Deprecated.Use StructureDS.builder()void
setUnitsString(String units)
Deprecated.Use StructureDS.builder()StructureDS.Builder<?>
toBuilder()
Turn into a mutable Builder.-
Methods inherited from class ucar.nc2.Structure
addLocalFieldsToBuilder, addMemberVariable, calcElementSize, calcStructureSize, findVariable, getElementSize, getNameAndAttributes, getNumberOfMemberVariables, getStructureIterator, getStructureIterator, getVariableNames, getVariables, isCaching, isSubset, makeStructureMembers, readStructure, readStructure, readStructure, removeMemberVariable, replaceMemberVariable, select, setCaching, setImmutable, setMemberVariables, setParentGroup, writeCDL
-
Methods inherited from class ucar.nc2.Variable
_read, _read, _readScalarData, addAll, addAttribute, addLocalFieldsToBuilder, attributes, compareTo, createNewCache, equals, extraInfo, findAttribute, findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, findAttributeString, findDimensionIndex, getAttributes, getDAPName, getDAPName, getDatasetLocation, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNetcdfFile, getParentGroup, getParentGroupOrRoot, getParentStructure, getProxyReader, getRanges, getRank, getScalarData, getShape, getShape, getShapeAll, getShapeAsSection, getSize, getSizeToCache, getSPobject, hasCachedData, hashCode, invalidateCache, isCoordinateVariable, isEmpty, isImmutable, isMemberOfStructure, isMetadata, isScalar, isUnknownLength, isUnlimited, isVariableLength, lookupEnumString, read, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, readToByteChannel, readToStream, reduce, remove, removeAttribute, removeAttributeIgnoreCase, resetDimensions, resetShape, section, section, setCachedData, setCachedData, setDataType, setDimension, setDimensions, setDimensions, setDimensionsAnonymous, setElementSize, setEnumTypedef, setIsScalar, setProxyReader, setSizeToCache, setSPobject, setValues, setValues, slice, toString, toStringDebug, 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
-
StructureDS
@Deprecated protected StructureDS(NetcdfFile ncfile, Group group, String shortName)
Deprecated.Use StructureDS.builder()
-
StructureDS
@Deprecated public StructureDS(NetcdfDataset ds, Group group, Structure parentStructure, String shortName, String dims, String units, String desc)
Deprecated.Use StructureDS.builder()Constructor when theres no underlying variable. You better set the values too!- Parameters:
ds
- the containing NetcdfDataset.group
- the containing group; if null, use rootGroupparentStructure
- parent Structure, may be nullshortName
- variable shortName, must be unique within the Groupdims
- list of dimension names, space delimitedunits
- unit string (may be null)desc
- description (may be null)
-
StructureDS
@Deprecated public StructureDS(Group g, Structure orgVar)
Deprecated.Use StructureDS.builder()Create a StructureDS that wraps a Structure- Parameters:
g
- parent grouporgVar
- original Structure
-
StructureDS
@Deprecated public StructureDS(NetcdfDataset ds, Group group, Structure parent, String shortName, Structure orgVar)
Deprecated.Use StructureDS.builder()Wrap the given Structure, making it into a StructureDS. Delegate data reading to the original variable. Does not share cache, iosp. This is for NcML explicit mode- Parameters:
ds
- the containing NetcdfDataset.group
- the containing group; may not be nullparent
- parent Structure, may be nullshortName
- variable shortName, must be unique within the GrouporgVar
- the original Structure to wrap.
-
StructureDS
protected StructureDS(StructureDS.Builder<?> builder, Group parentGroup)
-
-
Method Detail
-
copy
@Deprecated protected StructureDS copy()
Deprecated.UsetoBuilder()
-
select
public Structure select(List<String> memberNames)
Description copied from class:Structure
Create a subset of the Structure consisting only of the given member variables
-
getOriginalVariable
public Variable getOriginalVariable()
A StructureDS may wrap another Structure.- Specified by:
getOriginalVariable
in interfaceVariableEnhanced
- Returns:
- original Structure or null
-
setOriginalVariable
@Deprecated public void setOriginalVariable(Variable orgVar)
Deprecated.Use StructureDS.builder()Set the Structure to wrap.- Specified by:
setOriginalVariable
in interfaceVariableEnhanced
- Parameters:
orgVar
- original Variable, must be a Structure
-
getOriginalDataType
public DataType getOriginalDataType()
When this wraps another Variable, get the original Variable's DataType.- Returns:
- original Variable's DataType
-
getOriginalName
public String getOriginalName()
When this wraps another Variable, get the original Variable's DataType.- Specified by:
getOriginalName
in interfaceVariableEnhanced
- Returns:
- original Variable's DataType
-
setName
@Deprecated public String setName(String newName)
Deprecated.Description copied from class:Variable
Set the short name, converting to valid CDM object name if needed.
-
reallyRead
public Array reallyRead(Variable client, CancelTask cancelTask) throws IOException
Description copied from class:Variable
public by accident, do not call directly.- Specified by:
reallyRead
in interfaceProxyReader
- Overrides:
reallyRead
in 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:Variable
public by accident, do not call directly.- Specified by:
reallyRead
in interfaceProxyReader
- Overrides:
reallyRead
in 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.
-
convert
protected ArrayStructure convert(Array data, Section section) throws IOException
- Throws:
IOException
-
convert
protected StructureData convert(StructureData orgData, int recno) throws IOException
- Throws:
IOException
-
enhance
@Deprecated public void enhance(Set<NetcdfDataset.Enhance> mode)
Deprecated.do not useDO NOT USE DIRECTLY. public by accident. recalc any enhancement info- Specified by:
enhance
in interfaceVariableEnhanced
-
clearCoordinateSystems
@Deprecated public void clearCoordinateSystems()
Deprecated.Use StructureDS.builder()Description copied from interface:VariableEnhanced
clear previous coordinate systems. if any- Specified by:
clearCoordinateSystems
in interfaceVariableEnhanced
-
addCoordinateSystem
@Deprecated public void addCoordinateSystem(CoordinateSystem p0)
Deprecated.Use StructureDS.builder()Description copied from interface:Enhancements
Add a CoordinateSystem to the dataset.- Specified by:
addCoordinateSystem
in interfaceEnhancements
- Parameters:
p0
- add this Coordinate System
-
removeCoordinateSystem
@Deprecated public void removeCoordinateSystem(CoordinateSystem p0)
Deprecated.Use StructureDS.builder()Description copied from interface:Enhancements
Remove a CoordinateSystem from the dataset.- Specified by:
removeCoordinateSystem
in interfaceEnhancements
- Parameters:
p0
- remove this coordinate system
-
getCoordinateSystems
public com.google.common.collect.ImmutableList<CoordinateSystem> getCoordinateSystems()
Description copied from interface:Enhancements
Get the list of Coordinate Systems for this Variable.- Specified by:
getCoordinateSystems
in interfaceEnhancements
- Returns:
- list of type CoordinateSystem; may be empty but not null.
-
getDescription
public String getDescription()
Description copied from class:Variable
Get 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:
getDescription
in interfaceEnhancements
- Specified by:
getDescription
in interfaceVariableSimpleIF
- Overrides:
getDescription
in classVariable
- Returns:
- description, or null if not found.
-
getUnitsString
public String getUnitsString()
Description copied from class:Variable
Get the Unit String for the Variable. Looks for the CDM.UNITS attribute value- Specified by:
getUnitsString
in interfaceEnhancements
- Specified by:
getUnitsString
in interfaceVariableSimpleIF
- Overrides:
getUnitsString
in classVariable
- Returns:
- unit string, or null if not found.
-
setUnitsString
@Deprecated public void setUnitsString(String units)
Deprecated.Use StructureDS.builder()Description copied from interface:VariableEnhanced
Set the Unit String for this Variable. Default is to use the CDM.UNITS attribute.- Specified by:
setUnitsString
in interfaceVariableEnhanced
- Parameters:
units
- unit string
-
toBuilder
public StructureDS.Builder<?> toBuilder()
Description copied from class:Structure
Turn into a mutable Builder. Can use toBuilder().build() to copy.
-
addLocalFieldsToBuilder
protected StructureDS.Builder<?> addLocalFieldsToBuilder(StructureDS.Builder<? extends StructureDS.Builder<?>> b)
-
builder
public static StructureDS.Builder<?> builder()
-
-