This repository provides a utility pds3to4
to convert PDS3 LBL files to
PDS4, XML-formatted labels, and automatically validates them with the
NASA PDS Validate tool.
You can build and test the project with gradle
$ git clone https://github.com/39alpha/CheMin-PDS
$ cd CheMin-PDS
$ ./gradlew build
The resulting app/build/distributions
directory will contain a tarball and
zip archive. To install, you can extract one of the archives and copy the
contents to your path. At some point, we'll have an installation script.
The build will create a pds3to4
executable. This program will accept a
PDS3 LBL file or a directory, convert the files to PDS4 XML format and validate
the resulting XML using the
NASA PDS Validate tool.
$ pds3to4 -h
Usage: pds3to4 [-dhnprV] [-f=FORMAT] [-l=TYPE] [-o=FILE] [-t=TEMPLATE]
[PDS3-LABEL|DIR]
Convert PDS3 label files to PDS4
[PDS3-LABEL|DIR] path to label file
-d, --delete-report remove validation reports for successful validations
-f, --format=FORMAT path to fmt file
-h, --help Show this help message and exit.
-l, --label-type=TYPE label type (rda, re1 or min)
-n, --no-validate skip NASA PDS validation
-o, --output=FILE path to output file
-p, --print-report print validation reports to standard output instead
of to file
-r, --recursive process each .lbl file in a directory
-t, --template=TEMPLATE path to template file
-V, --version Print version information and exit.
To convert a specific PDS3 LBL file to an PDS4 XML file
$ pds3to4 <path/to/file.lbl>
To convert all PDS3 LBL files in a directory
$ pds3to4 -r <path/to/dir>
For more usage details, see examples.
Velocity files are used to specify the format of the resulting PDS4 XML files. You can find the bundled templates here.
The PDS Validate tool will inspect any data products to ensure that they are consistently formatted based on the information provided in the PDS4 XML file. The column names, their types and the format are taken from PDS FMT files. You can find the bundled FMT files here.
Note: The v0.2.0
release generates templates that target the
PDS4_MSL_1J00_1100
which is not published yet. In order for validation to succeed, you will need
to tell the script where to find the
schema
and the
schematron
files with the -x
and -s
flags, respectively.
You can either download the files and provide the file paths, or use the URLs from the links above:
$ pds3to4 -x <path or URL to schema> -s <path or URL to schematron> <path to lbl>