next up previous contents
Next: A complete example Up: OMP Analysis Package for Previous: OMP Analysis

Subsections


Analyzing Data with the OMP Analysis Package


The Matlab Files

System requirements

Installing the files


Analyzing Data

The OMP analysis package is set up to be used for the analysis of hydrographic sections and requires appropriate data arrangement. The easiest way to explain how to set up data for your own analysis is by way of example. We therefore now proceed to analyse data from the eastern Indian Ocean step by step. We assume initially that no biogeochemical changes occur along the mixing path of the water masses and the classical OMP analysis is applicable. We then expand the analysis by allowing biogeochemical changes. In a final step we include potential vorticity.

The hydrographic structure in the example region, the eastern troipcal Indian Ocean, is dominated by two water masses in the thermocline, Indian Central Water (ICW) and the water mass of the Indonesian Throughflow known as Australasian Mediterranean Water (AAMW), which meet and mix here. We therefore assume to see an intense frontal structure in the upper few hundred metres above a diffuse signal from Antarctic Intermediate Water. A simple salinity section will show us this immediately, but for some reason we are interested in quantifying the fractions of individual water masses, say to resolve the effects of mixing on a CFC distribution.

The water masses of the permanent thermocline (in this case ICW and AAMW) cover a wide depth (temperature) range and must therefore be represented by 2 source water types each. AAIW is more uniform in its formation region and can be represented by a single water type. Depending on the depth range of interest we thus require at least 4 and possibly 5 water types for the analysis.


Data format and names of variables


The OMP Analysis Matlab package defines certain names for certain variables. There are two ways to link your data to the Matlab routines. You can edit the routines so that they accept your data name definitions, or you can translate your data into a file which uses the standard variable names of the OMP Analysis Matlab routines. We strongly recommend the latter procedure; editing all routines is cumbersome, and you are bound to miss a few statements which use defined names of variables.

The variables used in the OMP Analysis Matlab package and their defined names are listed below:

latlatitude: essential
longlongitude: essential
presspressure: essential
salsalinity: essential
temptemperature: essential unless potential temperature is supplied
ptemppotential temperature: optional (will be calculated if not supplied)
pdenspotential density: optional (will be calculated if not supplied)
oxyoxygen: optional
phphosphate: optional
ninitrate: optional
sisilicate: optional
pvort108 * potential vorticity: optional (will be calculated if requested)
commentdata comments (region, cruise, date etsc): optional

The listed data have to be supplied as a .mat file. To prepare your data as a .mat file, arrage them as a plain ASCII file with one variable per column, load the ASCII file from the Matlab command window and save all variables into a .mat file. (See the page The Matlab code of this manual if you do not know how to do this.) Data gaps should be filled with a dummy value of -9 or less. If you include potential vorticity in your data it must be multiplied by 108. If you do not include potential vorticity but want the program to calculate it, pressure has to increase for every station (no duplicate samples at identical depths, no data from up casts).


Defining the source water types


The water type definitions are stored in the Matlab routine qwt2.m which you may have to edit for use. (We recommend that you duplicate qwt2.m and save it under a different name, so that you can return to the original qwt2.m for a test run, should problems occur.) Each line in the data block of qwt2.m identifies one water type. Here is the code of qwt2.m:

 % wm(1:5)   = ' AAMW'; %                      first row
 % wm(6:10)  = ' AAMW'; %                      second row
 % wm(11:15) = '  ICW'; %upper, first set      third row
 % wm(16:20) = '  ICW'; %lower, first set      forth row
 % wm(21:25) = '  ICW'; %upper, second set     fifth row
 % wm(26:30) = '  ICW'; %lower, second set     sixth row
 % wm(31:35) = ' AAIW'; %                      seventh row
 % wm(36:40) = '  IEW'; %                      eigth row

all=[...

%  The following lines define the water types. The order of parameters is
%  ptemp    sal      oxy    PO4     NO3    Si    mass   pvort
%  Note: potential vorticity is multiplied by 10*8.

  10       34.56      91    2.1    30     40     1.0    0.03;...  %1 lower AAMW
  16.4     34.55     100    1.4    19     25     1.0    1.12;...  %2 upper AAMW  
   9       34.65     260    1.1    15      5     1.0    0.03;...  %3 lower ICW, first set
  18       35.8      230    0       0      0.5   1.0    0.05;...  %4 upper ICW, first set
   9       34.72     209    1.47   20      5     1.0    0.03;...   %5 lower ICW, second set
  14.35    35.4      224    0.6     6.5    0.5   1.0    0.05;...  %6 upper ICW, second set
   4.5     34.35     210    2.2    32     35     1.0    0.30;...  %7 AAIW
   8.5     35         60    2.5    35     60     1.0    0.04;...  %8 IEW

];

G1=all(wm_row,:)';
allsize = size(all);

There is one water mass name for each water type definition row. Each name has to consist of exactly 5 letters including blanks; DO NOT CHANGE THE LENGTH unless you want to edit the main program omp2.m, too!

NOTES:

  1. You can store more than one water type definition for a water mass and select which one you want to use at run time. This example file demonstrates this by offering two definitions for ICW. Calling qwt2([1 2 3 4]) activates rows 1, 2, 3, and 4 (AAMW and the first ICW set); calling qwt2([1 2 5 6]) activates row 1, 2, 5, and 6 (AAMW and the second ICW set).
  2. You can use this function to build up your own inventory of water type definitions by including definitions for the Atlantic (NACW, SACW, MedW etc.) and other oceans (AAIW, AABW etc.). This will allow you to run OMP analysis for any ocean region by selecting the appropriate rows in the function call.
  3. Water types with identical names define water masses by property-property relationships (e.g. in the thermocline); their contributions will be added to all contributions of water masses with the same name. For example, the call qwt2([1 2 3 4 7]) will produce three results, AAMW (added from 1 and 2), ICW (added from 3 and 4) and AAIW. For this to work all water types with identical names for which you want contributions added in the result have to be called in an uninterrupted sequence. (For example, calling qwt2([1 2 7]) will add the AAMW contributions, calling qwt2([1 7 2]) will not.)
  4. Water type definitions for potential vorticity are multiplied by a factor of 108.
The actual parameter values for source water types can be found by reference to the literature or preferably by reference to observations from the water mass formation regions. The usual procedure is to plot all parameters against temperature for data in the source region of the water masses (Figure 3.1). This is done under the assumption that temperature is the important stratification parameter. (In polar regions this is not necessarily the best choice.) The example data set testdata covers only one source region (the AAMW source region) but lies outside the source regions of ICW and AAIW, so we took the two AAMW water type definitions from the testdata file and the ICW and AAIW water type definitions from the literature.

The water type definition for Antarctic Intermediate Water (AAIW) is relatively easy to find by identifying the AAIW salinity minimum and determining all other parameters at that salinity. The definition of Australasian Mediterranean Water (AAMW) and Indian Central Water (ICW) relies on a linear approximation of the property-property relationships across the thermocline and can be determined by a best linear fit procedure. To determine the temperature range with approximately linear relationships between all parameters, we used the Matlab script polyfit.m. It delivers (with the script polyval.m) an error estimate of the fit as well. This error can be useful in detecting the upper and lower limit of linear parameter behavior as well as to calculate the weights for the OMP analysis (see section 2.2).


  
Figure 3.1: Plot of all parameters used in the OMP analysis example relative to temperature ($\bullet $). The lines indicate the linear fit obtained from the Matlab polyfit.m script. (Note: The figure was produced from OMP Analysis version 1.0 and may vary slightly from results obtained with the testdata of this version.)
\includegraphics[width=14cm]{def_plots.eps}

The Matlab routine def_sources.m can be used to find water types in the permanent thermocline in this manner. Table 3.1 shows an example of this calculation for one thermocline water mass (AAMW).


 
Table 3.1: Parameter values obtained in the AAMW source region.
Results from linear regression in source region of AAMW. (Note: The given values and the following figures are produced from OMP Analysis version 1.0 and may vary slightly from results obtained with the source_data of this version.)
Parameter upper SWT lower SWT mean(dj)
Temperature °C 16.4 10.0 -
Salinity 34.55 34.56 0.0046
O2 mmol kg-1 100.0 91.0 2.85
PO4 mmol kg-1 1.4 2.1 0.149
NO3 mmol kg-1 19.0 30.0 2.037

The water type definitions or source water types Gji for a thermocline water mass are then given by the end points of the lines in Figure 3.1 (listed for AAMW in Table 3.1). All other points on these lines are also source water types; together with dj they define the water mass completely. OMP analysis handles this situation by mathematically representing all source water types on the lines as mixtures from the two source water types at the end of the lines.

Figure 3.2 compares the data set given by testdata (from OMP Analysis version 1.0) with the water mass definitions for AAMW and ICW thus obtained. Note that no data points come close to the ICW definition because its formation region is far away from the region covered by the observations.

  
Figure 3.2: The data from the testdata data set of version 1.0 ($\bullet $) and the definitions of AAMW and ICW.
\includegraphics[width=14cm]{para_plots.eps}


Determining the weights and setting the Redfield ratios


The weights are stored in the file testwght, together with the Redfield ratios. You will most likely have to calculate your own weights and store them in a file of the same structure. You can see the content of testwght by issuing the command load testwght in the Matlab command window and checking the variables Wx and ratio. The supplied file testwght contains

Wx =

    24     0     0     0     0     0     0     0
     0    24     0     0     0     0     0     0
     0     0     7     0     0     0     0     0
     0     0     0     2     0     0     0     0
     0     0     0     0     2     0     0     0
     0     0     0     0     0     2     0     0
     0     0     0     0     0     0    24     0
     0     0     0     0     0     0     0    24
ratio =

   0  0  -170 1 16 40  0   0

Weights and Redfield ratios are given in the order

  1. potential temperature
  2. salinity
  3. oxygen
  4. phosphate
  5. nitrate
  6. silicate
  7. mass conservation
  8. potential vorticity
They have to be supplied for all parameters in the correct order, regardless of which parameters you intend to use. In other words Wx is always of size 8x8 and ratio always contains 8 numbers. The main program will select the correct weights and Redfield ratios for your variables and discard the others. This feature allows you to store weights and Redfield ratios for different analysis runs in the same file.

In our example the weights are calculated from the mean variance of the linear fit to the data in the source region, related to the variance in the source water type matrix (calculated with the 'stdG' output from norm_qwt.m; see section 2.2 for details). Column 4 in table 3.1 summarizes the so calculated values. With the weighting formula (see section 2.2 for details) we obtain the weights for each parameter. Mass conservation is usually given the same weight as the weight of the parameter with the highest weight, but other choices are of course possible.

Weights for water masses represented by a single source water type are calculated from the variability around that point in parameter space.

The Redfield ratios given in testwght are suggestions based on our best understanding of the Indian Ocean thermocline. Without doubt you will have to make your own decision on the most correct Redfield ratios.



Running the analysis



When you prepared a data file of type .mat, edited qwt2.m with the correct water types and set up a weight and Redfield ratio file in the manner described for testwght, you are ready to proceed to OMP analysis.

Run the script runomp2.m (type the command runomp2 in the command window). The OMP Analysis title screen will appear. It gives you the choice of running the analysis automatically from a control file, interactively from a graphical user interface, or interactively through the command window. You can select either of the interactive choices and enter the names of your files in response when prompted. If you want to run the analysis in automatic mode you have to prepare a control script which contains automatic answers to the various prompts that occur at run time. The default control script is incontr2.m, which looks like this:

% Set type of OMP analysis by placing/deleting comment (%) sign:
 OMP = 'cla'; % classical OMP analysis
%OMP = 'ext'; % extended OMP analysis

% Define the file which contains the data by replacing the word testdata:
dataset = 'testdata';

% Set upper and lower limit of the analysis range (pressure in dbar):
uplimit = 0;
lolimit = 6000;

% Select/deselect potential vorticity by setting switchpot to 'y' or 'n':
switchpot = 'n';

% Select/deselect variables by setting corresponding switches to 'y' or 'n':
iox = 'y'; % oxygen switch
iph = 'y'; %phosphate switch
ini = 'y'; % nitrate switch
isi = 'n'; %silicate switch

% Define the file which contains the weights and Redfield ratios
% by replacing the word testwght: 
weightset = 'testwght';

% Set the total number of water masses to be included in the analysis
wm = 4;

%  Select the water type numbers (rows in the water type matrix)
% (The square brackets have to contain wm numbers):

qwt_pos = [1 2 3 4];

The script is more or less self-explanatory. We suggest that you save incontr2.m under a different name before you edit it to your requirements. That way you can always return to the default test run to verify that your programs are working correctly.

When you run the analysis you will see a progress report in the command window, followed by a summary of your run which lists all file names, weights, water types and Redfield ratios used. The program then pauses, allowing you to review the run. Pressing any key produces a plot of the mass conservation residual as a function of potential density, giving you a rough indication of the quality of your solution. Further output in the form of water mass fractions against depth is produced on demand.



A complete example



The next section takes you through the described procedure in a detailed example of mixing in the Indian Ocean. It demonstrates how you can improve your results by studying the residual distributions, refining your water type definitions and selecting the appropriate variant of OMP analysis.
next up previous contents
Next: A complete example Up: OMP Analysis Package for Previous: OMP Analysis
Johannes Karstensen
Matthias Tomczak
August 1999