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

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

public class VIIRSRawApplicationPackets
extends RawApplicationPackets

Implements an algorithm for collecting VIIRS segmented or group packets into a cohesive unit so that blocks of them maybe written atomically into the RawApplicationPackets area for a VIIRS RDR file. The goal then of this class is to keep the segments together in each RawApplicationPackets and to put several together as designated before contents are then ready to be written to the RDR file.


Field Summary
private  long currentScanNumber
           
private  int scanCounter
           
private  int scansPerGranule
           
private  java.util.EnumSet<PacketName> sciPacketRange
           
private  Stats stats
           
 
Fields inherited from class gov.nasa.gsfc.drl.rtstps.core.output.hdf5.RawApplicationPackets
packetPool
 
Constructor Summary
VIIRSRawApplicationPackets(int allRDRId, int setNum)
          Constructor which attempts to read the RawApplicationPacket entry that pre-exists.
VIIRSRawApplicationPackets(int readId, int setNum, boolean usedByGranuleOnly)
           
VIIRSRawApplicationPackets(SpacecraftId satellite, int setNum, int scansPerGranule, PacketPool packetPool)
          Constructor for creating an nth instance of a VIIRS raw application data packet area
VIIRSRawApplicationPackets(Stats stats, SpacecraftId satellite, int setNum, int scansPerGranule, PacketPool packetPool)
           
 
Method Summary
 void close()
          Close out the RawApplicationPacket which writes the results to the HDF file and cleans up.
private  boolean isVIIRSSciencePacket(Packet p)
           
 boolean notFull_OLD(Packet p)
          Determine if the object will take more packets.
 boolean notFull(Packet p)
          Determine if the object will take more packets.
 void put(Packet p)
          The packet is stored until a packet transition which is checked in the notFull() method.
 boolean write(int hdfFile)
          Write the collected group of packets to the designated HDF file using the 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

currentScanNumber

private long currentScanNumber

scanCounter

private int scanCounter

scansPerGranule

private int scansPerGranule

sciPacketRange

private java.util.EnumSet<PacketName> sciPacketRange

stats

private Stats stats
Constructor Detail

VIIRSRawApplicationPackets

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

Parameters:
satellite - the name of the spacecraft
setNum - the set number

VIIRSRawApplicationPackets

public VIIRSRawApplicationPackets(Stats stats,
                                  SpacecraftId satellite,
                                  int setNum,
                                  int scansPerGranule,
                                  PacketPool packetPool)

VIIRSRawApplicationPackets

public VIIRSRawApplicationPackets(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

VIIRSRawApplicationPackets

public VIIRSRawApplicationPackets(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. For VIIRS there are two cases. First if the collection of packets into this particular RawApplication has not started, its considered to be not-full. Second if the scan number matches the current scan number, it is considered not-full. If the collection has started and the scan number changes, it is considered full and any collected packets should be written to the HDF

Specified by:
notFull in class RawApplicationPackets
Parameters:
p - packet to be written
Returns:
true or false
Throws:
RtStpsException

notFull_OLD

public boolean notFull_OLD(Packet p)
                    throws RtStpsException
Determine if the object will take more packets. For VIIRS there are two cases. First if the collection of packets into this particular RawApplication has not started, its considered to be not-full. Second if the scan number matches the current scan number, it is considered not-full. If the collection has started and the scan number changes, it is considered full and any collected packets should be written to the HDF

Parameters:
p - packet to be written
Returns:
true or false
Throws:
RtStpsException

isVIIRSSciencePacket

private boolean isVIIRSSciencePacket(Packet p)

put

public void put(Packet p)
         throws RtStpsException
The packet is stored until a packet transition which is checked in the notFull() method. When full the RawApplicationPacket should then be written to the HDF

Specified by:
put in class RawApplicationPackets
Parameters:
p - VIIRS science packet to be written
Throws:
RtStpsException - the packet is not a VIIRS science packet or the scan number does not match previous packets (notFull was not called first)

write

public boolean write(int hdfFile)
              throws RtStpsException
Write the collected group of packets to the designated HDF file using the handle

Overrides:
write in class RawApplicationPackets
Parameters:
hdfFile - handle to the HDF file
Returns:
true if the RawApplicationPacket was written, false if not
Throws:
any - HDF exceptions are wrapped in an RtStpsException
RtStpsException

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:
any - HDF exceptions are wrapped in an RtStpsException
RtStpsException