BES - Modules - CSV Handler: Difference between revisions

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
Line 40: Line 40:
=== Configuring Datasets ===
=== Configuring Datasets ===
There are two ways to add custom attributes to a dataset. First, you can use an ''ancillary attribute'' file in the same directory as the dataset. Alternatively, you can use NcML to add new attributes, variables, etc. See [[BES_-_Modules_-_NcML_Module | the NcML Handler documentation]] for more information on that option. Here we will describe how to set up an ancillary attribute file.
There are two ways to add custom attributes to a dataset. First, you can use an ''ancillary attribute'' file in the same directory as the dataset. Alternatively, you can use NcML to add new attributes, variables, etc. See [[BES_-_Modules_-_NcML_Module | the NcML Handler documentation]] for more information on that option. Here we will describe how to set up an ancillary attribute file.
=====

Revision as of 22:31, 1 May 2015

Kinds of files the handler will serve

This handler will serve Comma-Separated Values type data. Form many kinds of files, only very modifications to the data files are needed. If you have very complex ASCII data (e.g., data with headers), take a look at the FreeForm handler, too.

Data file configuration

Given a simple CSV data file, such as would be written out by Excel, add a single line at the start that provides a name and OpenDAP datatype for each column. Just as the data values in a given row are separated by a comma, so are the column names and types. Here is a small example data file with the added name<type> configuration row.

"Station<String>","latitude<Float32>","longitude<Float32>","temperature_K<Float32>","Notes<String>"
"CMWM",-34.7,23.7,264.3,
"BWWJ",-34.2,21.5,262.1,"Foo"
"CWQK",-32.7,22.3,268.4,
"CRLM",-33.8,22.1,270.2,"Blah"
"FOOB",-32.9,23.4,269.69,"FOOBAR"
Supported OpenDAP datatypes

The CSV handler supports the following DAP2 simple types: Int16, Int32, Float32, Float64, String.

Dataset representation

The CSV handler will return represent the columns in the dataset as arrays with the named dimension record. For example, the sample data shown above will be represented in DAP2 by this handler as:

Dataset {
    String Station[record = 5];
    Float32 latitude[record = 5];
    Float32 longitude[record = 5];
    Float32 temperature_K[record = 5];
    String Notes[record = 5];
} temperature.csv;

This is in contrast to the FreeForm handler that would represent these data as a Sequence with five columns.

For each column, the corresponding Array in the OpenDAP dataset has one attribute named type with a string value of Int16, ..., String. However, see below for information on how to add custom attributes to a dataset.

Known problems

There are no known problems.

Configuration parameters

Configuring the handler

This handler has no specific configuration parameters.

Configuring Datasets

There are two ways to add custom attributes to a dataset. First, you can use an ancillary attribute file in the same directory as the dataset. Alternatively, you can use NcML to add new attributes, variables, etc. See the NcML Handler documentation for more information on that option. Here we will describe how to set up an ancillary attribute file.