| 1 | % | % | 
| 2 | % [ST,LON,LAT,DPT] = A_compute_potential_density(SNAPSHOT) | % [ST] = A_compute_potential_density(SNAPSHOT) | 
| 3 | % | % | 
| 4 | % For a time snapshot, this program computes the | % For a time snapshot, this program computes the | 
| 5 | % 3D potential density from potential temperature and salinity. | % 3D potential density from potential temperature and salinity. | 
| 20 | % | % | 
| 21 |  |  | 
| 22 |  |  | 
| 23 | function A_compute_potential_density(snapshot) | function varargout = A_compute_potential_density(snapshot) | 
| 24 |  |  | 
| 25 |  |  | 
| 26 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 155 | nc{ncid}(:,:,:)        = SIGMATHETA; | nc{ncid}(:,:,:)        = SIGMATHETA; | 
| 156 |  |  | 
| 157 | nc=close(nc); | nc=close(nc); | 
| 158 |  | close(ncTHETA); | 
| 159 |  | close(ncSALTa); | 
| 160 |  |  | 
| 161 |  | % Outputs: | 
| 162 | % Output: | output = struct('SIGMATHETA',SIGMATHETA,'dpt',dpt,'lat',lat,'lon',lon); | 
| 163 | switch nargout | switch nargout | 
| 164 | case 1 | case 1 | 
| 165 | varargout(1) = SIGMATHETA; | varargout(1) = {output}; | 
|  | case 2 |  | 
|  | varargout(1) = SIGMATHETA; |  | 
|  | varargout(2) = lon; |  | 
|  | case 3 |  | 
|  | varargout(1) = SIGMATHETA; |  | 
|  | varargout(2) = lon; |  | 
|  | varargout(3) = lat; |  | 
|  | case 4 |  | 
|  | varargout(1) = SIGMATHETA; |  | 
|  | varargout(2) = lon; |  | 
|  | varargout(3) = lat; |  | 
|  | varargout(4) = dpt; |  | 
| 166 | end | end |