public class FlatFileReader extends Object
Modifier and Type | Field and Description |
---|---|
private int |
band |
private int |
bandCount |
private boolean |
bigEndian |
private int |
dataScale |
private String |
delimiter |
private boolean |
eastPositive |
private int |
elements |
(package private) float[] |
floatData
the actual floats read from the file
|
private String |
interleave
The data parameters
|
private String |
latFile |
private int |
latlonScale |
private int |
lines
The dimensions
|
private String |
lonFile |
private double |
lrLat |
private double |
lrLon |
private int |
myFormat
which format this object is representing
|
private int |
myNavigation |
private int |
navElements |
(package private) CoordinateSystem |
navigationCoords |
(package private) Gridded2DSet |
navigationSet
cache the nav info when possible
|
private int |
navLines
The nav dimensions
|
private int |
offset |
private int |
stride |
private int |
strideElements |
private int |
strideLines |
private double |
ulLat
The nav parameters
|
private double |
ulLon |
private String |
unit |
private String |
url
The url
|
Constructor and Description |
---|
FlatFileReader()
Ctor for xml encoding
|
FlatFileReader(String filename)
CTOR
|
FlatFileReader(String filename,
int lines,
int elements)
CTOR
|
Modifier and Type | Method and Description |
---|---|
private 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) |
Data |
getData()
Return a valid data object for a DataSource
|
private Data |
getDataFromImage()
Make a FlatField from an Image
|
private FlatField |
getFlatField()
float array -> flatfield
|
float[] |
getFloats()
Return the array of floats making up the data
|
private Gridded2DSet |
getNavigationSetFromBounds()
Make a Gridded2DSet from bounds
|
private Gridded2DSet |
getNavigationSetFromFiles()
Make a Gridded2DSet from files
|
private void |
makeCoordinateSystem()
Create navigation info if it hasn't been built
|
private void |
readFloatsFromAscii()
Read floats from an ASCII file
|
private void |
readFloatsFromBinary()
Read floats from a binary file
|
void |
setAsciiInfo(String delimiter,
int dataScale) |
void |
setBinaryInfo(int format,
String interleave,
boolean bigEndian,
int offset,
int band,
int bandCount) |
void |
setEastPositive(boolean eastPositive) |
void |
setImageInfo() |
void |
setNavBounds(double ulLat,
double ulLon,
double lrLat,
double lrLon) |
void |
setNavFiles(String latFile,
String lonFile,
int latlonScale) |
void |
setStride(int stride) |
void |
setUnit(String unit) |
String |
toString()
toString
|
private int lines
private int elements
private int strideLines
private int strideElements
private int band
private int bandCount
private int stride
private int navLines
private int navElements
private String interleave
private boolean bigEndian
private int offset
private int dataScale
private double ulLat
private double ulLon
private double lrLat
private double lrLon
private int latlonScale
private boolean eastPositive
private int myFormat
private int myNavigation
float[] floatData
Gridded2DSet navigationSet
CoordinateSystem navigationCoords
public FlatFileReader()
public FlatFileReader(String filename)
filename
- The filenamepublic FlatFileReader(String filename, int lines, int elements)
filename
- The filenamelines
- The number of lineselements
- The number of elementsband
- The bandpublic void setBinaryInfo(int format, String interleave, boolean bigEndian, int offset, int band, int bandCount)
delimiter
- The data value delimiterdataScale
- The data scale factorpublic void setAsciiInfo(String delimiter, int dataScale)
delimiter
- The data value delimiterdataScale
- The data scale factorpublic void setImageInfo()
delimiter
- The data value delimiterdataScale
- The data scale factorpublic void setNavBounds(double ulLat, double ulLon, double lrLat, double lrLon)
ulLat
- The upper left latitudeulLon
- The upper left longitudelrLat
- The lower right latitudelrLon
- The lower right longitudepublic void setNavFiles(String latFile, String lonFile, int latlonScale)
ulLat
- The latitude fileulLon
- The longitude filelatlonScale
- The navigation value scalingpublic void setEastPositive(boolean eastPositive)
eastPositive
- public void setStride(int stride)
stride
- private void readFloatsFromBinary()
private void readFloatsFromAscii()
private Data getDataFromImage()
private Gridded2DSet getNavigationSetFromBounds()
private Gridded2DSet getNavigationSetFromFiles()
private void makeCoordinateSystem()
public float[] getFloats()
private FlatField getFlatField() throws IOException, VisADException
IOException
VisADException
private static int bytesTo1ByteUInt(byte[] bytes, int offset)
private static int bytesTo2ByteUInt(byte[] bytes, int offset)
private static int bytesTo2ByteSInt(byte[] bytes, int offset)
private static int bytesTo4ByteSInt(byte[] bytes, int offset)
private static float bytesTo4ByteFloat(byte[] bytes, int offset)
private static long bytesToLong(byte[] bytes)
private static double bytesToDouble(byte[] bytes)