1 |
% |
% |
2 |
% [] = compute_MLD(SNAPSHOT) |
% [MLD] = compute_MLD(SNAPSHOT) |
3 |
% |
% |
4 |
% Here we compute the Mixed Layer Depth as: |
% Here we compute the Mixed Layer Depth as: |
5 |
% MLD = min depth for which : ST > ST(SSS,SST-0.8,p0) |
% MLD = min depth for which : ST > ST(SSS,SST-0.8,p0) |
9 |
% SST the Sea Surface Temperature (oC) |
% SST the Sea Surface Temperature (oC) |
10 |
% SSS the Sea Surface Salinity (PSU-35) |
% SSS the Sea Surface Salinity (PSU-35) |
11 |
% p0 the Sea Level Pressure (mb) |
% p0 the Sea Level Pressure (mb) |
12 |
% EKL is the Ekman layer depth (m) |
% EKL is the Ekman layer depth (m, positive) |
13 |
% |
% |
14 |
% Files names are: |
% Files names are: |
15 |
% INPUT: |
% INPUT: |
28 |
% 09/20/06 |
% 09/20/06 |
29 |
% gmaze@mit.edu |
% gmaze@mit.edu |
30 |
|
|
31 |
function compute_MLD(snapshot) |
function varargout = compute_MLD(snapshot) |
32 |
|
|
33 |
global sla toshow |
global sla toshow |
34 |
global netcdf_suff netcdf_domain |
global netcdf_suff netcdf_domain |
86 |
|
|
87 |
MLD(isnan(squeeze(ST(1,:,:)))) = NaN; |
MLD(isnan(squeeze(ST(1,:,:)))) = NaN; |
88 |
|
|
89 |
|
|
90 |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
91 |
|
% Ensure we have the right sign (positive) |
92 |
|
mm = nanmean(nanmean(MLD,1)); |
93 |
|
if mm <= 0 |
94 |
|
MLD = -MLD; |
95 |
|
end |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
100 |
% Record |
% Record |
101 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
155 |
nc{ncid}(:,:,:) = MLD; |
nc{ncid}(:,:,:) = MLD; |
156 |
|
|
157 |
nc=close(nc); |
nc=close(nc); |
158 |
|
close(ncST); |
159 |
|
close(ncS); |
160 |
|
close(ncT); |
161 |
|
|
162 |
|
|
163 |
|
% Output: |
164 |
|
output = struct('MLD',MLD,'lat',STlat,'lon',STlon); |
165 |
|
switch nargout |
166 |
|
case 1 |
167 |
|
varargout(1) = {output}; |
168 |
|
end |