## org.das2.qds.util.AsciiHeadersParser

This additional support for parsing ascii data looks at the comment block in an ASCII file for a structured set of Dataset tags further describing the data. This is loosely formatted JSON that describes each column of the data file more abstractly than the AsciiParser. This is based on QDataSet metadata tags, as much as possible.

## AsciiHeadersParser( )

## PROP_DIMENSION

property for dimension of the data defining rank and qube dims. For example, "[]" (default} "[1]" scalar--alternate form, and [] is preferred. "[3]" (three element vector) "[20,30]" (qube of 60 elements).

## PROP_ELEMENT_NAMES

NAME identifier to assign to each column of the parameter. These should follow QDataSet NAME rules. This is always a 1-D array.

## PROP_ELEMENT_LABELS

Human-readable label for each column of the parameter.

## getInlineDataSet

getInlineDataSet( QDataSet bds, String name ) → QDataSet

allow inline dataset to be retrieved.

### Parameters

bds - a BundleDescriptor, from BUNDLE_1. This must have been created by this code.
name - the name of the inline dataset

### Returns:

the dataset, or null if the dataset is not found.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getInlineDataSetNames

getInlineDataSetNames( QDataSet bds ) → String[]

return the list of inline dataset names. This was probably used during development.

### Parameters

bds - bundle dataset descriptor, though only BundleDescriptor is supported.

### Returns:

the inline dataset names.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## parseMetadata

parseMetadata( String header, String[] columns, String[] columnLabels ) → org.das2.qds.util.AsciiHeadersParser.BundleDescriptor

attempt to parse the JSON metadata stored in the header. The header lines must be prefixed with hash (#). Loosely formatted test is converted into nicely-formatted JSON and then parsed with a JSON parser. Note the Java JSON parser itself is pretty loose, for example allowing 1-word strings to go without quotes delimiters. The scheme for this header is either:

- "rich ascii" or http://autoplot.org/richAscii
- "hapi" https://github.com/hapi-server/data-specification/blob/master/hapi-dev/HAPI-data-access-spec-dev.md#info

### Parameters

header - the JSON header
columns - identifiers for each column
columnLabels - labels for each column

### Returns:

the BundleDescriptor

### See Also:

http://autoplot.org/richAscii
https://github.com/hapi-server/data-specification/blob/master/hapi-dev/HAPI-data-access-spec-dev.md#info
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## parseMetadataHapi

parseMetadataHapi( JSONObject doc ) → org.das2.qds.util.AsciiHeadersParser.BundleDescriptor

### Parameters

doc - a JSONObject

### Returns:

org.das2.qds.util.AsciiHeadersParser.BundleDescriptor
[search for examples] [view on GitHub] [view on old javadoc] [view source]