GRS Code

See:
          Description

Packages
grs.pds  
grs.pds.ahd  
grs.pds.and  
grs.pds.cgs  
grs.pds.dhd  
grs.pds.dnd  
grs.pds.edr  
grs.pds.sgs  
grs.spice  

 

GRS Code

Description

Describes how to obtain and use the GRS code, a library of JavaTM classes (with source code) that may be used to parse the data files in GRS EDR, CGS, DND, and SGS records.

Requirements

A Java 2 Runtime Environment (JRE) of version 1.3 or higher is required to use the EDR code. A JRE may be obtained from Sun Microsystems, Inc., or from other vendors.

Where To Obtain the GRS Code

The GRS code is distributed with the GRS PDS Archives available from NASA's Planetary Data System. Source code and binary classes are located within a Java Archive (JAR) named grs_code.zip in the software directory. To extract source code from the jar, use a unzip utility or the jar utility distributed with a Java 2 Software Development Kit (SDK).

Using the GRS Code

The GRS code is designed to be used as a software library. In other words, it exposes an API (Application Programming Interface) that may be used by developers to build applications that parse and extract information from data files.

Alternately, the source code my be used as a guide to designing applications in other languages that parse GRS data files.

How To Parse GRS Records

For each type of record file in a GRS PDS archive, there is a corresponding class. The following table lists the correspondence:

Classes to use for each record type.
Record TypeClass File
CORRECTED_GAMMA_SPECTRA grs.pds.cgs.CorrectedGammaSpectraRecord
DERIVED_NEUTRON_DATA grs.pds.dnd.NsDerivedRecord
GAMMA_SPECTRAgrs.pds.edr.GammaEdrRecord
NEUTRON_SPECTRAgrs.pds.edr.NsEdrRecord
HEND_SPECTRAgrs.pds.edr.HendEdrRecord
PULSER_SPECTRAgrs.pds.edr.PulserEdrRecord
PROFILE_DATAgrs.pds.edr.ProfileEdrRecord
COMMAND_LISTgrs.pds.edr.CmdEdrRecord
MESSAGE_LOGgrs.pds.edr.MsgEdrRecord
ENG_DATAgrs.pds.edr.EngEdrRecord
CHAN_DATAgrs.pds.edr.ChanEdrRecord
E_KERNEL_NOTESgrs.pds.edr.EkEdrRecord
E_KERNEL_PEFgrs.pds.edr.PefEdrRecord
SUMMED_GAMMA_SPECTRAgrs.pds.sgs.SummedGammaSpectraRecord

Each class includes a java.io.DataInputStream constructor. So, the basic usage would be to:

  1. Open a DataInputStream to a file
  2. While the file has more records:
  3. Close the DataInputStream
Each class also includes a main method that demonstrates this basic usage.

Sample Application

A sample application is provided that converts EDR, CGS, or SGS files to Comma-Seperated Value (CSV) files.

Usage: java -jar grs_code.zip <path-to-data-file>

Please note that it does not include all columns in the output. In particular, the spectra data are not output to CSV. To access this data, please use the API as described above.



2001 Mars Odyssey Gamma Ray Spectrometer Team