1 |
% |
% |
2 |
% [RHO,LON,LAT,DPT] = compute_density(SNAPSHOT) |
% [RHO] = compute_density(SNAPSHOT) |
3 |
% |
% |
4 |
% For a time snapshot, this program computes the |
% For a time snapshot, this program computes the |
5 |
% 3D density from potential temperature and salinity fields. |
% 3D density from potential temperature and salinity fields. |
21 |
% |
% |
22 |
|
|
23 |
|
|
24 |
function compute_density(snapshot) |
function varargout = compute_density(snapshot) |
25 |
|
|
26 |
|
|
27 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
159 |
|
|
160 |
|
|
161 |
% Output: |
% Output: |
162 |
|
output = struct('RHO',RHO,'dpt',dpt,'lat',lat,'lon',lon); |
163 |
switch nargout |
switch nargout |
164 |
case 1 |
case 1 |
165 |
varargout(1) = RHO; |
varargout(1) = {output}; |
|
case 2 |
|
|
varargout(1) = RHO; |
|
|
varargout(2) = lon; |
|
|
case 3 |
|
|
varargout(1) = RHO; |
|
|
varargout(2) = lon; |
|
|
varargout(3) = lat; |
|
|
case 4 |
|
|
varargout(1) = RHO; |
|
|
varargout(2) = lon; |
|
|
varargout(3) = lat; |
|
|
varargout(4) = dpt; |
|
166 |
end |
end |