Package noaa.coastwatch.io.noaa1b
Class NOAA1bFile
java.lang.Object
noaa.coastwatch.io.noaa1b.NOAA1bFile
The
NOAA1bFile
is an interface for reading NOAA
1b weather satellite data files. The intention is to have a
uniform way of reading any NOAA 1b file format from any sensor
among the AVHRR and TOVS packages.- Since:
- 3.2.2
- Author:
- Peter Hollemans
-
Constructor Summary
ConstructorDescriptionNOAA1bFile
(String fileName) Opens a NOAA 1b data file for reading.NOAA1bFile
(String fileName, boolean isByteSwapped) Opens a NOAA 1b data file for reading. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the file.Gets the file archive header.terrenus.instrument.InstrumentData
getData
(int recordIndex) Gets the instrument data for the specified record.Gets the file data header.getDataRecord
(int recordIndex) Gets a file data record.getDataRecord
(int recordIndex, boolean readFull, ByteBuffer inputBuffer) Gets a file data record.int
Gets the file format version number.getInputBuffer
(int length) Gets an input buffer for record data with the correct byte order.terrenus.instrument.Instrument
Gets the instrument whose data is recorded in this file.int
Gets the number of data records in this file.static void
Tests this class.
-
Constructor Details
-
NOAA1bFile
Opens a NOAA 1b data file for reading. The byte order is assumed to be the standard big endian order that most NOAA 1b files are stored in.- Parameters:
fileName
- the NOAA 1b filename.- Throws:
IOException
- if an error occurred reading the file.
-
NOAA1bFile
Opens a NOAA 1b data file for reading.- Parameters:
fileName
- the NOAA 1b filename.isByteSwapped
- the byte swapped flag, true if the data is in little endian byte order.- Throws:
IOException
- if an error occurred reading the file.
-
-
Method Details
-
getFormatVersion
public int getFormatVersion()Gets the file format version number.- Returns:
- the format version in the range [1..n] where n is the latest version being produced by NOAA. The format version is obtained from the data header record.
-
getArchiveHeader
Gets the file archive header.- Returns:
- the archive header or null if not available.
-
getDataHeader
Gets the file data header.- Returns:
- the data header.
-
getInputBuffer
Gets an input buffer for record data with the correct byte order.- Parameters:
length
- the length of the buffer.- Returns:
- the buffer of byte values.
-
getDataRecord
public DataRecord getDataRecord(int recordIndex, boolean readFull, ByteBuffer inputBuffer) throws IOException Gets a file data record.- Parameters:
recordIndex
- the record to get in the range [0..getRecordCount()
-1].readFull
- the full record flag, true to read a full data record or false to only read the data record attributes (seeDataHeader.getRecordAttSize()
).inputBuffer
- the input buffer to use for reading or null to create a new one.- Returns:
- the data record.
- Throws:
IOException
- if an error occurred reading the record.
-
getDataRecord
Gets a file data record.- Parameters:
recordIndex
- the record to get in the range [0..getRecordCount()
-1].- Returns:
- the data record.
- Throws:
IOException
- if an error occurred reading the record.
-
getRecordCount
public int getRecordCount()Gets the number of data records in this file. -
getInstrument
public terrenus.instrument.Instrument getInstrument()Gets the instrument whose data is recorded in this file. -
getData
Gets the instrument data for the specified record.- Parameters:
recordIndex
- the record index for instrument data.- Returns:
- the instrument data for the specified record.
- Throws:
IOException
-
close
Closes the file.- Throws:
IOException
-
main
Tests this class.- Parameters:
argv
- the array of command line parameters.- Throws:
Exception
-