org.autoplot.cdf.CdfUtil

static methods supporting CdfFileDataSource

CdfUtil( )

Creates a new instance of CdfUtil


OPTION_INCLUDE_EMPTY_RECORDS

if "true", show empty records (true is default).


OPTION_IS_MASTER

if "true", then don't show the number of records.


OPTION_DEEP

if "true" then return more detailed descriptions in HTML


OPTION_DATA_ONLY

if "true" return only the data variables, not the support data.


OPTION_RANK_LIMIT

if greater than -1, then only read variables up to this rank.


doApplyAttributes

doApplyAttributes( java.util.Map attr1, org.das2.qds.MutablePropertyDataSet result, String os1, String constraint ) → void

apply the ISTP metadata to the dataset. This is used to implement master files, where metadata from one file can override the data within another. Do not use this, as its location will probably change.

Parameters

attr1 - the ISTP metadata
result - the data
os1 - if non-null, then modify the metadata for slice1
constraint - if non-null, then drop the render type.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc]


getDimensions

getDimensions( gov.nasa.gsfc.spdf.cdfj.CDFReader cdf, String variableName ) → int[]

This is cdf.getDimensions( variableName ), but then check varies to see if varies[0] is false (for rvariables). This will return "new int[0]" for scalar quantities like density.

Parameters

cdf - a CDFReader
variableName - a String

Returns:

the dimensions for each record.

[search for examples] [view on GitHub] [view on old javadoc]


getPlottable

getPlottable( gov.nasa.gsfc.spdf.cdfj.CDFReader cdf, boolean dataOnly, int rankLimit ) → java.util.Map

Return a map where keys are the names of the variables, and values are descriptions.

Parameters

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.

Returns:

map of parameter name to short description

[search for examples] [view on GitHub] [view on old javadoc]


getPlottable

getPlottable( gov.nasa.gsfc.spdf.cdfj.CDFReader cdf, java.util.Map options ) → java.util.LinkedHashMap

retrieve information about all the variables. A LinkedHashMap will be returned to preserve the order.

Parameters

cdf - a CDFReader
options - map of options like OPTION_DEEP and OPTION_DATA_ONLY

Returns:

a java.util.LinkedHashMap

[search for examples] [view on GitHub] [view on old javadoc]


getPlottable

getPlottable( gov.nasa.gsfc.spdf.cdfj.CDFReader cdf, boolean dataOnly, int rankLimit, java.util.Map options ) → java.util.Map

Return a map where keys are the names of the variables, and values are descriptions. This allows for a deeper query, getting detailed descriptions within the values, and also supports the mode where the master CDFs (used by the CDAWeb plugin) don't contain data and record counts should not be supported.

Parameters

cdf - a CDFReader
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.

Returns:

map of parameter name to short description

[search for examples] [view on GitHub] [view on old javadoc]


getRange

getRange( java.util.HashMap attrs ) → DatumRange

returns the range of the data by looking for the SCALEMIN/SCALEMAX params, or the required VALIDMIN/VALIDMAX parameters. This is not used.

Parameters

attrs - the properties for the variable

Returns:

the range

[search for examples] [view on GitHub] [view on old javadoc]


getScaleType

getScaleType( java.util.HashMap attrs ) → String

Parameters

attrs - a java.util.HashMap

Returns:

java.lang.String

[search for examples] [view on GitHub] [view on old javadoc]


getStringDataType

getStringDataType( int type ) → String

return the data type for the encoding. From https://cdaweb.gsfc.nasa.gov/pub/software/cdf/doc/cdf380/cdf38ifd.pdf page 41.

Parameters

type - integer type, such as 44 for CDF_FLOAT

Returns:

string like "CDF_FLOAT"

[search for examples] [view on GitHub] [view on old javadoc]


hasAttribute

hasAttribute( gov.nasa.gsfc.spdf.cdfj.CDFReader cdf, String var, String attrname ) → boolean

return true if the attribute is set for the variable.

Parameters

cdf - the cdf file reader
var - the variable name
attrname - the attribute name.

Returns:

true if the attribute is set for the variable.

[search for examples] [view on GitHub] [view on old javadoc]


jvmMemory

jvmMemory( QDataSet ds ) → int

returns the amount of JVM memory in bytes occupied by the dataset. This is an approximation, calculated by taking the element type size (e.g. float=4 bytes) times the number of elements for the dataset. This does not include the memory consumed by DEPEND_0, etc.

Parameters

ds - the ArrayDataSet, or TrArrayDataSet, or BufferDataSet.

Returns:

the approximate memory consumption in bytes

[search for examples] [view on GitHub] [view on old javadoc]


loadVariable

loadVariable( gov.nasa.gsfc.spdf.cdfj.CDFReader cdf, String svariable ) → org.das2.qds.MutablePropertyDataSet

Return the named variable as a QDataSet. This does not look at the metadata for DEPEND_0, etc, and only adds metadata to represent time units (e.g. the data is in TT2000) and ordinal data.

Parameters

cdf - the value of CDF
svariable - name of the variable

Returns:

the dataset

[search for examples] [view on GitHub] [view on old javadoc]


loadVariable

loadVariable( gov.nasa.gsfc.spdf.cdfj.CDFReader cdf, String svariable, long recStart, long recCount, long recInterval, int slice1, ProgressMonitor mon ) → org.das2.qds.MutablePropertyDataSet

Return the named variable as a QDataSet. This does not look at the metadata for DEPEND_0, etc, and only adds metadata to represent time units (e.g. the data is in TT2000) and ordinal data.

Parameters

cdf - the value of CDF
svariable - name of the variable
recStart - 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 slice
recInterval - 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.

Returns:

the dataset

[search for examples] [view on GitHub] [view on old javadoc]


maybeAddValidRange

maybeAddValidRange( java.util.Map props, org.das2.qds.MutablePropertyDataSet ds ) → void

add the valid range only if it looks like it is correct. It must contain some of the data.

Parameters

props - the properties for the variable
ds - the dataset to which the valid range would be added.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc]


maybeShorten

maybeShorten( String context, String name ) → String

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.

Parameters

context - a String
name - a String

Returns:

a String

[search for examples] [view on GitHub] [view on old javadoc]


wrapCdfData

Deprecated: use loadCdfVariable instead

wrapCdfData

Deprecated: use loadCdfVariable instead