public abstract class NOAA1bReader extends EarthDataReader
http://www.saa.noaa.govThe class may be used in a general way as an earth data reader to retrieve calibrated AVHRR variable data and dataset information, or in a more specific way to retrieve raw scan line and header information. A selected subset of scan line and header attributes are available as needed to implement the interface of an Earth data reader. Where no access to the underlying data is supplied, the raw data may be used.
Modifier and Type | Class and Description |
---|---|
class |
NOAA1bReader.ArchiveHeader
The archive header class may be used to retrieve specific data
from the archive header of the dataset.
|
class |
NOAA1bReader.DataHeader
The data header class may be used to retrieve the header of the
dataset.
|
static class |
NOAA1bReader.LongitudeInterpolator
The
LongitudeInterpolator class performs longitude
interpolation using polar coordinates. |
class |
NOAA1bReader.ScanLine
The scan line class may be used to retrieve specific data from
one scan line of the dataset.
|
protected class |
NOAA1bReader.ScanLineCalibration
The
ScanLineCalibration class holds calibration
coefficients for one AVHRR scan line so that they may be used as
a key in storing calibration lookup tables. |
Modifier and Type | Field and Description |
---|---|
protected boolean |
archive
The archive header flag, true if we have an archive header.
|
protected int |
archiveHeaderSize
The size of the archive header for this dataset in bytes.
|
protected int |
attributeDataSize
The size of the scan line attributes section in bytes.
|
protected int |
dataHeaders
The number of data headers for this dataset.
|
static int |
GAC_NAVIGATION_END
The ending sample for GAC navigation.
|
static int |
GAC_NAVIGATION_START
The starting sample for GAC navigation.
|
static int |
GAC_NAVIGATION_STEP
The navigation step size for GAC navigation.
|
static int |
GAC_SAMPLES
The number of samples per line for GAC data.
|
protected NOAA1bReader.DataHeader |
header
The dataset header record, used for calibration.
|
protected java.nio.channels.FileChannel |
inputChannel
The input channel.
|
static int |
LAC_NAVIGATION_END
The ending sample for LAC navigation.
|
static int |
LAC_NAVIGATION_START
The starting sample for LAC navigation.
|
static int |
LAC_NAVIGATION_STEP
The navigation step size for LAC navigation.
|
static int |
LAC_SAMPLES
The number of samples per line for LAC data.
|
protected int |
lines
The number of scan lines in this dataset.
|
static int |
LOOKUP_TABLE_SIZE
The size of each calibration lookup table.
|
static int |
MAX_LOOKUP_TABLES
The maximum number of calibration lookup tables per channel.
|
static int |
MAX_SCAN_LINES
The maximum number of scan lines in the cache.
|
protected int |
navigationEnd
The ending sample for navigation.
|
protected int |
navigationStart
The starting sample for navigation.
|
protected int |
navigationStep
The navigation step size for navigation.
|
protected int |
records
The number of records in this dataset.
|
protected int |
recordSize
The size of the data header and records for this dataset in bytes.
|
protected int |
samples
The number of samples in this dataset.
|
protected java.util.Map<java.lang.Integer,NOAA1bReader.ScanLine> |
scanLineCache
The scan line cache.
|
protected int[] |
scanLineMap
The scan line map array mapping scan line number to record number.
|
protected int |
sensorWordSize
The sensor word size in bits.
|
static double |
SWATH_POLY_SIZE
The swath polynomial size in kilometers.
|
dataProjection, info, rawMetadataMap, variables
Modifier | Constructor and Description |
---|---|
protected |
NOAA1bReader(java.lang.String file)
Constructs a NOAA 1b reader from the specified file.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
checkFormat()
Checks the dataset format and throws an error if it is
incompatible with this reader.
|
void |
close()
Closes the reader and frees any resources.
|
protected abstract boolean |
getArchiveFlag()
Checks for an archive header and returns true if so.
|
abstract NOAA1bReader.ArchiveHeader |
getArchiveHeader()
Gets the archive header if it exists.
|
static byte[] |
getBytes(java.nio.ByteBuffer data,
int offset,
int length)
Gets a byte array from the specified byte buffer.
|
protected java.nio.ByteBuffer |
getDataBuffer(int start,
int length)
Gets a data buffer for the file with data from the specified region.
|
abstract NOAA1bReader.DataHeader |
getDataHeader()
Gets the data header.
|
static int |
getInt(java.nio.ByteBuffer data,
int offset)
Gets a signed 32-bit value from the specified byte buffer.
|
int |
getLines()
Gets the number of scan lines in this dataset.
|
static long |
getNBit(java.nio.ByteBuffer data,
int startOffset,
int valueOffset,
int bits)
Gets an n-bit value from the specified byte buffer.
|
protected DataVariable |
getPreviewImpl(int index)
Implementation for the subclass.
|
protected int |
getRecordStart(int record)
Gets the start of the record as a byte offset.
|
int |
getSamples()
Gets the number of samples per scan line in this dataset.
|
abstract NOAA1bReader.ScanLine |
getScanLine(int line,
int start,
int count)
Gets the scan line at the specified index.
|
static short |
getShort(java.nio.ByteBuffer data,
int offset)
Gets a signed 16-bit value from the specified byte buffer.
|
static short |
getUByte(java.nio.ByteBuffer data,
int offset)
Gets an unsigned 8-bit value from the specified byte buffer.
|
static long |
getUInt(java.nio.ByteBuffer data,
int offset)
Gets an unsigned 32-bit value from the specified byte buffer.
|
static int |
getUShort(java.nio.ByteBuffer data,
int offset)
Gets an unsigned 16-bit value from the specified byte buffer.
|
DataVariable |
getVariable(int index)
Creates a data variable object.
|
protected abstract java.lang.String[] |
getVariableNames()
Gets the variable names in this dataset.
|
float[] |
interpolateNavigation(float[] navData,
int lineIndex,
int variable,
int start,
int count)
Interpolates navigation data using the specified raw navigation
data and sample range.
|
float[] |
interpolateRawNavigation(int line,
int variable)
Interpolates the raw navigation data values for the specified
scan line.
|
boolean |
isArchive()
Gets the archive header flag, true if the dataset has an archive
header.
|
boolean |
isByteSwapped()
Determines if the data is byte swapped.
|
protected abstract boolean |
isNavigationUsable(int record,
java.nio.ByteBuffer buffer)
Gets the navigation data usability flag.
|
static boolean |
isPrint(byte b)
Determines if a byte is a valid printable ASCII character.
|
canUpdateNavigation, finalize, getAllGrids, getAllVariables, getCoordinateSystems, getDataFormat, getIndex, getInfo, getName, getPreview, getPreview, getRawMetadata, getSceneTime, getSource, getStatistics, getStatisticsVariables, getVariable, getVariables, getVariablesForSystem, putStatistics, setDataProjection, setUnitsMap, updateNavigation
public static final double SWATH_POLY_SIZE
public static final int LAC_NAVIGATION_START
public static final int LAC_NAVIGATION_END
public static final int LAC_NAVIGATION_STEP
public static final int GAC_NAVIGATION_START
public static final int GAC_NAVIGATION_END
public static final int GAC_NAVIGATION_STEP
public static final int LAC_SAMPLES
public static final int GAC_SAMPLES
public static final int LOOKUP_TABLE_SIZE
public static final int MAX_LOOKUP_TABLES
public static final int MAX_SCAN_LINES
protected java.nio.channels.FileChannel inputChannel
protected int lines
protected int records
protected int[] scanLineMap
protected int samples
protected boolean archive
protected NOAA1bReader.DataHeader header
protected int dataHeaders
protected int archiveHeaderSize
protected int recordSize
protected int attributeDataSize
protected int navigationStart
protected int navigationEnd
protected int navigationStep
protected int sensorWordSize
protected java.util.Map<java.lang.Integer,NOAA1bReader.ScanLine> scanLineCache
protected NOAA1bReader(java.lang.String file) throws java.io.IOException
file
- the file name to read.java.io.IOException
- if an error occurred reading the file data.protected int getRecordStart(int record)
protected abstract java.lang.String[] getVariableNames()
protected abstract boolean getArchiveFlag() throws java.io.IOException
java.io.IOException
public int getLines()
public int getSamples()
public boolean isArchive()
public abstract NOAA1bReader.ArchiveHeader getArchiveHeader() throws java.io.IOException
java.io.IOException
- if an error occurred reading the file data.public abstract NOAA1bReader.DataHeader getDataHeader() throws java.io.IOException
java.io.IOException
- if an error occurred reading the file data.public abstract NOAA1bReader.ScanLine getScanLine(int line, int start, int count) throws java.io.IOException
line
- the scan line index in the range [0..lines-1].start
- the starting sensor data sample.count
- the total number of sensor data samples. If the
count is 0, no sensor data is read.java.io.IOException
- if an error occurred reading the file
data or the scan line is marked as missing.NOAA1bReader.ScanLine
,
getLines()
protected abstract void checkFormat() throws java.io.IOException
java.io.IOException
public boolean isByteSwapped()
protected abstract boolean isNavigationUsable(int record, java.nio.ByteBuffer buffer) throws java.io.IOException
record
- the record to check for navigation (note this is
not the same as the line number used in the scan line
constructor).buffer
- the buffer to use for reading data.java.io.IOException
protected java.nio.ByteBuffer getDataBuffer(int start, int length) throws java.io.IOException
start
- the starting byte offset.length
- the length of the buffer.java.io.IOException
- if an error occurred reading the file.public static boolean isPrint(byte b)
public static byte[] getBytes(java.nio.ByteBuffer data, int offset, int length)
public static short getUByte(java.nio.ByteBuffer data, int offset)
public static int getUShort(java.nio.ByteBuffer data, int offset)
public static short getShort(java.nio.ByteBuffer data, int offset)
public static long getUInt(java.nio.ByteBuffer data, int offset)
public static long getNBit(java.nio.ByteBuffer data, int startOffset, int valueOffset, int bits)
data
- the byte buffer to extract data from.startOffset
- the starting offset into the byte buffer to count
n-bit data values from.valueOffset
- the number of n-bit values into the array to
extract an integer from.bits
- the number of bits in each value in the range [1..64].public static int getInt(java.nio.ByteBuffer data, int offset)
public float[] interpolateNavigation(float[] navData, int lineIndex, int variable, int start, int count)
navData
- the navigation data.lineIndex
- the scan line index in the range [0..lines-1].variable
- the navigation variable to interpolate. Special
actions may be taken depending on the variable.start
- the starting sensor data sample.count
- the total number of sensor data samples.NOAA1bReader.ScanLine.interpolateNavigation(float[],int)
public float[] interpolateRawNavigation(int line, int variable)
line
- the desired line for interpolation.variable
- the navigation variable for interpolation.java.lang.RuntimeException
- if not enough valid navigation lines are
available close to the specified line to perform an interpolation.NOAA1bReader.ScanLine.getRawNavigation(int)
protected DataVariable getPreviewImpl(int index) throws java.io.IOException
EarthDataReader
getPreviewImpl
in class EarthDataReader
java.io.IOException
EarthDataReader.getPreview(int)
public DataVariable getVariable(int index) throws java.io.IOException
EarthDataReader
getVariable
in class EarthDataReader
index
- the index of the variable to get. Indexing
starts at 0.java.io.IOException
- if the data source had I/O errors.EarthDataReader.getPreview(int)
public void close() throws java.io.IOException
EarthDataReader
close
in class EarthDataReader
java.io.IOException
- if the data source had I/O errors.