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 int
private int
private boolean
private int
private String
private boolean
private int
private float[]
Float values read from the file.private String
Data parametersprivate String
private int
private int
Dimensionsprivate static final org.slf4j.Logger
Logging object.private String
private double
private double
private int
Format this object is representing.private int
private int
(package private) CoordinateSystem
(package private) Gridded2DSet
private int
Nav dimensionsprivate int
private int
private int
private int
private double
Nav parametersprivate double
private String
private String
The url -
Constructor Summary
ConstructorsConstructorDescriptionCtor for xml encodingFlatFileReader
(String filename) CTORFlatFileReader
(String filename, int lines, int elements) CTOR -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
bytesTo1ByteUInt
(byte[] bytes, int offset) private static int
bytesTo2ByteSInt
(byte[] bytes, int offset) private static int
bytesTo2ByteUInt
(byte[] bytes, int offset) private static float
bytesTo4ByteFloat
(byte[] bytes, int offset) private static int
bytesTo4ByteSInt
(byte[] bytes, int offset) private static double
bytesToDouble
(byte[] bytes) private static long
bytesToLong
(byte[] bytes) getData()
Return a valid data object for a DataSource.private Data
Make aFlatField
from an Image.private FlatField
float[]
Return the array of floats making up the data.private Gridded2DSet
Make a Gridded2DSet from bounds.private Gridded2DSet
Make a Gridded2DSet from files.private void
Create navigation info if it hasn't been builtprivate void
Read floats from an ASCII file.private void
Read floats from a binary file.void
setAsciiInfo
(String delimiter, int dataScale) Change format to ASCII.void
setBinaryInfo
(int format, String interleave, boolean bigEndian, int offset, int band, int bandCount) Set metadata required to properly read from file.void
setEastPositive
(boolean eastPositive) Specify whether or not East is positive.void
Change format to image.void
setNavBounds
(double ulLat, double ulLon, double lrLat, double lrLon) Set the geographic bounding box.void
setNavFiles
(String latFile, String lonFile, int latlonScale) Specify the files to use for navigation.void
setStride
(int stride) Change the "stride" to the specified value.void
Change 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 aFlatField
from 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:
floatData
converted 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
-