igpp.docgen can parse files and define a context that contains the contents as variables.
Supported formats are:
Files with the extension ".csv" or ".tab" are parsed as a delimited table.
Field names are taken from the first record. Comments are lines that begin with "#" and are ignored. The array of records is assigned the name "record" in the defined Velocity context. The number of records can be determined with record.size().
Files with the extension ".cdf" are parsed as CDF file.
The metadata contained in the CDF is made available as follows:
Files with the extension ".json" are parsed as Javascript Object Notation.
Supports single valued elements, objects and arrays, but limits the nesting of array to two-levels. That is, an array of arrays, but not an array of arrays in an array. JSON allows each value in an array to be of a different data type. However, igpp.docgen requires all array values be of the same type, so igpp.docgen coerces all array values to be a string type.
Files with the extension ".txt" are considered a text file with keyword=value assignments.
When text files are parsed lines beginning with "#" are considered comments. All other lines are parsed as a "name=value". If a line does not conform to the "name=value" syntax it is ignored. If a value is enclosed in curly braces {} the value is parsed as a comma separated list.
Keyword/Value text files can be used to create simple lookup tables. The value associated with a keyword can be retrieved with a
$context.get(name)
where "context" is the defined context in Velocity and "name" is the keyword to find. "name" can also be a reference to parameter in another context. For example, to retrieve the value from a "target" context using the value for a spacecraft in a "list" context do the following:
$target.get($list.spacecraft)
Files with the extension ".lbl" are considered a PDS3 label file.
When a PDS3 label is parsed a variable hierarchy is created which matches the organization of objects in the label. If multiple objects occur at the same level an array is created in the variable tree.
The PDS3 label parser is a Object Definition Language (ODL) parser and is very lenient as to compliance with the PDS3 data model schema. You can use ODL to define nested values using the "OBJECT=name" to nest values.
All OBJECT definitions create a new array in the generated Velocity context. This is true even if there is only one occurrence of an OBJECT definition. In the Velocity template use a "#foreach" directive to process each OBJECT.
A detached label has the same base name as the data file it describes. Both the label and the data file must be located in the same folder. When the PDS3 label is parsed the file system is search for the corresponding data file. Attributes for the located file are included with in the top level variable for the label. The added attributes are:
PDS3 supports pointers which are named references to a file which are tied to an OBJECT. A pointer has the general form:
^{name}_{class}=({file}, {location})
/*Band A */ ^HFRA_CAL_LEVELS_AGC_TABLE = ("T2007002_CAL0.TAB", 4) /* Agc */ OBJECT = HFRA_CAL_LEVELS_AGC_TABLE INTERCHANGE_FORMAT = ASCII ROW_BYTES = 140 ROWS = 4 COLUMNS = 2 DESCRIPTION = "" OBJECT = COLUMN NAME = CALIBRATION_LEVEL DATA_TYPE = CHARACTER START_BYTE = 1 BYTES = 6 DESCRIPTION = "HFR internal calibration active antenna stimulus." END_OBJECT = COLUMN END_OBJECT = HFRA_CAL_LEVELS_AGC_TABLE
$label.TABLE.Product_file