Next: Preferences Up: The File menu Previous: Convert NetCDF to ASCII Contents

##
Convert ASCII to NetCDF

The Convert ASCII to NetCDF option allows the conversion of from an ASCII file to a NetCDF file. Clicking on it, the dialog shown in figure 4.1.5 will pop up.

Figure 4.14: The dialog used to convert files in ASCII/CDL format to NetCDF format.

To use this functionnality, the ncgen program [37] provided with the NetCDF library must be installed and the path to the ncgen executable must be defined in the nMOLDYN preferences. If ncgen is not installed, this functionnality will be disabled.

To perform the conversion, the following input fields must be filled:

- ASCII input file
  Format: string
  Default: None
  Description: this field stores the name of the ASCII input file that will be used for the conversion. Two possible ASCII file formats are compatible for the conversion. The first one is the CDL file format [77] and the second one is a simpler but less general format where only numeric data can be converted. The latter format must contain white spaces separated columns where each column will be interpreted as a NetCDF unidimensional array of double. The file can contain header lines that must start with '#' character. The rest of the line will be stored in the NetCDF global attribute 'comment'. Some NetCDF global variables can also be specified for the conversion. They must be declared one after the other inside the header using the following format;
  # global name = value
  Finally, a name and some additional NetCDF variable attributes (units ...) can be given to the columns that will be converted. Column names must be declared one after the other inside the header using the following format:
  # variable name = value ; attribute1 = value1 ; attribute2 = value2 ...
  In such a case the number of variable declaration must be exactly the same than the number of columns. Otherwise the NetCDF variable name will be Columni where i is the column index.

  The figure 4.15 shows an example of such file.

  Figure 4.15: Example of an ASCII file that can be converted to a NetCDF file.

  The output NetCDF file resulting from its conversion will contain:

  - a NetCDF dimension 'nvalues' whose value corresponds to the length of the columns to convert (in that case 10),
  - a global attribute 'comment' whose value is ' The sun is shinning. I'm happy',
  - a global attribute 'toto' whose value is '300000',
  - a global attribute 'tata' whose value is 'yipee',
  - a NetCDF variable 'time' of dimension 'nvalues' with an additional attribute 'units' whose value is 'fs',
  - a NetCDF variable 'velocity' of dimension 'nvalues' with additional attributes 'units' and 'theory' whose values are respectively 'm/s' and 'can not be faster than light',
  - a NetCDF variable 'acceleration' of dimension 'nvalues' with an additional attribute 'units' whose value is 'm/s2',

- NetCDF output file
  Format: string
  Default: None
  Description: this field stores the name of the NetCDF output file.

Next: Preferences Up: The File menu Previous: Convert NetCDF to ASCII Contents