HiRISE

HiRISE.HiPlan.PTF
Class State_File

java.lang.Object
  extended by HiRISE.HiPlan.PTF.State_File

public class State_File
extends Object

A representation of an MRO state file. The state file contains a list of SPICE kernels and related files that define the state of the Mars Reconnaissance Orbiter over a particular range of time.

This class is not a complete implementation of the state file specification. In particular, it lacks the "output" components (IPTF, IEXCL, DAYV, and ROLLP).

Version:
1.20
Author:
Jeremey Raynes, Drew Davidson - UA/PIRL
See Also:
"Mars Target Tool State File Software Interface Specification (JPL MRO SEQ039)"

Nested Class Summary
static class State_File.Comparator
          A comparator for state files.
static class State_File.Directories
          A set of directory absolute pathnames.
static class State_File.Validation_Exception
          An exception for reporting problems with the verification of a state file's data.
 
Field Summary
static String APPLICATION_GROUP
          The application group for state file parameters.
static String DEFAULT_DLINK_DIRECTORY
           
static String DEFAULT_EXCL_DIRECTORY
           
static String DEFAULT_LSK_DIRECTORY
           
static String DEFAULT_OPTG_DIRECTORY
           
static String DEFAULT_PCK_DIRECTORY
           
static String DEFAULT_ROLL_DIRECTORY
           
static String DEFAULT_SCLK_DIRECTORY
           
static String DEFAULT_SPK_DIRECTORY
           
static String DEFAULT_STATE_FILE_DIRECTORY
          The default location for MRO state files on the HiROC filesystem.
static String DLINK_DIRECTORY
           
static String EXCL_DIRECTORY
           
static String ID
          Class identification name with source code version and date.
static Pattern LONG_STATE_FILENAME
          The pattern describing the filenames of long MRO state files, which cover a two-week period.
static String LSK_DIRECTORY
           
static String MRO_SPK_REGEX
          The spacecraft ephemeris filename pattern.
static String OPTG_DIRECTORY
           
static String PCK_DIRECTORY
           
static String PLANETARY_SPK_REGEX
          The planetary ephemeris filename pattern.
static String ROLL_DIRECTORY
           
static String SCLK_DIRECTORY
           
static Pattern SHORT_STATE_FILENAME
          The pattern describing the filenames of short MRO state files, which cover a one-week period.
static String SPK_DIRECTORY
           
static String STATE_FILE_DIRECTORY
           
 
Constructor Summary
State_File(File file)
          Creates a new state file from an input file.
State_File(String filename)
          Creates a new state file from an input filename.
 
Method Summary
 boolean covers(double et)
          Determines whether this state file contains data for the given ephemeris time.
 Double getBegEt()
           
 Integer getCommentOrbitMax()
          Gets the allowed maximum orbit from the state file.
 Integer getCommentOrbitMin()
          Gets the allowed minimum orbit from the state file.
 String getDlinkPathname()
           
 Double getEndEt()
           
 List<String> getExclPathnames()
           
 String getFilename()
           
 String getLskPathname()
           
 String getMroSpkPathname()
          Gets the MRO SPK pathname.
 String getOptgPathname()
           
 String getPckPathname()
           
 String getPlanetarySpkPathname()
          Gets the planetary SPK pathname.
 List<String> getPtfPathnames()
           
 String getRollPathname()
           
 String getSclkPathname()
           
 List<String> getSpkPathnames()
           
 Double getStartEt()
          An alias for getBegEt().
static List<State_File> getStateFiles()
           
static List<State_File> getStateFiles(Configuration configuration)
           
static List<State_File> getStateFiles(String stateFileDirectory)
           
 List<String> getStates()
           
static void main(String... args)
          Invokes a state file demo application.
static State_File synthesizeFromPtf(String ptfPathname, Configuration configuration)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
Class identification name with source code version and date.

See Also:
Constant Field Values

PLANETARY_SPK_REGEX

public static final String PLANETARY_SPK_REGEX
The planetary ephemeris filename pattern. The "MTT State File Generation Process" document describes deNNN.bsp as the filename for a NAIF-supplied planetary ephemeris file. This pattern matches on at least three digits rather than limiting it to exactly three. It's difficult to predict whether NAIF will ever exceed three digits without know what those digits represent.

See Also:
Constant Field Values

MRO_SPK_REGEX

public static final String MRO_SPK_REGEX
The spacecraft ephemeris filename pattern. The "MTT State File Generation Process" document describes spk_psp_recRRRRR_BBBBB_EEEEE_p-vN.mttbin as the filename for a "trajectory prediction file" (a spacecraft SPK). RRRRR is the last reconstructed orbit included in the file. BBBBB is the first orbit in the file. EEEEE is the last orbit in the file. N is the version number. For each quantity, this pattern requires at least the specified number of digits, but it allows for more.

See Also:
Constant Field Values

APPLICATION_GROUP

public static final String APPLICATION_GROUP
The application group for state file parameters.

See Also:
Constant Field Values

STATE_FILE_DIRECTORY

public static final String STATE_FILE_DIRECTORY
See Also:
Constant Field Values

DEFAULT_STATE_FILE_DIRECTORY

public static final String DEFAULT_STATE_FILE_DIRECTORY
The default location for MRO state files on the HiROC filesystem. This directory will be searched for state files by the getStateFiles(String) method if no other directory name is supplied.

See Also:
Constant Field Values

LSK_DIRECTORY

public static final String LSK_DIRECTORY
See Also:
Constant Field Values

DEFAULT_LSK_DIRECTORY

public static final String DEFAULT_LSK_DIRECTORY
See Also:
Constant Field Values

SCLK_DIRECTORY

public static final String SCLK_DIRECTORY
See Also:
Constant Field Values

DEFAULT_SCLK_DIRECTORY

public static final String DEFAULT_SCLK_DIRECTORY
See Also:
Constant Field Values

PCK_DIRECTORY

public static final String PCK_DIRECTORY
See Also:
Constant Field Values

DEFAULT_PCK_DIRECTORY

public static final String DEFAULT_PCK_DIRECTORY
See Also:
Constant Field Values

SPK_DIRECTORY

public static final String SPK_DIRECTORY
See Also:
Constant Field Values

DEFAULT_SPK_DIRECTORY

public static final String DEFAULT_SPK_DIRECTORY
See Also:
Constant Field Values

OPTG_DIRECTORY

public static final String OPTG_DIRECTORY
See Also:
Constant Field Values

DEFAULT_OPTG_DIRECTORY

public static final String DEFAULT_OPTG_DIRECTORY
See Also:
Constant Field Values

EXCL_DIRECTORY

public static final String EXCL_DIRECTORY
See Also:
Constant Field Values

DEFAULT_EXCL_DIRECTORY

public static final String DEFAULT_EXCL_DIRECTORY
See Also:
Constant Field Values

ROLL_DIRECTORY

public static final String ROLL_DIRECTORY
See Also:
Constant Field Values

DEFAULT_ROLL_DIRECTORY

public static final String DEFAULT_ROLL_DIRECTORY
See Also:
Constant Field Values

DLINK_DIRECTORY

public static final String DLINK_DIRECTORY
See Also:
Constant Field Values

DEFAULT_DLINK_DIRECTORY

public static final String DEFAULT_DLINK_DIRECTORY
See Also:
Constant Field Values

SHORT_STATE_FILENAME

public static final Pattern SHORT_STATE_FILENAME
The pattern describing the filenames of short MRO state files, which cover a one-week period.


LONG_STATE_FILENAME

public static final Pattern LONG_STATE_FILENAME
The pattern describing the filenames of long MRO state files, which cover a two-week period.

Constructor Detail

State_File

public State_File(File file)
           throws Invalid_Argument_Exception,
                  IOException,
                  State_File.Validation_Exception
Creates a new state file from an input file. The state file's contents are validated during construction; if the state file is not valid according to the state file SIS, a validation exception is thrown.

The file argument cannot be null.

Parameters:
file - the file from which to create the state file.
Throws:
Invalid_Argument_Exception - if file is null.
IOException - if the file cannot be read.
State_File.Validation_Exception - if the state file contents are not valid.

State_File

public State_File(String filename)
           throws Invalid_Argument_Exception,
                  IOException,
                  State_File.Validation_Exception
Creates a new state file from an input filename. The state file's contents are validated during construction; if the state file is not valid according to the state file SIS, a validation exception is thrown.

The filename argument cannot be null or empty.

Parameters:
filename - the name of the file from which to create the state file.
Throws:
Invalid_Argument_Exception - if filename is null or empty.
IOException - if an unknown IO problem develops.
State_File.Validation_Exception - if the state file contents are not valid.
Method Detail

getFilename

public String getFilename()

getPckPathname

public String getPckPathname()

getLskPathname

public String getLskPathname()

getSpkPathnames

public List<String> getSpkPathnames()

getMroSpkPathname

public String getMroSpkPathname()
Gets the MRO SPK pathname. This method attempts to match against the MRO_SPK_REGEX to determine which of the SPKs in getSpkPathnames() is the MRO SPK; failing that, it blindly uses the first in the list.

Returns:
the MRO SPK; may be null.

getPlanetarySpkPathname

public String getPlanetarySpkPathname()
Gets the planetary SPK pathname. This method attempts to match against the PLANETARY_SPK_REGEX to determine which of the SPKs in getSpkPathnames() is the planetary SPK; failing that, it blindly uses the second in the list.

Returns:
the planetary SPK; may be null.

getOptgPathname

public String getOptgPathname()

getSclkPathname

public String getSclkPathname()

getRollPathname

public String getRollPathname()

getExclPathnames

public List<String> getExclPathnames()

getDlinkPathname

public String getDlinkPathname()

getPtfPathnames

public List<String> getPtfPathnames()

getBegEt

public Double getBegEt()

getStartEt

public Double getStartEt()
An alias for getBegEt().


getEndEt

public Double getEndEt()

getStates

public List<String> getStates()

getCommentOrbitMin

public Integer getCommentOrbitMin()
Gets the allowed minimum orbit from the state file.

This value is extracted from a comment in the JPL POST-produced state files, which exists outside the scope of the state file interface specification. It therefore is not perfectly reliable and is not even guaranteed to exist or actually be valid.

The comment is of the following form:

### Allowed orbits: 16113 through 16291

If the comment is not found in the file, or if one of the orbits is not an integer, or if the minimum is greater than the maximum, this method returns a null

Returns:
the comment-based allowed orbit minimum; may be null.
See Also:
getCommentOrbitMax()

getCommentOrbitMax

public Integer getCommentOrbitMax()
Gets the allowed maximum orbit from the state file.

This value is extracted from a comment in the JPL POST-produced state files, which exists outside the scope of the state file interface specification. It therefore is not perfectly reliable and is not even guaranteed to exist or actually be valid.

The comment is of the following form:

### Allowed orbits: 16113 through 16291

If the comment is not found in the file, or if one of the orbits is not an integer, or if the minimum is greater than the maximum, this method returns a null

Returns:
the comment-based allowed orbit maximum; may be null.
See Also:
getCommentOrbitMin()

covers

public boolean covers(double et)
Determines whether this state file contains data for the given ephemeris time.

Parameters:
et - the time in question.
Returns:
true if the state file covers the input time; false otherwise or if the start or end time is null.

getStateFiles

public static List<State_File> getStateFiles(String stateFileDirectory)
                                      throws FileNotFoundException
Throws:
FileNotFoundException

getStateFiles

public static List<State_File> getStateFiles(Configuration configuration)
                                      throws FileNotFoundException
Throws:
FileNotFoundException

getStateFiles

public static List<State_File> getStateFiles()
                                      throws FileNotFoundException
Throws:
FileNotFoundException

synthesizeFromPtf

public static State_File synthesizeFromPtf(String ptfPathname,
                                           Configuration configuration)
                                    throws FileNotFoundException,
                                           IOException,
                                           SPICE_Exception
Throws:
FileNotFoundException
IOException
SPICE_Exception

main

public static void main(String... args)
Invokes a state file demo application. Given one or more arguments, assumed to be state file pathnames, the application prints information about each.

Parameters:
args - state file pathnames.

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona