%  1.  NAME
%
%  sgeo - Calculate geostrophic slope
%
%  2.  USAGE
%
%  sgeo
%
%  3.  DESCRIPTION
%
%  Read geostrophic current data from a grid ascii file, as output by C
%  utility vgeo(1) and compute the corresponding slope heights. Generate
%  a plot for each of the specified depths and save data into an ascii
%  file.
%
%  The input file must contain the following columns:
%
%  1. Time in decimal days
%
%  2. Longitude in degrees
%
%  3. Latitide in degrees
%
%  4. Depth in meters
%
%  5. Geostrophic current
%
%  This Matlab script is an interface to function sgeo_grd(3m).
%
%  4.  PARAMETERS
%
%  The following parameters must be edited:
%
%     vgeo_file
%        Name if input file with geostrophic current data.
%
%     out_file
%        Root name of output file. Suffixes are automatically added.
%
%     year_base
%        Base year used to determine the decimal days in the input file.
%
%     x_axis
%        Column number to x-axis for plotting. It must be one of 1,2 or
%        3. If negative,the axis direction will be reversed.
%
%     slope_0
%        Initial slope value in meters.
%
%     vgeo_scale
%        Factor to get geostrophic currents from input file in m/s.
%
%     sgeo_scale
%        Scaling factor for plotting slope height points.
%
%     vgeo_dir
%        The direction that was used to compute the geostrophic current.
%        This is necessary in order to get the correct slope variations.
%        This is one of northward,southward,westward of eastward.
%
%     depths
%        Array with depths values at which plotting of slope heights is
%        desired.  The values must be present in the input file (i.e. no
%        interpolation is carried out here). If empty,all available
%        depths in the input file will be plotted.
%
%     title
%        Title of plot.
%
%     info
%        Additionnal information string.
%
%     institute
%        Institute stamp.
%
%  5.  OUTPUT
%
%  The following files are generated:
%
%     out_file.ps
%        Postcript output of plot.
%
%     out_file.asc
%        Ascii data of slope height values.
%
%  6.  AUTHORS
%
%  Pierre Jaccard, Geophysical Institute, University of Bergen, 1999
%

% Edit the following lines:
%------------------------------------------------------------------

year_base  = 1996;

vgeo_file  = 'vgeo_abt.grd';
out_file   = 'sgeo_abt';

vgeo_dir   = 'southward';
slope_0    = 0.0;
x_axis     = -3;
vgeo_scale = 0.01;
sgeo_scale = 100.0;

depths     = [];

title      = 'AGMASCO-SKAGERRAK Geostrophic slope (cm) (adcp,detided,bt)';
info       = '';
institute  = 'P. Jaccard, Geophysical Institute, University of Bergen';


%------------------------------------------------------------------
% No more editing !!!



sgeo_grd(vgeo_file, out_file, year_base, x_axis, ...
    slope_0, vgeo_scale, sgeo_scale, vgeo_dir, depths, ...
    title, info, institute);
