


Generate a geometric sigma coordinate distribution.
Mobj = sigma_gen(nlev, p_sigma)
DESCRIPTION:
Generate a geometric vertical sigma coordinate distribution.
INPUT:
nlev: Number of sigma levels (layers + 1)
p_sigma: 1 for uniform sigma layers, 2 for parabolic function. See
page 308-309 in the FVCOM manual for examples.
OUTPUT:
dist: Geometric vertical sigma coordinate distribution.
EXAMPLE USAGE:
Mobj = read_sigma(21, 2.0)
Author(s):
Geoff Cowles (University of Massachusetts Dartmouth)
Pierre Cazenave (Plymouth Marine Laboratory)
Revision history
2013-04-23 Added help on the function and reformatted the code to
remove the FORTRAN in the else block.

0001 function dist = sigma_geo(nlev, p_sigma) 0002 % Generate a geometric sigma coordinate distribution. 0003 % 0004 % Mobj = sigma_gen(nlev, p_sigma) 0005 % 0006 % DESCRIPTION: 0007 % Generate a geometric vertical sigma coordinate distribution. 0008 % 0009 % INPUT: 0010 % nlev: Number of sigma levels (layers + 1) 0011 % p_sigma: 1 for uniform sigma layers, 2 for parabolic function. See 0012 % page 308-309 in the FVCOM manual for examples. 0013 % 0014 % OUTPUT: 0015 % dist: Geometric vertical sigma coordinate distribution. 0016 % 0017 % EXAMPLE USAGE: 0018 % Mobj = read_sigma(21, 2.0) 0019 % 0020 % Author(s): 0021 % Geoff Cowles (University of Massachusetts Dartmouth) 0022 % Pierre Cazenave (Plymouth Marine Laboratory) 0023 % 0024 % Revision history 0025 % 2013-04-23 Added help on the function and reformatted the code to 0026 % remove the FORTRAN in the else block. 0027 0028 dist = nan(1, nlev); 0029 0030 kb = nlev; 0031 0032 if p_sigma == 1 0033 for k = 1:nlev 0034 dist(k) = -((k-1)/(kb-1))^p_sigma; 0035 end 0036 else 0037 for k = 1:floor((kb+1)/2) 0038 dist(k) = -((k-1)/((kb+1)/2-1))^p_sigma/2; 0039 end 0040 for k = floor((kb+1)/2)+1:kb 0041 dist(k) = ((kb-k)/((kb+1)/2-1))^p_sigma/2-1.0; 0042 end 0043 end