public abstract class CDMUtil
extends java.lang.Object
| Constructor and Description |
|---|
CDMUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Class |
cdmElementClass(ucar.ma2.DataType dt) |
static dap4.core.dmr.DapType |
cdmtype2daptype(ucar.ma2.DataType datatype,
boolean unsigned) |
static int[] |
computeEffectiveShape(java.util.List<dap4.core.dmr.DapDimension> dimset)
Compute the shape inferred from a set of slices.
|
static java.lang.Object |
convertVector(dap4.core.dmr.DapType dsttype,
dap4.core.dmr.DapType srctype,
java.lang.Object src)
Convert an array of one type of values to another type
|
static java.util.List<ucar.ma2.Range> |
createCDMRanges(java.util.List<dap4.core.util.Slice> slices) |
static java.util.List<dap4.core.util.Slice> |
createSlices(java.util.List<ucar.ma2.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(dap4.core.dmr.AtomicType atype,
long count)
Given an arbitrary Array (including ArrayStructure), produce
a new Array that represents the slice defined by the
section.
|
static ucar.ma2.DataType |
daptype2cdmtype(dap4.core.dmr.DapType daptype) |
static int |
daptypeSize(dap4.core.dmr.AtomicType atomtype)
Conmpute the size, in databuffer,
of the daptype wrt to a serialization;
0 if undefined.
|
static java.util.List<ucar.ma2.Range> |
dimsetToRanges(java.util.List<dap4.core.dmr.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 ucar.ma2.DataType |
enumtypefor(dap4.core.dmr.DapType dt) |
static double |
extractDoubleValue(dap4.core.dmr.AtomicType atomtype,
dap4.dap4shared.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(dap4.core.dmr.AtomicType atomtype,
dap4.dap4shared.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<ucar.ma2.Range> ranges) |
static boolean |
hasVLEN(ucar.nc2.Variable v)
Test if any dimension is variable length
|
static boolean |
isWhole(java.util.List<ucar.ma2.Range> rangelist,
java.util.List<dap4.core.dmr.DapDimension> dimset,
int start,
int stop)
Test a List
|
static boolean |
isWhole(java.util.List<ucar.ma2.Range> rangelist,
java.util.List<dap4.core.util.Slice> slices)
Test a List
|
static boolean |
isWhole(java.util.List<ucar.ma2.Range> rangelist,
ucar.nc2.Variable var)
Test a List
|
static java.util.List<dap4.core.util.Slice> |
shapeToSlices(int[] shape) |
static ucar.nc2.Variable |
unwrap(ucar.nc2.Variable var)
NetcdfDataset can end up wrapping a variable
in multiple wrapping classes (e.g.
|
static ucar.nc2.NetcdfFile |
unwrapfile(ucar.nc2.NetcdfFile file)
NetcdfDataset can wrap a NetcdfFile.
|
public static java.util.List<dap4.core.util.Slice> createSlices(java.util.List<ucar.ma2.Range> rangelist)
throws dap4.core.util.DapException
rangelist - the set of ucar.ma2.Rangedap4.core.util.DapExceptionpublic static boolean isWhole(java.util.List<ucar.ma2.Range> rangelist,
java.util.List<dap4.core.dmr.DapDimension> dimset,
int start,
int stop)
throws dap4.core.util.DapException
rangelist - the set of ucar.ma2.Rangedimset - the set of DapDimensionsstart - start looking herestop - stop looking heredap4.core.util.DapExceptionpublic static boolean isWhole(java.util.List<ucar.ma2.Range> rangelist,
java.util.List<dap4.core.util.Slice> slices)
throws dap4.core.util.DapException
rangelist - the set of ucar.ma2.Rangeslices - the set of slicesdap4.core.util.DapExceptionpublic static boolean isWhole(java.util.List<ucar.ma2.Range> rangelist,
ucar.nc2.Variable var)
throws dap4.core.util.DapException
rangelist - the set of ucar.ma2.Rangevar - the cdm vardap4.core.util.DapExceptionpublic static java.util.List<ucar.ma2.Range> createCDMRanges(java.util.List<dap4.core.util.Slice> slices)
throws java.io.IOException
java.io.IOExceptionpublic static ucar.nc2.Variable unwrap(ucar.nc2.Variable var)
var - possibly wrapped variablepublic static ucar.nc2.NetcdfFile unwrapfile(ucar.nc2.NetcdfFile file)
file - NetcdfFile or NetcdfDatasetpublic static boolean hasVLEN(java.util.List<ucar.ma2.Range> ranges)
public static boolean hasVLEN(ucar.nc2.Variable v)
public static ucar.ma2.DataType enumtypefor(dap4.core.dmr.DapType dt)
public static dap4.core.dmr.DapType cdmtype2daptype(ucar.ma2.DataType datatype,
boolean unsigned)
public static ucar.ma2.DataType daptype2cdmtype(dap4.core.dmr.DapType daptype)
public static int daptypeSize(dap4.core.dmr.AtomicType atomtype)
atomtype - The type of interestpublic static java.lang.Class cdmElementClass(ucar.ma2.DataType dt)
public static int[] computeEffectiveShape(java.util.List<dap4.core.dmr.DapDimension> dimset)
dimset - from which to generate shapepublic static long extractLongValue(dap4.core.dmr.AtomicType atomtype,
dap4.dap4shared.D4DataAtomic dataset,
long index)
throws dap4.core.data.DataException
atomtype - type of object to extractdataset - D4Data containing the objectsindex - Which element of dataset to readucar.ma2.ForbiddenConversionException - if cannot convert to longdap4.core.data.DataExceptionpublic static double extractDoubleValue(dap4.core.dmr.AtomicType atomtype,
dap4.dap4shared.D4DataAtomic dataset,
int index)
throws dap4.core.data.DataException
atomtype - type of object to extractdataset - D4Data containing the objectsindex - Which element of dataset to readucar.ma2.ForbiddenConversionException - if cannot convert to doubledap4.core.data.DataExceptionpublic static java.lang.Object convertVector(dap4.core.dmr.DapType dsttype,
dap4.core.dmr.DapType srctype,
java.lang.Object src)
dsttype - target typesrctype - source typesrc - array of values to convertpublic static java.lang.Object createVector(dap4.core.dmr.AtomicType atype,
long count)
public static java.lang.String getChecksumString(byte[] checksum)
public static java.util.List<ucar.ma2.Range> dimsetToRanges(java.util.List<dap4.core.dmr.DapDimension> dimset)
throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic static java.util.List<dap4.core.util.Slice> shapeToSlices(int[] shape)
throws dap4.core.util.DapException
dap4.core.util.DapException