public abstract class CDMUtil
extends java.lang.Object
Constructor and Description |
---|
CDMUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Class |
cdmElementClass(DataType dt) |
static DapType |
cdmtype2daptype(DataType datatype,
boolean unsigned) |
static int[] |
computeEffectiveShape(java.util.List<DapDimension> dimset)
Compute the shape inferred from a set of slices.
|
static java.lang.Object |
convertVector(DapType dsttype,
DapType srctype,
java.lang.Object src)
Convert an array of one type of values to another type
|
static java.util.List<Range> |
createCDMRanges(java.util.List<Slice> slices) |
static java.util.List<Slice> |
createSlices(java.util.List<Range> rangelist)
Convert a list of ucar.ma2.Range to a list of Slice
More or less the inverst of create CDMRanges
|
static java.lang.Object |
createVector(AtomicType atype,
long count)
Given an arbitrary Array (including ArrayStructure), produce
a new Array that represents the slice defined by the
section.
|
static DataType |
daptype2cdmtype(DapType daptype) |
static int |
daptypeSize(AtomicType atomtype)
Conmpute the size, in databuffer,
of the daptype wrt to a serialization;
0 if undefined.
|
static java.util.List<Range> |
dimsetToRanges(java.util.List<DapDimension> dimset)
Convert a Section + variable to a constraint
static public View
sectionToView(CDMDSP dsp, Variable v, Section section)
throws DapException
{
if(section == null || section.getRank() == 0)
return null;
// Get the corresponding DapNode
DapVariable dv = (DapVariable) dsp.getNode().get(v);
if(dv == null)
throw new DapException("Variable has no corresponding dap node: " + v.getFullName());
// Get the structure path wrt DapDataset for dv
// and use path plus the Section to construct a constraint
List
|
static DataType |
enumtypefor(DapType dt) |
static double |
extractDoubleValue(AtomicType atomtype,
D4DataAtomic dataset,
int index)
Extract, as a double, value from a (presumably)
atomic typed array of values; dataset position
is presumed correct.
|
static long |
extractLongValue(AtomicType atomtype,
D4DataAtomic dataset,
long index)
Extract, as a long, value from a (presumably)
atomic typed array of values; dataset position
is presumed correct.
|
static java.lang.String |
getChecksumString(byte[] checksum) |
static boolean |
hasVLEN(java.util.List<Range> ranges) |
static boolean |
hasVLEN(Variable v)
Test if any dimension is variable length
|
static boolean |
isWhole(java.util.List<Range> rangelist,
java.util.List<DapDimension> dimset,
int start,
int stop)
Test a List
|
static boolean |
isWhole(java.util.List<Range> rangelist,
java.util.List<Slice> slices)
Test a List
|
static boolean |
isWhole(java.util.List<Range> rangelist,
Variable var)
Test a List
|
static java.util.List<Slice> |
shapeToSlices(int[] shape) |
static Variable |
unwrap(Variable var)
NetcdfDataset can end up wrapping a variable
in multiple wrapping classes (e.g.
|
static NetcdfFile |
unwrapfile(NetcdfFile file)
NetcdfDataset can wrap a NetcdfFile.
|
public static java.util.List<Slice> createSlices(java.util.List<Range> rangelist) throws DapException
rangelist
- the set of ucar.ma2.RangeDapException
public static boolean isWhole(java.util.List<Range> rangelist, java.util.List<DapDimension> dimset, int start, int stop) throws DapException
rangelist
- the set of ucar.ma2.Rangedimset
- the set of DapDimensionsstart
- start looking herestop
- stop looking hereDapException
public static boolean isWhole(java.util.List<Range> rangelist, java.util.List<Slice> slices) throws DapException
rangelist
- the set of ucar.ma2.Rangeslices
- the set of slicesDapException
public static boolean isWhole(java.util.List<Range> rangelist, Variable var) throws DapException
rangelist
- the set of ucar.ma2.Rangevar
- the cdm varDapException
public static java.util.List<Range> createCDMRanges(java.util.List<Slice> slices) throws java.io.IOException
java.io.IOException
public static Variable unwrap(Variable var)
var
- possibly wrapped variablepublic static NetcdfFile unwrapfile(NetcdfFile file)
file
- NetcdfFile or NetcdfDatasetpublic static boolean hasVLEN(java.util.List<Range> ranges)
public static boolean hasVLEN(Variable v)
public static int daptypeSize(AtomicType atomtype)
atomtype
- The type of interestpublic static java.lang.Class cdmElementClass(DataType dt)
public static int[] computeEffectiveShape(java.util.List<DapDimension> dimset)
dimset
- from which to generate shapepublic static long extractLongValue(AtomicType atomtype, D4DataAtomic dataset, long index) throws DataException
atomtype
- type of object to extractdataset
- D4Data containing the objectsindex
- Which element of dataset to readForbiddenConversionException
- if cannot convert to longDataException
public static double extractDoubleValue(AtomicType atomtype, D4DataAtomic dataset, int index) throws DataException
atomtype
- type of object to extractdataset
- D4Data containing the objectsindex
- Which element of dataset to readForbiddenConversionException
- if cannot convert to doubleDataException
public static java.lang.Object convertVector(DapType dsttype, DapType srctype, java.lang.Object src)
dsttype
- target typesrctype
- source typesrc
- array of values to convertpublic static java.lang.Object createVector(AtomicType atype, long count)
public static java.lang.String getChecksumString(byte[] checksum)
public static java.util.List<Range> dimsetToRanges(java.util.List<DapDimension> dimset) throws DapException
DapException
public static java.util.List<Slice> shapeToSlices(int[] shape) throws DapException
DapException