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

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.output.hdf5.RDRProduct
All Implemented Interfaces:
java.util.Iterator<CommonDataSetObject>

public class RDRProduct
extends java.lang.Object
implements java.util.Iterator<CommonDataSetObject>

Create an RDR Product in the /Data_Products and provide methods to write the Aggregate and Granule or it can be used read a pre-existing RDR Product and its Aggregate, and any Granules in it. Implements the Iterator interface for this purpose.


Field Summary
private  Aggregate aggregate
           
private  Collection collection
           
private  long counter
           
private  DataSetType dataSetType
           
private  Granule firstGranule
           
private  long granuleCount
           
private  int hdfFile
           
private  Granule lastGranule
           
private  long numObjects
           
private  FixedDomainDescription processingDomain
           
private  int rdrGroup
           
private  RDRName rdrName
           
private  int rootGroup
           
private  Sensor sensor
           
 
Constructor Summary
RDRProduct(int hdfFile, int rootGroup, RDRName rdrName, Sensor sensor, Collection collection, DataSetType dataSetType, FixedDomainDescription processingDomain)
          Constructor for creating the specific RDR DataProduct, note this is package private so it must be used by a another class in this package to create instances of it.
RDRProduct(int dataProductHandle, RDRName rdrName)
          Constructor for reading the contents of a pre-existing RDR product.
 
Method Summary
 void close()
          Close the HDF group for this RDR Product
 Aggregate getAggregate()
          Return the Aggregate associated with this RDR Product
 PDSDate getBeginningDateTime()
          Return the beginning date of the first observation time (interpreted as the first packet with a time stamp)
 GranuleId getBeginningGranuleId()
          Return the first GranuleId for the first Granule in this RDR Product
 long getBeginningOrbit()
          Return the beginning orbit
 Collection getCollection()
          Return the Collection
 DataSetType getDataSetType()
          Return the DataSetType
 PDSDate getEndingDateTime()
          Return the ending date of the first observation time (interpreted as the last packet with a time stamp)
 GranuleId getEndingGranuleId()
          Return the last GranuleId for the last Granule in this RDR Product
 long getEndingOrbit()
          Return the ending orbit
 Granule getGranule(int granuleNumber)
          Get the granule designated by the granuleNumber.
 long getGranuleCount()
          Return the number of granules in the RDR Product
 Sensor getInstrument_Short_Name()
          Return the Instrument_Short_Name
 Collection getN_Collection_Short_Name()
          Return the N_Collection_Short_Name
 DataSetType getN_Dataset_Type_Tag()
          Return the N_Dataset_Type_Tag
 FixedDomainDescription getN_Processing_Domain()
          Return the N_Processing_Domain
 FixedDomainDescription getProcessingDomain()
          Return the FixedDomainDescription
 RDRName getRDRName()
          Return the RDRName
 Sensor getSensor()
          Return the Sensor
 boolean hasNext()
          Return true or false if there are more items in the RDR Product to read
 CommonDataSetObject next()
          Return either the next Granule or the Aggregate in a common object
 Aggregate readAggregate()
          Read the aggregate off the HDF file and return the Aggregate object populate with the info held there.
private  void readAttributes()
          Read the attributes associated with the RDR Product
 void remove()
           
 java.lang.String toString()
           
 void write(Aggregate aggregate)
          Write the Aggregate associated with this RDR Product
 void write(Granule granule)
          Write a Granule associated with this RDR Product
private  void writeAttributes()
          Write attributes to the RDR Product
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

hdfFile

private int hdfFile

rootGroup

private int rootGroup

rdrGroup

private int rdrGroup

rdrName

private RDRName rdrName

sensor

private Sensor sensor

collection

private Collection collection

dataSetType

private DataSetType dataSetType

processingDomain

private FixedDomainDescription processingDomain

aggregate

private Aggregate aggregate

firstGranule

private Granule firstGranule

lastGranule

private Granule lastGranule

granuleCount

private long granuleCount

numObjects

private long numObjects

counter

private long counter
Constructor Detail

RDRProduct

RDRProduct(int hdfFile,
           int rootGroup,
           RDRName rdrName,
           Sensor sensor,
           Collection collection,
           DataSetType dataSetType,
           FixedDomainDescription processingDomain)
     throws RtStpsException
Constructor for creating the specific RDR DataProduct, note this is package private so it must be used by a another class in this package to create instances of it. DataProducts

Parameters:
hdfFile - the HDF file handle
rootGroup - the "Data_Product" handle
rdrName - the RDR name of the product like "VIIRS_SCIENCE_RDR"
sensor - the sensor
collection - the collection
dataSetType - the dataSetType
processingDomain - the processing domain
Throws:
RtStpsException - wraps any HDF exceptions

RDRProduct

public RDRProduct(int dataProductHandle,
                  RDRName rdrName)
           throws RtStpsException
Constructor for reading the contents of a pre-existing RDR product. Give the name of product which must match in the Data_Products. Basically trying open "/Data_Products/SPACECRAFT-DIARY-RDR"

Parameters:
dataProductHandle - the "/Data_Products" handle
rdrName - the name of the RDR that should be in the /Data_Products, if not an exceptions it thrown
Throws:
RtStpsException - wraps any HDF exceptions
Method Detail

readAggregate

public Aggregate readAggregate()
                        throws RtStpsException
Read the aggregate off the HDF file and return the Aggregate object populate with the info held there. This is just a short-cut to the Iterator below.

Returns:
a Aggregate object
Throws:
RtStpsException - HDF exceptions are wrapped here

write

public void write(Aggregate aggregate)
           throws RtStpsException
Write the Aggregate associated with this RDR Product

Parameters:
aggregate - the Aggregate of interest
Throws:
RtStpsException - wraps any HDF exception

write

public void write(Granule granule)
           throws RtStpsException
Write a Granule associated with this RDR Product

Parameters:
granule - the Granule
Throws:
RtStpsException - wraps any HDF exception

getInstrument_Short_Name

public Sensor getInstrument_Short_Name()
Return the Instrument_Short_Name

Returns:
a Sensor

getN_Collection_Short_Name

public Collection getN_Collection_Short_Name()
Return the N_Collection_Short_Name

Returns:
a Collection

getN_Dataset_Type_Tag

public DataSetType getN_Dataset_Type_Tag()
Return the N_Dataset_Type_Tag

Returns:
a DataSetType

getN_Processing_Domain

public FixedDomainDescription getN_Processing_Domain()
Return the N_Processing_Domain

Returns:
a FixedDomainDescription

getRDRName

public RDRName getRDRName()
Return the RDRName

Returns:
an RDRName

getSensor

public Sensor getSensor()
Return the Sensor

Returns:
a Sensor

getCollection

public Collection getCollection()
Return the Collection

Returns:
a Collection

getDataSetType

public DataSetType getDataSetType()
Return the DataSetType

Returns:
a DataSetType

getProcessingDomain

public FixedDomainDescription getProcessingDomain()
Return the FixedDomainDescription

Returns:
a FixedDomainDescription

getAggregate

public Aggregate getAggregate()
Return the Aggregate associated with this RDR Product

Returns:
the Aggregate

getBeginningGranuleId

public GranuleId getBeginningGranuleId()
Return the first GranuleId for the first Granule in this RDR Product

Returns:
a GranuleId for the first Granule

getEndingGranuleId

public GranuleId getEndingGranuleId()
Return the last GranuleId for the last Granule in this RDR Product

Returns:
a GranuleId for the last Granule

getBeginningOrbit

public long getBeginningOrbit()
Return the beginning orbit

Returns:
a long containing the orbit

getEndingOrbit

public long getEndingOrbit()
Return the ending orbit

Returns:
a long containing the orbit

getBeginningDateTime

public PDSDate getBeginningDateTime()
Return the beginning date of the first observation time (interpreted as the first packet with a time stamp)

Returns:
a PDSDate containing the packet time

getEndingDateTime

public PDSDate getEndingDateTime()
Return the ending date of the first observation time (interpreted as the last packet with a time stamp)

Returns:
a PDSDate containing the packet time

getGranuleCount

public long getGranuleCount()
Return the number of granules in the RDR Product

Returns:
an int containing the count

close

public void close()
           throws RtStpsException
Close the HDF group for this RDR Product

Throws:
RtStpsException - wraps any HDF exception

writeAttributes

private void writeAttributes()
                      throws RtStpsException
Write attributes to the RDR Product

Throws:
RtStpsException - wraps any HDF exception

readAttributes

private void readAttributes()
                     throws RtStpsException
Read the attributes associated with the RDR Product

Throws:
RtStpsException - wraps any HDF exception

hasNext

public boolean hasNext()
Return true or false if there are more items in the RDR Product to read

Specified by:
hasNext in interface java.util.Iterator<CommonDataSetObject>
Returns:
true or false

next

public CommonDataSetObject next()
Return either the next Granule or the Aggregate in a common object

Specified by:
next in interface java.util.Iterator<CommonDataSetObject>
Returns:
either a granule or the aggregate as a CommonDataSetObject

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<CommonDataSetObject>

getGranule

public Granule getGranule(int granuleNumber)
                   throws RtStpsException
Get the granule designated by the granuleNumber.

Parameters:
granuleNumber - the granule with that number for example XXX-SCIENCE-RDR_Gran_0 would be retrieved if zero is given here
Returns:
the granule or null
Throws:
RtStpsException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object