public abstract class CDMUtil extends Object
| Constructor and Description |
|---|
CDMUtil() |
| Modifier and Type | Method and Description |
|---|---|
static dap4.core.util.Index |
cdmIndexToIndex(ucar.ma2.Index cdmidx) |
static int[] |
computeEffectiveShape(List<dap4.core.dmr.DapDimension> dimset)
Compute the shape inferred from a set of slices.
|
static boolean |
containsVLEN(List<ucar.nc2.Dimension> dimset)
Test if any dimension is variable length
|
static Object |
convertVector(dap4.core.dmr.DapType dsttype,
dap4.core.dmr.DapType srctype,
Object src)
Convert an array of one type of values to another type
|
static List<ucar.ma2.Range> |
createCDMRanges(List<dap4.core.util.Slice> slices) |
static List<dap4.core.util.Slice> |
createSlices(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 List<ucar.ma2.Range> |
dimsetToRanges(List<dap4.core.dmr.DapDimension> dimset)
Convert a Section + variable to a constraint
|
static double |
extractDoubleValue(dap4.core.dmr.TypeSort atomtype,
dap4.core.data.DataCursor dataset,
dap4.core.util.Index 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.TypeSort atomtype,
dap4.core.data.DataCursor dataset,
dap4.core.util.Index index)
Extract, as a long, value from a (presumably)
atomic typed array of values; dataset position
is presumed correct.
|
static String |
getChecksumString(byte[] checksum)
Given an arbitrary Array (including ArrayStructure), produce
a new Array that represents the slice defined by the
section.
|
static boolean |
hasVLEN(List<ucar.ma2.Range> ranges) |
static boolean |
hasVLEN(ucar.nc2.Variable v)
Test if any dimension is variable length
|
static ucar.ma2.Index |
indexToCcMIndex(dap4.core.util.Index d4) |
static boolean |
isWhole(List<ucar.ma2.Range> rangelist,
List<dap4.core.dmr.DapDimension> dimset,
int start,
int stop)
Test a List
|
static boolean |
isWhole(List<ucar.ma2.Range> rangelist,
List<dap4.core.util.Slice> slices)
Test a List
|
static boolean |
isWhole(List<ucar.ma2.Range> rangelist,
ucar.nc2.Variable var)
Test a List
|
static 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 List<dap4.core.util.Slice> createSlices(List<ucar.ma2.Range> rangelist) throws dap4.core.util.DapException
rangelist - the set of ucar.ma2.Rangedap4.core.util.DapExceptionpublic static boolean isWhole(List<ucar.ma2.Range> rangelist, 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(List<ucar.ma2.Range> rangelist, 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(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 List<ucar.ma2.Range> createCDMRanges(List<dap4.core.util.Slice> slices) throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic 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(List<ucar.ma2.Range> ranges)
public static boolean hasVLEN(ucar.nc2.Variable v)
public static boolean containsVLEN(List<ucar.nc2.Dimension> dimset)
public static int[] computeEffectiveShape(List<dap4.core.dmr.DapDimension> dimset)
dimset - from which to generate shapepublic static long extractLongValue(dap4.core.dmr.TypeSort atomtype,
dap4.core.data.DataCursor dataset,
dap4.core.util.Index index)
throws dap4.core.util.DapException
atomtype - type of object to extractdataset - Data containing the objectsindex - Which element of dataset to readucar.ma2.ForbiddenConversionException - if cannot convert to longdap4.core.util.DapExceptionpublic static double extractDoubleValue(dap4.core.dmr.TypeSort atomtype,
dap4.core.data.DataCursor dataset,
dap4.core.util.Index index)
throws dap4.core.util.DapException
atomtype - type of object to extractdataset - Data containing the objectsindex - Which element of dataset to readucar.ma2.ForbiddenConversionException - if cannot convert to doubledap4.core.util.DapExceptionpublic static Object convertVector(dap4.core.dmr.DapType dsttype, dap4.core.dmr.DapType srctype, Object src)
dsttype - target typesrctype - source typesrc - array of values to convertpublic static String getChecksumString(byte[] checksum)
param array the array from which the section is extracted param section determines what to extract throws DapException returns the slice array
public static List<ucar.ma2.Range> dimsetToRanges(List<dap4.core.dmr.DapDimension> dimset) throws dap4.core.util.DapException
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
dap4.core.util.DapExceptionpublic static List<dap4.core.util.Slice> shapeToSlices(int[] shape) throws dap4.core.util.DapException
dap4.core.util.DapExceptionpublic static dap4.core.util.Index cdmIndexToIndex(ucar.ma2.Index cdmidx)
public static ucar.ma2.Index indexToCcMIndex(dap4.core.util.Index d4)