adjusts salinities (SA) to produce a water column 
stablised to be neutral, in-situ temperature remains 
constant (75-term equation)



SA_out = gsw_stabilise_SA_const_t(SA_in,t,p,{opt_1,opt_2})


This function stabilises a water column. This is achieved by minimally 
adjusting only the Absolute Salinity SA values such that the minimum 
stability is made to be within at least 1 x 10^-9 s^-2 of the desired 
minimum Nsquared min_Nsquared, the default value is which is about 1/5th 
of the square of earth's rotation rate. There are no changes made to
either in-situ temperature or pressure.
This programme requires either the Optimization toolbox or Tomlab CPLEX.
if there are a up to several hundred data points in the cast then 
Matlab's Optimization toolbox produces reasonable results, but if there 
are thousands of bottles in the cast or the best possible output is  
wanted then the CPLEX solver is required. This programme will determine
if Tomlab or the Optimization toolbox is available to the user, if both
are available it will use Tomlab.
Note that the 75-term equation has been fitted in a restricted range of 
parameter space, and is most accurate inside the "oceanographic funnel" 
described in McDougall et al. (2003).  The GSW library function 
"gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if 
some of one's data lies outside this "funnel".
Click for a more detailed description of adjusting salinities
to produce a stablised water column


SA_in  =  uncorrected Absolute Salinity                         [ g kg-1 ]
t      =  in-situ temperature (ITS-90)                           [ deg C ]
p      =  sea pressure                                            [ dbar ]
       (i.e. absolute pressure - 10.1325 dbar)
opt_1  =  Nsquared_lowerlimit                                      [ s-2 ]
Note. If Nsquared_lowerlimit is not supplied, a default minimum 
stability of 1 x 10^-9 s^-2 will be applied.
opt_1  =  longitude in decimal degrees                      [ 0 ... +360 ]
                                                     or  [ -180 ... +180 ]
opt_2  =  latitude in decimal degrees north                [ -90 ... +90 ]
SA & t need to have the same dimensions.
p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & t are MxN.
opt_1 equal to Nsquared_lowerlimit, if provided, may have dimensions 1x1 
or (M-1)x1 or 1xN or (M-1)xN, where SA_in & t are MxN.
opt_1 equal to long & opt_2 equal to lat, if provided, may have
Sdimensions 1x1 or (M-1)x1 or 1xN or (M-1)xN, where SA_in & t are MxN.


SA_out =  corrected stabilised Absolute Salinity                 [ g kg-1 ]


SA = [34.7118; 34.8915; 35.0256; 31.0472; 34.7366; 34.7324;]
t = [28.7856; 28.4329; 22.8103; 10.2600;  6.8863;  4.4036;]
p =  [     10;      50;     125;     250;     600;    1000;]
SA_out = gsw_stabilise_SA_const_t(SA,t,p)
SA_out =


Paul Barker and Trevor McDougall                      [ ]


3.05.5 (16th June, 2016)


Barker, P.M., and T.J. McDougall, 2016: Stabilisation of hydrographic 
profiles.  J. Atmosph. Ocean. Tech., submitted.
IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of
 seawater - 2010: Calculation and use of thermodynamic properties.
 Intergovernmental Oceanographic Commission, Manuals and Guides No. 56,
 UNESCO (English), 196 pp.  Available from the TEOS-10 web site.
McDougall, T.J., D.R. Jackett, D.G. Wright and R. Feistel, 2003: 
 Accurate and computationally efficient algorithms for potential 
 temperature and density of seawater.  J. Atmosph. Ocean. Tech., 20,
 pp. 730-741.
Roquet, F., G. Madec, T.J. McDougall and P.M. Barker, 2015: Accurate
 polynomial expressions for the density and specific volume of seawater 
 using the TEOS-10 standard.  Ocean Modelling, 90, pp. 29-43.
The software is available from