This is the tools library for the PDS4 planetary data standard. This file is designed to be viewed in an HTML browser.
The distribution containing this document has the following directories and files:
readme.txt
– A README file directing you to this document.index.html
– This document.bin/
– Command scripts for running the example programs.doc/
– Documentation for the library.lib/
– The library and dependencies, as Java JAR files.examples/
– Source code for the example programs, and sample data.In this release all documentation about the PDS4 Tools Library is in the form of Javadoc.
The PDS4 Tools Library Javadoc
In this release there is only one example program, one which extracts tabular data from a text or binary PDS4 tabular product and writes it to an output file or the console.
This example program extracts tabular data from a PDS4 product and writes it to an output file or the console, in fixed-width or CSV format. It can also list the tables and fields present. If multiple tables are present in the product, a table can be selected. The output format can also be set to fixed-width text or CSV, and the output line and field separators can be set to desired values.
There is a script called extract-table
in the bin/
directory
that can be used to run the table extractor. For example, the following command line
transcript shows how to display a table from the character table example:
$ bin/extract-table examples/data/Product_Table_Character.xml SOL LTST LMST V DV+ DV- DIR DDIR EXPOSURE TIME FILE NAME 91 0.088 91.06951 5.156 0.42 0.42656 125.547152 4.7691 15300.0 SS091A990R6M1.IMG 91 0.088 91.06951 5.156 0.42 0.42656 125.547152 4.7691 15300.0 SS091A990R6M1.IMG 91 0.088 91.07029 5.155 0.42 0.42652 125.550546 4.7692 15300.0 SS091A990R6M1.IMG 91 0.089 91.07105 5.155 0.42 0.42657 125.550344 4.7692 15300.0 SS091A990R6M1.IMG 91 0.377 91.35854 2.225 0.72 0.56432 147.854445 19.1305 4314.6 SS091AA00R6M1.IMG ... $
You can see usage information by using the -h
command-line option:
$ bin/extract-table -h usage: extract-table [-f field,...] [-o outputfile] [options] labelfile -c,--csv output in CSV format -f,--fields <FIELD_LIST> comma-separated list of field names or numbers (default is all fields) -h,--help show help text -l,--list-tables list tables present in the product (overrides all but output file options) -n,--index <NUMBER> table index, if more than one table is present (1..N) (default is 1) -o,--output-file <FILE> output file name (default is stdout) -P,--platform output using current platform line separator (default) -q,--quote-character <CHAR> quote character (for CSV output) -t,--field-separator <SEP> output field separator (default is 1 space for fixed-width, or comma for CSV) -U,--unix output using Unix line separator (LF) -w,--fixed-width output in fixed-width format (default) -W,--windows output using Windows line separator (CRLF) $
Each command-line option has a short and a long form. Either can be
used. For example, “extract-table -h
” is
equivalent to “extract-table --help
”.
Some options take arguments. For example to display only fields 1, 2, and the field named DIR from some label, you could use this command line:
bin/extract-table -f 1,2,DIR somelabel.xml
There are some example PDS4 products available in the
examples/data/
directory.
Product_Table_Character.xml
– An example of
a fixed-width, text table.Product_Table_Binary.xml
– An example of a fixed-width,
binary table.Product_Table_Delimited.xml
– An example of a delimited tableThe PDS4 Tools library can be configured to write log messages to a log file, if desired. It uses the logging library SLF4J. Two JAR files are needed to configure SLF4J:
slf4j-api-n.n.n.jar
– The SLF4J API library.
Here, n.n.n means the SLF4J version number used.slf4j-nop-n.n.n.jar
, the no-operation library
that inhibits logging. You can replace this JAR file with an implementation
that uses Log4J, java.util.logging functionality, or other logging library.See the SJF4J web site for more information about configuring SLF4J.