public class CdfUtil
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CdfUtil.CdfVariableDescription
information about a variable.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
OPTION_DATA_ONLY
if "true" return only the data variables, not the support data.
|
static java.lang.String |
OPTION_DEEP
if "true" then return more detailed descriptions in HTML
|
static java.lang.String |
OPTION_INCLUDE_EMPTY_RECORDS
if "true", show empty records (true is default).
|
static java.lang.String |
OPTION_IS_MASTER
if "true", then don't show the number of records.
|
static java.lang.String |
OPTION_RANK_LIMIT
if greater than -1, then only read variables up to this rank.
|
| Constructor and Description |
|---|
CdfUtil()
Creates a new instance of CdfUtil
|
| Modifier and Type | Method and Description |
|---|---|
static void |
doApplyAttributes(java.util.Map<java.lang.String,java.lang.Object> attr1,
MutablePropertyDataSet result,
java.lang.String os1,
java.lang.String constraint)
apply the ISTP metadata to the dataset.
|
static int[] |
getDimensions(CDFReader cdf,
java.lang.String variableName)
This is cdf.getDimensions( variableName ), but then check varies
to see if varies[0] is false (for rvariables).
|
protected static int |
getEffectiveRank(boolean[] varies)
returns effective rank.
|
static java.util.Map<java.lang.String,java.lang.String> |
getPlottable(CDFReader cdf,
boolean dataOnly,
int rankLimit)
Return a map where keys are the names of the variables, and values are descriptions.
|
static java.util.Map<java.lang.String,java.lang.String> |
getPlottable(CDFReader cdf,
boolean dataOnly,
int rankLimit,
java.util.Map<java.lang.String,java.lang.String> options)
Return a map where keys are the names of the variables, and values are descriptions.
|
static java.util.LinkedHashMap<java.lang.String,CdfUtil.CdfVariableDescription> |
getPlottable(CDFReader cdf,
java.util.Map<java.lang.String,java.lang.String> options)
retrieve information about all the variables.
|
static DatumRange |
getRange(java.util.HashMap attrs)
returns the range of the data by looking for the SCALEMIN/SCALEMAX params,
or the required VALIDMIN/VALIDMAX parameters.
|
static java.lang.String |
getScaleType(java.util.HashMap attrs) |
static java.lang.String |
getStringDataType(int type)
return the data type for the encoding.
|
static boolean |
hasAttribute(CDFReader cdf,
java.lang.String var,
java.lang.String attrname)
return true if the attribute is set for the variable.
|
static int |
jvmMemory(QDataSet ds)
returns the amount of JVM memory in bytes occupied by the dataset.
|
static MutablePropertyDataSet |
loadVariable(CDFReader cdf,
java.lang.String svariable)
Return the named variable as a QDataSet.
|
static MutablePropertyDataSet |
loadVariable(CDFReader cdf,
java.lang.String svariable,
long recStart,
long recCount,
long recInterval,
int slice1,
ProgressMonitor mon)
Return the named variable as a QDataSet.
|
static void |
maybeAddValidRange(java.util.Map<java.lang.String,java.lang.Object> props,
MutablePropertyDataSet ds)
add the valid range only if it looks like it is correct.
|
static java.lang.String |
maybeShorten(java.lang.String context,
java.lang.String name)
abbreviate names, motivated by Cluster CDF files which have
Data__C1_CP_PEA_3DRH_cnts with DEPEND_0 of
time_tags__C1_CP_PEA_3DRH_cnts.
|
protected static int |
sizeOf(long itype)
returns the size of the data type in bytes.
|
static MutablePropertyDataSet |
wrapCdfData(CDFReader cdf,
java.lang.String svariable)
Deprecated.
use loadCdfVariable instead
|
static MutablePropertyDataSet |
wrapCdfData(CDFReader cdf,
java.lang.String svariable,
long recStart,
long recCount,
long recInterval,
int slice1,
boolean depend,
ProgressMonitor mon)
Deprecated.
use loadCdfVariable instead
|
public static final java.lang.String OPTION_INCLUDE_EMPTY_RECORDS
public static final java.lang.String OPTION_IS_MASTER
public static final java.lang.String OPTION_DEEP
public static final java.lang.String OPTION_DATA_ONLY
public static final java.lang.String OPTION_RANK_LIMIT
public static DatumRange getRange(java.util.HashMap attrs)
attrs - the properties for the variablepublic static java.lang.String getScaleType(java.util.HashMap attrs)
public static void maybeAddValidRange(java.util.Map<java.lang.String,java.lang.Object> props,
MutablePropertyDataSet ds)
props - the properties for the variableds - the dataset to which the valid range would be added.protected static int sizeOf(long itype)
itype - type of data, such as CDFConstants.CDF_FLOATprotected static int getEffectiveRank(boolean[] varies)
varies - array of boolean indicating if a dimension varies.public static MutablePropertyDataSet wrapCdfData(CDFReader cdf, java.lang.String svariable) throws java.lang.Exception
cdf - the value of CDFsvariable - name of the variablejava.lang.Exceptionpublic static MutablePropertyDataSet loadVariable(CDFReader cdf, java.lang.String svariable) throws java.lang.Exception
cdf - the value of CDFsvariable - name of the variablejava.lang.Exceptionpublic static MutablePropertyDataSet wrapCdfData(CDFReader cdf, java.lang.String svariable, long recStart, long recCount, long recInterval, int slice1, boolean depend, ProgressMonitor mon) throws java.lang.Exception
cdf - the value of CDFsvariable - name of the variablerecStart - the first record to retrieve (0 is the first record in the file).recCount - the number of records to retrieve, -1 means the record is flag for slicerecInterval - the number of records to increment, typically 1 (e.g. 2= every other record).slice1 - if non-negative, return the slice at this point.depend - if false, don't do the non-varying expansion.mon - progress monitor (currently not used), or null.java.lang.Exceptionpublic static MutablePropertyDataSet loadVariable(CDFReader cdf, java.lang.String svariable, long recStart, long recCount, long recInterval, int slice1, ProgressMonitor mon) throws java.lang.Exception
cdf - the value of CDFsvariable - name of the variablerecStart - the first record to retrieve (0 is the first record in the file).recCount - the number of records to retrieve, -1 means the record is flag for slicerecInterval - the number of records to increment, typically 1 (e.g. 2= every other record).slice1 - if non-negative, return the slice at this point.mon - progress monitor (currently not used), or null.java.lang.Exceptionpublic static int jvmMemory(QDataSet ds)
ds - the ArrayDataSet, or TrArrayDataSet, or BufferDataSet.public static java.lang.String getStringDataType(int type)
type - integer type, such as 44 for CDF_FLOATpublic static boolean hasAttribute(CDFReader cdf, java.lang.String var, java.lang.String attrname)
cdf - the cdf file readervar - the variable nameattrname - the attribute name.public static int[] getDimensions(CDFReader cdf, java.lang.String variableName) throws CDFException.ReaderError
cdf - variableName - CDFException.ReaderErrorpublic static java.util.Map<java.lang.String,java.lang.String> getPlottable(CDFReader cdf, boolean dataOnly, int rankLimit) throws java.lang.Exception
cdf - the cdf reader reference.dataOnly - show only the DATA and not SUPPORT_DATA. Note I reclaimed this parameter because I wasn't using it.rankLimit - show only variables with no more than this rank.java.lang.Exceptionpublic static java.util.LinkedHashMap<java.lang.String,CdfUtil.CdfVariableDescription> getPlottable(CDFReader cdf, java.util.Map<java.lang.String,java.lang.String> options) throws CDFException.ReaderError
cdf - options - map of options like OPTION_DEEP and OPTION_DATA_ONLYCDFException.ReaderErrorpublic static java.lang.String maybeShorten(java.lang.String context,
java.lang.String name)
context - name - public static java.util.Map<java.lang.String,java.lang.String> getPlottable(CDFReader cdf, boolean dataOnly, int rankLimit, java.util.Map<java.lang.String,java.lang.String> options) throws java.lang.Exception
cdf - dataOnly - show only the DATA and not SUPPORT_DATA. Note I reclaimed this parameter because I wasn't using it.rankLimit - show only variables with no more than this rank.options - see constants for parameter names.java.lang.Exceptionpublic static void doApplyAttributes(java.util.Map<java.lang.String,java.lang.Object> attr1,
MutablePropertyDataSet result,
java.lang.String os1,
java.lang.String constraint)
attr1 - the ISTP metadataresult - the dataos1 - if non-null, then modify the metadata for slice1constraint - if non-null, then drop the render type.