public class GenericReader extends MetaData
Constructor and Description |
---|
GenericReader(java.lang.String cdfFile)
Constructs a reader for the given CDF file.
|
GenericReader(java.net.URL url)
Constructs a reader for the given CDF URL.
|
Modifier and Type | Method and Description |
---|---|
double[] |
asDouble0(java.lang.String varName)
Returns all available values for the given scalar variable.
|
double[][] |
asDouble1(java.lang.String varName)
Returns all available values for the given variable of rank 1.
|
double[][][] |
asDouble2(java.lang.String varName)
Returns all available values for the given variable of rank 2.
|
double[][][][] |
asDouble3(java.lang.String varName)
Returns all available values for the given variable of rank 3.
|
java.lang.Object |
get(java.lang.String varName)
Returns all available values for the given variable.
|
java.nio.ByteBuffer |
getBuffer(java.lang.String threadName)
Returns data extracted by the named thread as ByteBuffer.After this method returns the ByteBuffer, threadName is forgotten.
|
java.nio.ByteBuffer |
getBuffer(java.lang.String varName,
java.lang.String targetType,
int[] recordRange,
boolean preserve)
Returns specified data as ByteBuffer of specified type.Order of the ByteBuffer is 'native'.Data is organized according to
storage model of the variable returned by rowMajority().
|
java.nio.ByteBuffer |
getBuffer(java.lang.String varName,
java.lang.String targetType,
int[] recordRange,
boolean preserve,
boolean useDirect)
Returns specified data as ByteBuffer of specified type.Order of the ByteBuffer is 'native'.Data is organized according to
storage model of the variable returned by rowMajority().
|
java.nio.ByteBuffer |
getBuffer(java.lang.String varName,
java.lang.String targetType,
int[] recordRange,
boolean preserve,
java.nio.ByteBuffer buffer) |
int |
getBufferCapacity(java.lang.String varName,
java.lang.String targetType,
int[] recordRange) |
java.lang.Object |
getLong(java.lang.String varName)
Returns all available values for the given long type variable.
|
double[] |
getOneD(java.lang.String varName,
boolean columnMajor)
Returns one dimensional representation of the values of a numeric
variable whose type is not INT8 or TT2000.
|
java.lang.Object |
getOneDArray(java.lang.String threadName,
boolean columnMajor)
Returns data extracted by the named thread as a one dimensional
array, organized according to specified row majority..
|
java.lang.Object |
getOneDArray(java.lang.String varName,
java.lang.String targetType,
int[] recordRange,
boolean preserve,
boolean columnMajor)
Returns specified data as a one dimensional
array, organized according to specified row majority..
|
java.lang.Object |
getRange(java.lang.String varName,
int first,
int last)
Returns values for a range of records for the given numeric variable
of rank <= 2.
|
double[] |
getRangeForComponent(java.lang.String varName,
int first,
int last,
int component)
Returns values, in the specified record range, of the specified
component of 1 dimensional * variable of numeric types other than
INT8 or TT2000.
|
double[][] |
getRangeForComponents(java.lang.String varName,
int first,
int last,
int[] components)
Returns values, in the specified record range, of specified
components of 1 dimensional variable of numeric types other than
INT8 or TT2000.
|
double[] |
getRangeOneD(java.lang.String varName,
int first,
int last,
boolean columnMajor)
Returns one dimensional representation of the values
for a range of records of a numeric
variable whose type is not INT8 or TT2000.
|
java.lang.Object |
getSampled(java.lang.String varName,
int[] range,
int stride,
java.lang.String type,
boolean preserve,
boolean columnMajor)
Returns sampled values of a numeric variable as one dimensional
array of specified type and storage model.
|
java.lang.Object |
getSampled(java.lang.String varName,
int first,
int last,
int stride,
java.lang.String type,
boolean preserve)
Returns sampled values of a numeric variable as one dimensional
array of specified type.Data for records is organized according to the storage model of the
variable (as returned by rowMajority()).
|
java.lang.String |
getSource()
Returns the name of the source CDF
|
double[] |
getVectorComponent(java.lang.String varName,
int component)
Returns values of the specified component of 1 dimensional
variable of numeric types other than INT8 or TT2000.
|
double[][] |
getVectorComponents(java.lang.String varName,
int[] components)
Returns value of the specified component of 1 dimensional
variable of numeric types other than INT8 or TT2000.
|
boolean |
isScalar(java.lang.String varName)
Returns whether a variable is scalar.
|
boolean |
isVector(java.lang.String varName)
Returns whether a variable is vector.
|
boolean |
sourceIsFile() |
java.lang.String |
startContainerThread(java.lang.String varName,
java.lang.String targetType,
int[] recordRange,
boolean preserve)
Starts a new thread to extract specified data.
|
boolean |
threadFinished(java.lang.String threadName)
Returns whether the named thread (started via this object) has
finished.
|
java.lang.String |
userTimeVariableName(java.lang.String varName)
Returns the name of the user supplied time variable for
the given variable.
|
existsVariable, getAttribute, getAttribute, getAttributeEntries, getAttributeEntries, getBlockingFactor, getByteOrder, getDataItemSize, getDimensions, getEffectiveDimensions, getEffectiveRank, getElementCount, getGlobalAttribute, getLastLeapSecondId, getNumber, getNumberOfElements, getNumberOfValues, getPadValue, getPadValue, getRecordRange, getTimeVariableName, getType, getVariableNames, getVariableNames, getVarys, globalAttributeEntryCount, globalAttributeNames, isCompatible, isCompatible, isCompressed, isMissingRecords, isTimeType, isTypeR, missingRecordValueIsPad, missingRecordValueIsPrevious, recordVariance, rowMajority, variableAttributeNames
public GenericReader(java.lang.String cdfFile) throws CDFException.ReaderError
string
- CDFException.ReaderError
public GenericReader(java.net.URL url) throws CDFException.ReaderError
url
- CDFException.ReaderError
public final java.lang.Object get(java.lang.String varName) throws CDFException.ReaderError
varName
- variable name
Type of object returned depends on the number of varying dimensions
and type of the CDF variable.
For a numeric variable,
a double[], double[][], double[][][], or double[][][][] object is
returned for scalar, one-dimensional, two-dimensional, or
three-dimensional variable, respectively.
For a character string variable, a String[] or a String[][] object is returned for a scalar or one-dimensional variable.
CDFException.ReaderError
- for numeric variables of dimension higher than 3, and for
character string variables of dimension higher than 1.getOneD(String varName, boolean columnMajor)
public final java.lang.Object getLong(java.lang.String varName) throws CDFException.ReaderError
varName
- variable name
Type of object returned depends on the number of varying dimensions.
For a numeric variable,
a long[], long[][], long[][][], or long[][][][] object is
returned for scalar, one-dimensional, two-dimensional, or
three-dimensional variable, respectively.
CDFException.ReaderError
- for variables of type other than long, or dimension higher than 3.getOneD(String varName, boolean columnMajor)
public final double[] asDouble0(java.lang.String varName) throws CDFException.ReaderError
varName
- variable nameCDFException.ReaderError
- if variable is not a scalar, or is not a numeric typepublic final double[][] asDouble1(java.lang.String varName) throws CDFException.ReaderError
varName
- variable nameCDFException.ReaderError
- if effective rank of variable is not 1, or the variable is not numeric.public final double[][][] asDouble2(java.lang.String varName) throws CDFException.ReaderError
varName
- variable nameCDFException.ReaderError
- if effective rank of variable is not 2, or the variable is not numeric.public final double[][][][] asDouble3(java.lang.String varName) throws CDFException.ReaderError
varName
- variable nameCDFException.ReaderError
- if effective rank of variable is not 3, or the variable is not numeric.public final double[] getOneD(java.lang.String varName, boolean columnMajor) throws CDFException.ReaderError
varName
- variable namecolumnMajor
- specifies whether the returned array conforms
to a columnMajor storage mode, i.e. the first index of a multi
dimensional array varies the fastest.CDFException.ReaderError
- for character, INT8 or TT2000 typesget(String varName)
public final java.lang.Object getRange(java.lang.String varName, int first, int last) throws CDFException.ReaderError
varName
- variable namefirst
- first record of rangelast
- last record of range
Type of object returned depends on the number of varying dimensions
and type of the CDF variable.
For a numeric variable,
a double[], double[][], double[][][] object is
returned for scalar, one-dimensional, or two-dimensional
variable, respectively.
CDFException.ReaderError
- for non-numeric variables, or variables whose effective rank > 2getRangeOneD(String varName, int first, int last,
boolean columnMajor)
public final double[] getRangeOneD(java.lang.String varName, int first, int last, boolean columnMajor) throws CDFException.ReaderError
varName
- variable namefirst
- first record of rangelast
- last record of rangecolumnMajor
- specifies whether the returned array conforms
to a columnMajor storage mode, i.e. the first index of a multi
dimensional array varies the fastest.CDFException.ReaderError
- for character, INT8 or TT2000 typesgetRange(String varName, int first, int last)
public final double[] getVectorComponent(java.lang.String varName, int component) throws CDFException.ReaderError
varName
- variable namecomponent
- componentCDFException.ReaderError
- for character, INT8 or TT2000 types,
and if the variable's effective rank is not 1.get(String varName)
public final double[][] getVectorComponents(java.lang.String varName, int[] components) throws java.lang.Throwable
varName
- variable namecomponents
- array containg components to be extractedCDFException.ReaderError
- for character, INT8 or TT2000 types,
and if the variable's effective rank is not 1.java.lang.Throwable
get(String varName)
public final double[] getRangeForComponent(java.lang.String varName, int first, int last, int component) throws CDFException.ReaderError
varName
- variable namefirst
- first record of rangelast
- last record of rangecomponent
- componentCDFException.ReaderError
- for character, INT8 or TT2000 types,
and if the variable's effective rank is not 1.getRange(String varName, int first, int last)
public final double[][] getRangeForComponents(java.lang.String varName, int first, int last, int[] components) throws CDFException.ReaderError
varName
- variable namefirst
- first record of rangelast
- last record of rangecomponents
- componentsCDFException.ReaderError
- for character, INT8 or TT2000 types,
and if the variable's effective rank is not 1.getRange(String varName, int first, int last)
public final java.lang.String startContainerThread(java.lang.String varName, java.lang.String targetType, int[] recordRange, boolean preserve) throws CDFException.ReaderError
varName
- variable nametargetType
- desired type of extracted data - one of
the following: long, double, float, int, short,
byte or stringrecordRange
- preserve
- specifies whether the target must preserve
precision. if false, possible loss of precision
is deemed acceptable.CDFException.ReaderError
threadFinished(String threadName)
,
getOneDArray(String threadName, boolean columnMajor)
,
getBuffer(String threadName)
public final boolean threadFinished(java.lang.String threadName) throws CDFException.ReaderError
threadName
- CDFException.ReaderError
public final java.nio.ByteBuffer getBuffer(java.lang.String threadName) throws java.lang.Throwable
threadName
- java.lang.Throwable
public final java.lang.Object getOneDArray(java.lang.String threadName, boolean columnMajor) throws CDFException.ReaderError
threadName
- columnMajor
- CDFException.ReaderError
public final java.nio.ByteBuffer getBuffer(java.lang.String varName, java.lang.String targetType, int[] recordRange, boolean preserve) throws CDFException.ReaderError
varName
- variable nametargetType
- desired type of extracted datarecordRange
- preserve
- specifies whether the target must preserve
precision. if false, possible loss of precision
is deemed acceptable.CDFException.ReaderError
public final java.nio.ByteBuffer getBuffer(java.lang.String varName, java.lang.String targetType, int[] recordRange, boolean preserve, boolean useDirect) throws CDFException.ReaderError
varName
- variable nametargetType
- desired type of extracted datarecordRange
- preserve
- specifies whether the target must preserve
precision. if false, possible loss of precision
is deemed acceptable.useDirect
- specifies whether a DirectBuffer should be used.
if set to false, an array backed buffer will be
allocated.CDFException.ReaderError
public final java.lang.Object getOneDArray(java.lang.String varName, java.lang.String targetType, int[] recordRange, boolean preserve, boolean columnMajor) throws CDFException.ReaderError
varName
- variable nametargetType
- desired type of extracted datarecordRange
- preserve
- specifies whether the target must preserve
precision. if false, possible loss of precision
is deemed acceptable.columnMajor
- specifies whether the returned array conforms
to a columnMajor storage mode, i.e. the first index of a multi
dimensional array varies the fastest.CDFException.ReaderError
public final boolean sourceIsFile()
public final java.lang.String getSource()
public final boolean isScalar(java.lang.String varName) throws CDFException.ReaderError
varName
- CDFException.ReaderError
public final boolean isVector(java.lang.String varName) throws CDFException.ReaderError
varName
- CDFException.ReaderError
public java.lang.String userTimeVariableName(java.lang.String varName) throws CDFException.ReaderError
userTimeVariableName
in class MetaData
varName
- variable nameCDFException.ReaderError
- if variable does not existpublic java.lang.Object getSampled(java.lang.String varName, int[] range, int stride, java.lang.String type, boolean preserve, boolean columnMajor) throws CDFException.ReaderError
varName
- variable namerange
- stride
- array of length 1 where value specifies stridetype
- desired type of extracted data - one of
the following: "long", "double", "float", "int", "short",
or "byte"preserve
- specifies whether the target must preserve
precision. if false, possible loss of precision
is deemed acceptable.columnMajor
- specifies whether the returned array conforms
to a columnMajor storage mode, i.e. the first index of a multi
dimensional array varies the fastest.CDFException.ReaderError
public java.lang.Object getSampled(java.lang.String varName, int first, int last, int stride, java.lang.String type, boolean preserve) throws CDFException.ReaderError
varName
- variable namefirst
- stride
- array of length 1 where value specifies stridelast
- type
- desired type of extracted data - one of
the following: "long", "double", "float", "int", "short",
or "byte"preserve
- specifies whether the target must preserve
precision. if false, possible loss of precision
is deemed acceptable.CDFException.ReaderError
public final int getBufferCapacity(java.lang.String varName, java.lang.String targetType, int[] recordRange) throws CDFException.ReaderError
varName
- targetType
- recordRange
- CDFException.ReaderError
public final java.nio.ByteBuffer getBuffer(java.lang.String varName, java.lang.String targetType, int[] recordRange, boolean preserve, java.nio.ByteBuffer buffer) throws CDFException.ReaderError
varName
- targetType
- recordRange
- preserve
- buffer
- CDFException.ReaderError