contotbl

Last updated Sat Sep 18 21:04:55 1999


Translate a contour file in table

1. USAGE

contotbl

2. DESCRIPTION

This Matlab script reads an ascii contour data file, keeping only specified x, y, z1, z2, ... data. These are interpolated onto a specified y-grid, which is common to each profile. The results are written in a new ascii data file, in table .

Columns in the contour data file do not need to be ordered as described below (i.e. x, y, z values may be located in different columns, and x column does not need to contain the least varying values). Reordering of data is carried by the script.

See below for a description of the invloved file formats.

3. PARAMETERS

The following parameters must be edited:



contour_file

Name of input file containing contour data.



table_file

Name of output file for table data.



x

Number of column for x variable in contour file.



y

Number of column for y variable in contour file.



z

Vector of column numbers for z variables in contour file.



yi

Common y-grid points for table .



fmt

Format for writting values in table file.



sep

Separator between columns in output file.

4. CONTOUR FORMAT

The input contour is equivalent of as the one generated by the contour product of adcpsect: the first and second columns contain x and y data, while remaining columns contain z data for the different listed variables. Each line defines a grid point. This has the advantage that grid points do not need to be on a regularly spaced grid. Hence, a typical contour file will look like:


      x(1)   y(1,1)      z1(1,1)      z2(1,1)    ... zQ(1,1)
      x(1)   y(1,2)      z1(1,2)      z2(1,2)    ... zQ(1,2)
      ...
      x(1)   y(1,M(1))   z1(1,M(1))   z2(1,M(1)) ... zQ(1,M(1))
      x(2)   y(2,1)      z1(2,1)      z2(2,1)    ... zQ(2,1)
      ...
      x(N)   y(N,M(N))   z1(N,M(N))   z2(N,M(N)) ... zQ(N,M(N))

where N is the number of profiles and M(N) the number of cell depths within each profile.

5. TABLE FORMAT

In table , grid points must be regularly spaced. The first columns contains all different y values. All other data on the line are z values corresponding to the different x locations (normally sorted in ascending order). If several z variables were selected from the input contour file, these will appear in the same order for each x location. The corresponding table file from the previous example will look as follows:


      y(1)   z1(1,1)  z2(1,1) ... zQ(1,1) z1(2,1) ... zQ(N,1)
      ...
      y(M)   z1(1,M)  z2(1,M) ... zQ(1,M) z1(2,1) ... zQ(N,M)

where index (i,j) corresponds to z value at position i and depth j. This assumes that depths values within profiles are identical. In order to be complete, this description must specifiy the xlocation separately or at the beginning of the file.

6. AUTHORS

Pierre Jaccard, Geophysical Institute, University of Bergen, 1999