gov.nasa.gsfc.drl.rtstps.core.output.hdf5
Class ATMSRawApplicationPackets

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.output.hdf5.RawApplicationPackets
      extended by gov.nasa.gsfc.drl.rtstps.core.output.hdf5.ATMSRawApplicationPackets

public class ATMSRawApplicationPackets
extends RawApplicationPackets

Build the RawApplicationPackets (or read a pre-existing one) for the HDF for ATMS. The ATMS outputs scans of 104 packets. Groups of 3 of these are associated together. When the appid 528 packet arrives, the first one sets the scan start flag set, 103 ATMS packets should arrive before the next appid 528 packets should arrive. Somewhere near the end of this first scan group the 531 packet arrives. When it does, this signals the start of a group of 3 scans. This class "locks" on the first 3 group scans and counts out groups of them before writing them to the RawApplicationPackets area. The "scansPerGranule" should be in groups of 3, although this is not enforced as these form a single unit from processing standpoint. The initial set of scans received may be partial since we do not know when signal lock occurs, this is taken into account here so the first Granule/RawApp area is likely to be "short".


Field Summary
private  int maxScanGroup
           
private  java.util.List<Packet> scanFilling
           
private  int scanGroupCounter
           
private  int scanStarts
           
private  ATMSScanState scanState
           
 
Fields inherited from class gov.nasa.gsfc.drl.rtstps.core.output.hdf5.RawApplicationPackets
packetPool
 
Constructor Summary
ATMSRawApplicationPackets(int allRDRId, int setNum)
          Constructor which attempts to read the RawApplicationPacket entry that pre-exists.
ATMSRawApplicationPackets(int readId, int setNum, boolean usedByGranuleOnly)
           
ATMSRawApplicationPackets(SpacecraftId satellite, int setNum, int scansPerGranule, PacketPool packetPool)
          Constructor for creating an nth instance of a ATMS raw application data packet area builder.
 
Method Summary
 void close()
          Close out the RawApplicationPacket which writes the results to the HDF file and cleans up.
 boolean notFull(Packet p)
          Determine if the object will take more packets.
 void put(Packet p)
          The packet is stored on a local list until the state machine says it is full or complete.
private  void setScanState(Packet p)
          The ATMS state machine algorithm is built around the scan of packets appid 528 which are in groups of 3 as dictated by the appid 531 packet.
 boolean write(int hdfFile)
          Write the ATMSRawApplication structure to the given HDF file specified by the HDF input handle
 
Methods inherited from class gov.nasa.gsfc.drl.rtstps.core.output.hdf5.RawApplicationPackets
getAppIdCounts, getData, getDataSet, getDataSpace, getFirstTime, getLastTime, getPacketList, getPacketTypeCounts, getPacketTypes, getStaticHeader, getTimeSpan, getTotalPacketCounts, setFirstTime, setLastTime, updateAppIdCounters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scanFilling

private java.util.List<Packet> scanFilling

maxScanGroup

private int maxScanGroup

scanState

private ATMSScanState scanState

scanGroupCounter

private int scanGroupCounter

scanStarts

private int scanStarts
Constructor Detail

ATMSRawApplicationPackets

public ATMSRawApplicationPackets(SpacecraftId satellite,
                                 int setNum,
                                 int scansPerGranule,
                                 PacketPool packetPool)
Constructor for creating an nth instance of a ATMS raw application data packet area builder.

Parameters:
satellite - the name of the spacecraft as a SpacecraftId
setNum - the set number
scansPerGranule - the number of sensor scans per granule

ATMSRawApplicationPackets

public ATMSRawApplicationPackets(int allRDRId,
                                 int setNum)
                          throws RtStpsException
Constructor which attempts to read the RawApplicationPacket entry that pre-exists. The contents of the dataspace are read into a memory buffer... assuming it will fit.

Parameters:
allRDRId - the rdrAll Groups id
setNum - the set number of raw entry
Throws:
RtStpsException - Wraps any HDF exception

ATMSRawApplicationPackets

public ATMSRawApplicationPackets(int readId,
                                 int setNum,
                                 boolean usedByGranuleOnly)
                          throws RtStpsException
Throws:
RtStpsException
Method Detail

notFull

public boolean notFull(Packet p)
                throws RtStpsException
Determine if the object will take more packets. The ATMS is considered full when a certain number of scan groups have arrived. The scan groups are formed around 3s, from the arrival of packet 531. The 528 packets forms a single scan of 104 packets, and packet 531 arrives near end of single scan. The next two scans plus that one are one group. Although this algorithm doesn't specifically count groups, it accumulates all the packets in one list, in essence the 531s arrival initiates the "group counting" portion of the state machine. The state machine says when its full or not then...

Specified by:
notFull in class RawApplicationPackets
Parameters:
p - packet to be written
Returns:
true if not full, false if it is full
Throws:
RtStpsException - Wraps any HDF exception

put

public void put(Packet p)
         throws RtStpsException
The packet is stored on a local list until the state machine says it is full or complete. Note that the "notFull()" method must be called first and if it returns false, the write() method must be called next. This will write all the packets int the list to the HDF file and then this method can be called. If notFull() is true, then this routine should always be called next.

Specified by:
put in class RawApplicationPackets
Parameters:
p - ATMS science packet to be written (appid 514, 528, 530, 531)
Throws:
RtStpsException - an exception related to the state machine or wraps any HDF exception

write

public boolean write(int hdfFile)
              throws RtStpsException
Write the ATMSRawApplication structure to the given HDF file specified by the HDF input handle

Overrides:
write in class RawApplicationPackets
Parameters:
hdfFile - input handle to a previous opened HDF file
Returns:
true if the write succeeds
Throws:
RtStpsException - Wraps HDF exceptions

setScanState

private void setScanState(Packet p)
                   throws RtStpsException
The ATMS state machine algorithm is built around the scan of packets appid 528 which are in groups of 3 as dictated by the appid 531 packet. When a scan has the appid 531 packet, the next two are associate with that scan. This algorithm tracks scan, but takes into account a "short" or partial scan in the beginning...

Parameters:
p - an ATMS input packet to be processed through the scan state machine
Throws:
RtStpsException - Wraps HDF exceptions

close

public void close()
           throws RtStpsException
Close out the RawApplicationPacket which writes the results to the HDF file and cleans up.

Overrides:
close in class RawApplicationPackets
Throws:
RtStpsException