Package edu.wisc.ssec.mcidasv.data
Class FlatFileReader
java.lang.Object
edu.wisc.ssec.mcidasv.data.FlatFileReader
Class that can read file formats associated with
FlatFileDataSource.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate intprivate booleanprivate intprivate Stringprivate booleanprivate intprivate float[]Float values read from the file.private StringData parametersprivate Stringprivate intprivate intDimensionsprivate static final org.slf4j.LoggerLogging object.private Stringprivate doubleprivate doubleprivate intFormat this object is representing.private intprivate int(package private) CoordinateSystem(package private) Gridded2DSetprivate intNav dimensionsprivate intprivate intprivate intprivate intprivate doubleNav parametersprivate doubleprivate Stringprivate StringThe url -
Constructor Summary
ConstructorsConstructorDescriptionCtor for xml encodingFlatFileReader(String filename) CTORFlatFileReader(String filename, int lines, int elements) CTOR -
Method Summary
Modifier and TypeMethodDescriptionprivate static intbytesTo1ByteUInt(byte[] bytes, int offset) private static intbytesTo2ByteSInt(byte[] bytes, int offset) private static intbytesTo2ByteUInt(byte[] bytes, int offset) private static floatbytesTo4ByteFloat(byte[] bytes, int offset) private static intbytesTo4ByteSInt(byte[] bytes, int offset) private static doublebytesToDouble(byte[] bytes) private static longbytesToLong(byte[] bytes) getData()Return a valid data object for a DataSource.private DataMake aFlatFieldfrom an Image.private FlatFieldfloat[]Return the array of floats making up the data.private Gridded2DSetMake a Gridded2DSet from bounds.private Gridded2DSetMake a Gridded2DSet from files.private voidCreate navigation info if it hasn't been builtprivate voidRead floats from an ASCII file.private voidRead floats from a binary file.voidsetAsciiInfo(String delimiter, int dataScale) Change format to ASCII.voidsetBinaryInfo(int format, String interleave, boolean bigEndian, int offset, int band, int bandCount) Set metadata required to properly read from file.voidsetEastPositive(boolean eastPositive) Specify whether or not East is positive.voidChange format to image.voidsetNavBounds(double ulLat, double ulLon, double lrLat, double lrLon) Set the geographic bounding box.voidsetNavFiles(String latFile, String lonFile, int latlonScale) Specify the files to use for navigation.voidsetStride(int stride) Change the "stride" to the specified value.voidChange the unit.toString()String representation of the currentFlatFileReader.
-
Field Details
-
logger
Logging object. -
url
The url -
lines
Dimensions -
elements
-
strideLines
-
strideElements
-
band
-
bandCount
-
unit
-
stride
-
interleave
Data parameters -
bigEndian
-
offset
-
delimiter
-
dataScale
-
ulLat
Nav parameters -
ulLon
-
lrLat
-
lrLon
-
latFile
-
lonFile
-
latlonScale
-
eastPositive
-
myFormat
Format this object is representing. Initial value isHeaderInfo.kFormatUnknown. -
floatData
Float values read from the file.
-
-
Constructor Details
-
FlatFileReader
public FlatFileReader()Ctor for xml encoding -
FlatFileReader
CTOR- Parameters:
filename- Filename to read.
-
FlatFileReader
CTOR- Parameters:
filename- Filename to read.lines- Number of lines.elements- Number of elements.
-
-
Method Details
-
setBinaryInfo
public void setBinaryInfo(int format, String interleave, boolean bigEndian, int offset, int band, int bandCount) Set metadata required to properly read from file.- Parameters:
format- New format.interleave- Interleaving type.bigEndian- Whether or not data is big endian.offset- Data offset within file being read.band- Band to read.bandCount- Total number of bands.
-
setAsciiInfo
Change format to ASCII.- Parameters:
delimiter- Data value delimiter.dataScale- Data scale factor.
-
setImageInfo
Change format to image. -
setEastPositive
Specify whether or not East is positive.- Parameters:
eastPositive- Whether or not East is positive.
-
setStride
Change the "stride" to the specified value.- Parameters:
stride- New stride value. Values less than one will result in the stride being set to one.
-
setUnit
Change the unit.- Parameters:
unit- New unit.
-
readFloatsFromBinary
Read floats from a binary file. -
readFloatsFromAscii
Read floats from an ASCII file. -
getDataFromImage
Make aFlatFieldfrom an Image.- Returns:
- VisAD data object built from contents of
url.
-
makeCoordinateSystem
Create navigation info if it hasn't been built -
getData
Return a valid data object for a DataSource.- Returns:
- VisAD data object representing what has been read.
-
getFloats
Return the array of floats making up the data.- Returns:
- Floats found within the file.
-
getFlatField
- Returns:
floatDataconverted into a VisADFlatField.- Throws:
IOException- if there was a general IO problem.VisADException- if there was a VisAD-related problem.
-
toString
String representation of the currentFlatFileReader. -
bytesTo1ByteUInt
-
bytesTo2ByteUInt
-
bytesTo2ByteSInt
-
bytesTo4ByteSInt
-
bytesTo4ByteFloat
-
bytesToLong
-
bytesToDouble
-