HiRISE

HiRISE.DTM
Class DTM_Verifier

java.lang.Object
  extended by HiRISE.DTM.DTM_Verifier

public class DTM_Verifier
extends Object

DTM Verifier is an application for validating and verifying the PDS labels of HiRISE Digital Terrain Models (DTMs) and Ortho-rectified images. The tests performed are described in the methods that begin with the word "check."

Version:
1.28
Author:
Steven Wirth - UA/HiRISE, Rodney Heyd - UA/HiRISE

Nested Class Summary
static class DTM_Verifier.ExitCode
          Exit Code Enumeration
 
Field Summary
static String DEBUG_DTM_PRODUCT_ID_PROP
           
static String DEFAULT_CONFIGURATION_FILENAME
          The default configuration file
static String ID
           
static int MAX_LINE_LENGTH
          The maximum number of bytes a single line in the label can have.
 
Constructor Summary
DTM_Verifier(File inputDir)
          Construct a new verifier given a directory to read product files from.
 
Method Summary
 void checkFile(File label)
          Perform file formatting tests on the product label.
 boolean checkLatitude(Parameter latitude)
          Checks that the input Parameter contains a valid latitude value
 boolean checkLongitude(Parameter longitude)
          Checks that the input Parameter contains a valid longitude value
 boolean checkMapProjection(Parameter projection)
          Checks that the input Parameter holds a valid map projection type.
 boolean checkNorthAzimuth(Parameter northAz, Parameter projection)
          Checks that the north azimuth setting is valid for the given input parameters.
 boolean checkOffset(Parameter offset, boolean isDTM)
          Checks that the input Parameter contains a valid OFFSET value.
 boolean checkProducerName(Parameter prodName)
          Tests that the producer name parameter has been set.
 boolean checkScaling(Parameter scale, boolean isDTM)
          Checks that the input Parameter contains a valid SCALE_FACTOR value.
 boolean checkSourceProductID(Parameter spid, boolean isDTM)
          Tests that the SOURCE_PRODUCT_ID parameter contains the correct DTM product id for orthoimages.
 void generateReport()
          Generates a report for the DTM and Ortho-image products found in the input directory.
 Parameter getProductID(Parameter param)
          Gets the Parameter from the input parameter that contains the PRODUCT_ID Parameter from the input Parameter tree.
static void main(String[] args)
          Verify label parameters and file formatting.
 void verboseErrors(boolean verbose)
          If this method is set to true, then more verbose error messages are output, which should help to diagnose problems.
 void verboseFileErrors(boolean verbose)
          If set true, additional error information is output while checking the file formating, this includes line length errors and end-of-line character errors.
 
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
See Also:
Constant Field Values

DEFAULT_CONFIGURATION_FILENAME

public static final String DEFAULT_CONFIGURATION_FILENAME
The default configuration file

See Also:
Constant Field Values

MAX_LINE_LENGTH

public static final int MAX_LINE_LENGTH
The maximum number of bytes a single line in the label can have.

See Also:
Constant Field Values

DEBUG_DTM_PRODUCT_ID_PROP

public static final String DEBUG_DTM_PRODUCT_ID_PROP
See Also:
Constant Field Values
Constructor Detail

DTM_Verifier

public DTM_Verifier(File inputDir)
             throws Exception
Construct a new verifier given a directory to read product files from.

Parameters:
inputDir - - a directory containing HiRISE DTM product (orthoimage and/or digitial terrain models (DTM)
Throws:
Exception - if an error while attempting to read the input directory.
Method Detail

verboseErrors

public void verboseErrors(boolean verbose)
If this method is set to true, then more verbose error messages are output, which should help to diagnose problems.

Parameters:
verbose - boolean value to that sets verbose error output. If set to true, then more verbose error information is output

verboseFileErrors

public void verboseFileErrors(boolean verbose)
If set true, additional error information is output while checking the file formating, this includes line length errors and end-of-line character errors.

Parameters:
verbose - - a boolean value indicating of extra verbose file errors should be output. Set to true to output additional error information.

generateReport

public void generateReport()
                    throws Exception
Generates a report for the DTM and Ortho-image products found in the input directory. All the parameter and file formatting checks are called through this method and a report is generated. If the LOG option has been set, the report will be written to a file called DTM_Verifier_Report.txt in the local working directory. If the LOG option has not been set, all output is to stdout.

With the verbose options set (-v and -vf from the command line) verbose output from the parameter and file checks will be output respectively.

Throws:
Exception - if any errors occurs during the test process.

getProductID

public Parameter getProductID(Parameter param)
Gets the Parameter from the input parameter that contains the PRODUCT_ID Parameter from the input Parameter tree.

Parameters:
param - - The input Parameter containing a parameter called "PRODUCT_ID"
Returns:
a new Parameter containing the PRODUCT_ID parameter, if the PRODUCT_ID can be found, null otherwise

checkSourceProductID

public boolean checkSourceProductID(Parameter spid,
                                    boolean isDTM)
                             throws PVL_Exception
Tests that the SOURCE_PRODUCT_ID parameter contains the correct DTM product id for orthoimages. If the isDTM parameter is true, then this method will always return true, as the DTM doesn't have a source DTM to be derived from.

Parameters:
spid - - the SOURCE_PRODUCT_ID parameter from a HiRISE DTM label
isDTM - - indicates if the input parameter is from a DTM product (instead of an orthoimage).
Returns:
true if the parameter contains a reference to the DTM the orthoimage is derived from.
Throws:
PVL_Exception - if an error occurs while attempting to read the input parameter

checkProducerName

public boolean checkProducerName(Parameter prodName)
                          throws PVL_Exception
Tests that the producer name parameter has been set. This method does not test if the name is correct, it just tests that it has been set.

Parameters:
prodName - - A Parameter containing the producer name
Returns:
true if the Parameter has been set, false otherwise.
Throws:
PVL_Exception - if an error occurs while attempting to read the Parameter

checkLatitude

public boolean checkLatitude(Parameter latitude)
                      throws PVL_Exception
Checks that the input Parameter contains a valid latitude value

Parameters:
latitude - - A Parameter object containing a numerical latitude value
Returns:
true if the value of the latitude is between ± 90, false otherwise.
Throws:
PVL_Exception - if an exception occurs while reading the input parameter

checkLongitude

public boolean checkLongitude(Parameter longitude)
                       throws PVL_Exception
Checks that the input Parameter contains a valid longitude value

Parameters:
longitude - - A Parameter object containing a numerical longitude value
Returns:
true if the value of the longitude is between 0 and 360, false otherwise
Throws:
PVL_Exception - if an exception occurs while attempting to read the input Parameter

checkScaling

public boolean checkScaling(Parameter scale,
                            boolean isDTM)
                     throws PVL_Exception
Checks that the input Parameter contains a valid SCALE_FACTOR value. Valid scaling factors should be greater than 0 and less than or equal to 1.

Parameters:
scale - - A parameter object containing a scaling factor value
isDTM - - A boolean value indicating that the input Parameter is from a DTM product and not an ortho-image.
Returns:
true if the parameter passes the test, false otherwise
Throws:
PVL_Exception - if an error occurs while reading the Parameter value

checkOffset

public boolean checkOffset(Parameter offset,
                           boolean isDTM)
                    throws PVL_Exception
Checks that the input Parameter contains a valid OFFSET value. This check is currently just an empirical sanity check. The offset should fall between 0 and 0.3.

Parameters:
offset - - A Parameter object holding the OFFSET label parameter
isDTM - - A boolean value indicating that the input Parameter is from a DTM product and not an ortho-image.
Returns:
true if the Parameter value is between 0.0 and 0.3, false otherwise.
Throws:
PVL_Exception - if an error occurs while attempting to read the Parameter value

checkMapProjection

public boolean checkMapProjection(Parameter projection)
                           throws PVL_Exception
Checks that the input Parameter holds a valid map projection type. Valid types are "EQUIRECTANGULAR" and "POLAR STEREOGRAPHIC" Note: This test is case sensitive and white-space sensitive.

Parameters:
projection - - A Parameter containing a map projection type
Returns:
true if the Parameter value holds a valid map projectiont type, false otherwise
Throws:
PVL_Exception

checkNorthAzimuth

public boolean checkNorthAzimuth(Parameter northAz,
                                 Parameter projection)
                          throws PVL_Exception
Checks that the north azimuth setting is valid for the given input parameters. For equirectangular projections, the north azimuth should always be 270 degrees. For polar stereographic projections, the north azimuth should always be between 0 and 360.

Parameters:
northAz - - a Parameter holding the north azimuth information from the product label
projection - - a Parameter holding the projection type information from the product label
Returns:
true if the parameter passes the test, false otherwise
Throws:
PVL_Exception - if an error occurs while reading the input Parameters

checkFile

public void checkFile(File label)
               throws IOException
Perform file formatting tests on the product label. Each line of the file is checked for length (should be <=80 bytes long) and the End-Of-Line character sequence should be a carriage-return, line-feed combination. If any line in the file fails these tests, the checks fail.

More verbose output will be enable if verboseFileErrors is set to true.

Parameters:
label - - A File object referencing the file to be checked for errors
Throws:
IOException - if an error occurs while reading the file

main

public static void main(String[] args)
                 throws Exception
Verify label parameters and file formatting. The verifier will operate on a set of PDS products either in the current directory or in a directory specified by the -d option on the command line. -v option will output verbose information about any label Parameter errors, while -vf option will output more verbose error about file formatting errors.

By default, all output is sent to stdout, however the -l option can be used to redirect output to a log-file in the current working directory.

Parameters:
args - - the array of command line arguments
Throws:
Exception

HiRISE

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