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

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

public class NPOESSFilename
extends java.lang.Object

Creates legal NPOESS (JPSS) filenames. The format is to mission specification.


Field Summary
private  java.util.Date creationDateAndTime
           
private static char creationDateCode
           
private  java.lang.String creationDateTimeStr
           
private static java.lang.String delimiter
           
private static FileCreationDateFormat dfCreation
           
private static DomainDescription drlDomain
           
private static FilenameTimefieldFormat eTime
           
private static java.lang.String extension
           
private  java.lang.String filename
           
private  int orbit
           
private static char orbitCode
           
private  java.lang.String orbitStr
           
private  Origin origin
           
private  java.util.List<ProductIdentifiers> productIds
           
private static java.lang.String productNameDelimiter
           
private  SpacecraftId spacecraftId
           
private static char startDateCode
           
private  java.lang.String startDateStr
           
private  java.util.Date startDateTime
           
private  java.lang.String startTimeStr
           
private  java.util.Date stopTime
           
private  java.lang.String stopTimeStr
           
private static FilenameTimefieldFormat tTime
           
private static java.lang.String usageStr
           
 
Constructor Summary
NPOESSFilename(java.util.List<ProductIdentifiers> productIds, java.util.Date startDateTime, java.util.Date stopTime, java.util.Date creationDateAndTime, SpacecraftId spacecraftId, int orbit, Origin origin)
          Create an NPOESS filename from a list of product identifiers (e.g.
NPOESSFilename(java.util.List<RDR> rdrs, PDSDate startDateTime, PDSDate stopTime, java.util.Date creationDateAndTime, SpacecraftId spacecraftId, int orbit, Origin origin)
          Create an filename from several RDRs (sensors).
NPOESSFilename(ProductIdentifiers productId, java.util.Date startDateTime, java.util.Date stopTime, java.util.Date creationDateAndTime, SpacecraftId spacecraftId, int orbit, Origin origin)
          Create an NPOESS filename from a product identifier (e.g.
NPOESSFilename(ProductIdentifiers productId, PDSDate startDateTime, PDSDate stopTime, java.util.Date creationDateAndTime, SpacecraftId spacecraftId, int orbit, Origin origin)
          Create an NPOESS filename from a product identifier (e.g.
NPOESSFilename(java.lang.String filename)
          De-construct a string into it constituent parts that is supposed to have a valid NPOESS filename.
 
Method Summary
 void addProductIdentifier(ProductIdentifiers productId)
          Add a product identifier to the name after the initial constructor has been issued
private  void buildFilename()
          build the filename -- this must be called once the item is updated and the string must be produced as it stands now it is lazily called in toString...
private  void commonInit(java.util.Date startDateTime, java.util.Date stopTime, java.util.Date creationDateAndTime, SpacecraftId spacecraftId, int orbit, Origin origin)
          A common method for initializing the key fields in the class
 java.util.Date getCreationDateAndTime()
          Return the clock creation date and time
 int getOrbit()
          Return the orbit of the pass this file is associated with
 Origin getOrigin()
          Return the origin of the packets associated with this file
 java.util.List<ProductIdentifiers> getProductIdentifiers()
          Get the product identifiers associated with this filename
 SpacecraftId getSpacecraftId()
          Return the spacecraft identifier
 java.util.Date getStartDateTime()
          Return the start date and time
 java.util.Date getStopTime()
          Return the stop date and time
private  void parseCreationDate(java.lang.String creationDateStr)
          Parse the creation date
private  void parseDomainDescription(java.lang.String domainStr)
          Parse the domain (e.g.
private  void parseExtension(java.lang.String extensionStr)
          Parse the extension (e.g.
private  void parseOrbitNumber(java.lang.String orbitStr)
          Parse the orbit sub-field
private  void parseOrigin(java.lang.String originStr)
          Parse the origin (e.g.
private  void parseProductIds(java.lang.String productIdsStr)
          Parse the product identifier(s) (e.g.
private  void parseSpacecraftId(java.lang.String spacecraftIdStr)
          Parse the spacecraft identifier (e.g.
private  void parseStartDateTime(java.lang.String startDateStr, java.lang.String startTimeStr)
          Parse the date and time
private  void parseStopTime(java.lang.String stopTimeStr)
          Parse the stop time
private  java.lang.String productIdsToString()
          make the list of product IDs into a ID0-ID1 style string maybe there's a better way to do this...?
static java.lang.String productIdsToString(java.util.List<RDR> rdrs)
          make the list of product IDs into a ID0-ID1 style string maybe there's a better way to do this...?
 void setCreationDateAndTime(java.util.Date creationDateAndTime)
          Set the creation date and time for the file
 void setOrbit(int orbit)
          Set the orbit number
 void setOrigin(Origin origen)
          Set the origen
 void setSpacecraftId(SpacecraftId spacecraftId)
          Set the spacecraft identifier
 void setStartDateTime(java.util.Date startDateTime)
          Set the start date and time
 void setStopTime(java.util.Date stopTime)
          Set the stop time
 java.lang.String toString()
          Once the filename is constructed it can be retrieved as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

eTime

private static FilenameTimefieldFormat eTime

tTime

private static FilenameTimefieldFormat tTime

dfCreation

private static FileCreationDateFormat dfCreation

productIds

private java.util.List<ProductIdentifiers> productIds

startDateTime

private java.util.Date startDateTime

stopTime

private java.util.Date stopTime

creationDateAndTime

private java.util.Date creationDateAndTime

startDateStr

private java.lang.String startDateStr

startTimeStr

private java.lang.String startTimeStr

stopTimeStr

private java.lang.String stopTimeStr

creationDateTimeStr

private java.lang.String creationDateTimeStr

spacecraftId

private SpacecraftId spacecraftId

orbit

private int orbit

origin

private Origin origin

orbitStr

private java.lang.String orbitStr

filename

private java.lang.String filename

delimiter

private static final java.lang.String delimiter
See Also:
Constant Field Values

productNameDelimiter

private static final java.lang.String productNameDelimiter
See Also:
Constant Field Values

drlDomain

private static final DomainDescription drlDomain

extension

private static final java.lang.String extension
See Also:
Constant Field Values

creationDateCode

private static final char creationDateCode
See Also:
Constant Field Values

orbitCode

private static final char orbitCode
See Also:
Constant Field Values

startDateCode

private static final char startDateCode
See Also:
Constant Field Values

usageStr

private static final java.lang.String usageStr
See Also:
Constant Field Values
Constructor Detail

NPOESSFilename

public NPOESSFilename(java.util.List<RDR> rdrs,
                      PDSDate startDateTime,
                      PDSDate stopTime,
                      java.util.Date creationDateAndTime,
                      SpacecraftId spacecraftId,
                      int orbit,
                      Origin origin)
Create an filename from several RDRs (sensors). Typical would be two: a science and spacecraft diary. However there is not technical limit.

Parameters:
rdrs - one or more RDRs (sensors) are in the RDR file
startDateTime - the first time of the first packet
stopTime - the last time of the last packet
creationDateAndTime - the clock time
spacecraftId - the spacecraft identifier such as NPP, etc...
orbit - the orbit of the pass the packets are from
origin - the origin of the information (DRL)

NPOESSFilename

public NPOESSFilename(ProductIdentifiers productId,
                      PDSDate startDateTime,
                      PDSDate stopTime,
                      java.util.Date creationDateAndTime,
                      SpacecraftId spacecraftId,
                      int orbit,
                      Origin origin)
Create an NPOESS filename from a product identifier (e.g. RATMS) and PDSDates which are from the packet time stamps

Parameters:
productId - a product identifier (e.g. RATMS)
startDateTime - the first packet's time in PDSDate format.
stopTime - the last packet's time
creationDateAndTime - the clock time
spacecraftId - the spacecraft identifier such as NPP, etc...
orbit - the orbit of the pass the packets are from
origin - the origin of the information (DRL)

NPOESSFilename

public NPOESSFilename(ProductIdentifiers productId,
                      java.util.Date startDateTime,
                      java.util.Date stopTime,
                      java.util.Date creationDateAndTime,
                      SpacecraftId spacecraftId,
                      int orbit,
                      Origin origin)
Create an NPOESS filename from a product identifier (e.g. RATMS) and Dates which are likely converted from packet time stamps

Parameters:
productId - a product identifier (e.g. RATMS)
startDateTime - the first packet's time in Date format.
stopTime - the last packet's time
creationDateAndTime - the clock time
spacecraftId - the spacecraft identifier such as NPP, etc...
orbit - the orbit of the pass the packets are from
origin - the origin of the information (DRL)

NPOESSFilename

public NPOESSFilename(java.util.List<ProductIdentifiers> productIds,
                      java.util.Date startDateTime,
                      java.util.Date stopTime,
                      java.util.Date creationDateAndTime,
                      SpacecraftId spacecraftId,
                      int orbit,
                      Origin origin)
Create an NPOESS filename from a list of product identifiers (e.g. RATMS, RNSCA_NPP) and Dates which are likely converted from packet time stamps

Parameters:
productIds - a product identifier (e.g. RATMS, RNSCA_NPP)
startDateTime - the first packet's time in Date format.
stopTime - the last packet's time
creationDateAndTime - the clock time
spacecraftId - the spacecraft identifier such as NPP, etc...
orbit - the orbit of the pass the packets are from
origin - the origin of the information (DRL)

NPOESSFilename

public NPOESSFilename(java.lang.String filename)
               throws RtStpsException
De-construct a string into it constituent parts that is supposed to have a valid NPOESS filename.

Parameters:
filename - the string containing the NPOESS filename
Throws:
java.text.ParseException - throws except for certain failures in parsing the name
RtStpsException
Method Detail

toString

public java.lang.String toString()
Once the filename is constructed it can be retrieved as a string. Or it will return the name passed into to the constructor which de-constructs filename strings. Calling this method recomputes the name if that's appropriate.

Overrides:
toString in class java.lang.Object
Returns:
the string containing the filename.

getProductIdentifiers

public java.util.List<ProductIdentifiers> getProductIdentifiers()
Get the product identifiers associated with this filename

Returns:
a List of ProductIdentifiers

getStartDateTime

public java.util.Date getStartDateTime()
Return the start date and time

Returns:
the start date and time as a Date

getStopTime

public java.util.Date getStopTime()
Return the stop date and time

Returns:
the stop date and time as a Date

getCreationDateAndTime

public java.util.Date getCreationDateAndTime()
Return the clock creation date and time

Returns:
the creation date and time as a Date

getSpacecraftId

public SpacecraftId getSpacecraftId()
Return the spacecraft identifier

Returns:
the SpacecraftId

getOrbit

public int getOrbit()
Return the orbit of the pass this file is associated with

Returns:
the orbit as an int

getOrigin

public Origin getOrigin()
Return the origin of the packets associated with this file

Returns:
the Origin

addProductIdentifier

public void addProductIdentifier(ProductIdentifiers productId)
Add a product identifier to the name after the initial constructor has been issued

Parameters:
productId - the ProductIdentifiers of interest

setStartDateTime

public void setStartDateTime(java.util.Date startDateTime)
Set the start date and time

Parameters:
startDateTime - a Date containing the new date/time

setStopTime

public void setStopTime(java.util.Date stopTime)
Set the stop time

Parameters:
stopTime - a Date containing the new time (any date information is ignored)

setCreationDateAndTime

public void setCreationDateAndTime(java.util.Date creationDateAndTime)
Set the creation date and time for the file

Parameters:
creationDateAndTime - a Date containing the new date/time

setSpacecraftId

public void setSpacecraftId(SpacecraftId spacecraftId)
Set the spacecraft identifier

Parameters:
spacecraftId - the new SpacecraftId

setOrbit

public void setOrbit(int orbit)
Set the orbit number

Parameters:
orbit - the orbit in an int

setOrigin

public void setOrigin(Origin origen)
Set the origen

Parameters:
origen - the new Origin

commonInit

private void commonInit(java.util.Date startDateTime,
                        java.util.Date stopTime,
                        java.util.Date creationDateAndTime,
                        SpacecraftId spacecraftId,
                        int orbit,
                        Origin origin)
A common method for initializing the key fields in the class

Parameters:
startDateTime -
stopTime -
creationDateAndTime -
spacecraftId -
orbit -
origin -

parseExtension

private void parseExtension(java.lang.String extensionStr)
                     throws RtStpsException
Parse the extension (e.g. ".h5")

Parameters:
extensionStr -
Throws:
java.text.ParseException
RtStpsException

parseDomainDescription

private void parseDomainDescription(java.lang.String domainStr)
                             throws RtStpsException
Parse the domain (e.g. "DRL")

Parameters:
domainStr -
Throws:
java.text.ParseException
RtStpsException

parseOrigin

private void parseOrigin(java.lang.String originStr)
                  throws RtStpsException
Parse the origin (e.g. "nfts")

Parameters:
originStr -
Throws:
java.text.ParseException
RtStpsException

parseCreationDate

private void parseCreationDate(java.lang.String creationDateStr)
                        throws RtStpsException
Parse the creation date

Parameters:
creationDateStr -
Throws:
java.text.ParseException
RtStpsException

parseOrbitNumber

private void parseOrbitNumber(java.lang.String orbitStr)
                       throws RtStpsException
Parse the orbit sub-field

Parameters:
orbitStr -
Throws:
java.text.ParseException
RtStpsException

parseStopTime

private void parseStopTime(java.lang.String stopTimeStr)
                    throws RtStpsException
Parse the stop time

Parameters:
stopTimeStr -
Throws:
java.text.ParseException
RtStpsException

parseStartDateTime

private void parseStartDateTime(java.lang.String startDateStr,
                                java.lang.String startTimeStr)
                         throws RtStpsException
Parse the date and time

Parameters:
startDateStr -
startTimeStr -
Throws:
java.text.ParseException
RtStpsException

parseSpacecraftId

private void parseSpacecraftId(java.lang.String spacecraftIdStr)
                        throws RtStpsException
Parse the spacecraft identifier (e.g. "NPP")

Parameters:
spacecraftIdStr -
Throws:
java.text.ParseException
RtStpsException

parseProductIds

private void parseProductIds(java.lang.String productIdsStr)
                      throws RtStpsException
Parse the product identifier(s) (e.g. "RATMS")

Parameters:
productIdsStr -
Throws:
java.text.ParseException
RtStpsException

buildFilename

private void buildFilename()
build the filename -- this must be called once the item is updated and the string must be produced as it stands now it is lazily called in toString...


productIdsToString

private java.lang.String productIdsToString()
make the list of product IDs into a ID0-ID1 style string maybe there's a better way to do this...?


productIdsToString

public static java.lang.String productIdsToString(java.util.List<RDR> rdrs)
make the list of product IDs into a ID0-ID1 style string maybe there's a better way to do this...?