edu.wisc.ssec.mcidasv.data
Class FlatFileReader

java.lang.Object
  extended by edu.wisc.ssec.mcidasv.data.FlatFileReader

public class FlatFileReader
extends Object


Field Summary
private  int band
           
private  int bandCount
           
private  boolean bigEndian
           
private  int dataScale
           
private  String delimiter
           
private  boolean eastPositive
           
private  int elements
           
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 Summary
FlatFileReader()
          Ctor for xml encoding
FlatFileReader(String filename)
          CTOR
FlatFileReader(String filename, int lines, int elements)
          CTOR
 
Method Summary
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

url

private String url
The url


lines

private int lines
The dimensions


elements

private int elements

strideLines

private int strideLines

strideElements

private int strideElements

band

private int band

bandCount

private int bandCount

unit

private String unit

stride

private int stride

navLines

private int navLines
The nav dimensions


navElements

private int navElements

interleave

private String interleave
The data parameters


bigEndian

private boolean bigEndian

offset

private int offset

delimiter

private String delimiter

dataScale

private int dataScale

ulLat

private double ulLat
The nav parameters


ulLon

private double ulLon

lrLat

private double lrLat

lrLon

private double lrLon

latFile

private String latFile

lonFile

private String lonFile

latlonScale

private int latlonScale

eastPositive

private boolean eastPositive

myFormat

private int myFormat
which format this object is representing


myNavigation

private int myNavigation

floatData

private float[] floatData
the actual floats read from the file


navigationSet

Gridded2DSet navigationSet
cache the nav info when possible


navigationCoords

CoordinateSystem navigationCoords
Constructor Detail

FlatFileReader

public FlatFileReader()
Ctor for xml encoding


FlatFileReader

public FlatFileReader(String filename)
CTOR

Parameters:
filename - The filename

FlatFileReader

public FlatFileReader(String filename,
                      int lines,
                      int elements)
CTOR

Parameters:
filename - The filename
lines - The number of lines
elements - The number of elements
band - The band
Method Detail

setBinaryInfo

public void setBinaryInfo(int format,
                          String interleave,
                          boolean bigEndian,
                          int offset,
                          int band,
                          int bandCount)
Parameters:
delimiter - The data value delimiter
dataScale - The data scale factor

setAsciiInfo

public void setAsciiInfo(String delimiter,
                         int dataScale)
Parameters:
delimiter - The data value delimiter
dataScale - The data scale factor

setImageInfo

public void setImageInfo()
Parameters:
delimiter - The data value delimiter
dataScale - The data scale factor

setNavBounds

public void setNavBounds(double ulLat,
                         double ulLon,
                         double lrLat,
                         double lrLon)
Parameters:
ulLat - The upper left latitude
ulLon - The upper left longitude
lrLat - The lower right latitude
lrLon - The lower right longitude

setNavFiles

public void setNavFiles(String latFile,
                        String lonFile,
                        int latlonScale)
Parameters:
ulLat - The latitude file
ulLon - The longitude file
latlonScale - The navigation value scaling

setEastPositive

public void setEastPositive(boolean eastPositive)
Parameters:
eastPositive -

setStride

public void setStride(int stride)
Parameters:
stride -

setUnit

public void setUnit(String unit)
Parameters:
unit -

readFloatsFromBinary

private void readFloatsFromBinary()
Read floats from a binary file


readFloatsFromAscii

private void readFloatsFromAscii()
Read floats from an ASCII file


getDataFromImage

private Data getDataFromImage()
Make a FlatField from an Image


getNavigationSetFromBounds

private Gridded2DSet getNavigationSetFromBounds()
Make a Gridded2DSet from bounds


getNavigationSetFromFiles

private Gridded2DSet getNavigationSetFromFiles()
Make a Gridded2DSet from files


makeCoordinateSystem

private void makeCoordinateSystem()
Create navigation info if it hasn't been built


getData

public Data getData()
Return a valid data object for a DataSource


getFloats

public float[] getFloats()
Return the array of floats making up the data


getFlatField

private FlatField getFlatField()
                        throws IOException,
                               VisADException
float array -> flatfield

Throws:
IOException
VisADException

toString

public String toString()
toString

Overrides:
toString in class Object
Returns:
toString

bytesTo1ByteUInt

private static int bytesTo1ByteUInt(byte[] bytes,
                                    int offset)

bytesTo2ByteUInt

private static int bytesTo2ByteUInt(byte[] bytes,
                                    int offset)

bytesTo2ByteSInt

private static int bytesTo2ByteSInt(byte[] bytes,
                                    int offset)

bytesTo4ByteSInt

private static int bytesTo4ByteSInt(byte[] bytes,
                                    int offset)

bytesTo4ByteFloat

private static float bytesTo4ByteFloat(byte[] bytes,
                                       int offset)

bytesToLong

private static long bytesToLong(byte[] bytes)

bytesToDouble

private static double bytesToDouble(byte[] bytes)