/[MITgcm]/MITgcm_contrib/gmaze_pv/compute_alpha.m
ViewVC logotype

Diff of /MITgcm_contrib/gmaze_pv/compute_alpha.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by gmaze, Mon Jul 10 15:09:01 2006 UTC revision 1.2 by gmaze, Tue Jan 30 22:10:10 2007 UTC
# Line 1  Line 1 
1  %  %
2  % [] = compute_alpha(SNAPSHOT)  % [ALPHA,LON,LAT,DPT] = compute_alpha(SNAPSHOT)
3  %  %
4  % This function computes the thermal expansion coefficient from  % This function computes the thermal expansion coefficient from
5  % files of potential temperature THETA and salinity anomaly  % files of potential temperature THETA and salinity anomaly
6  % SALTanom.  % SALTanom.
7    % SALTanom is by default a salinity anomaly vs 35PSU.
8    % If not, (is absolute value) set the global variable is_SALTanom to 0
9  %  %
10  % Files name are:  % Files name are:
11  % INPUT:  % INPUT:
# Line 40  ferfile = strcat(pathname,sla,snapshot,s Line 42  ferfile = strcat(pathname,sla,snapshot,s
42  ncS   = netcdf(ferfile,'nowrite');  ncS   = netcdf(ferfile,'nowrite');
43  [Slon Slat Sdpt] = coordfromnc(ncS); % but normaly is the same grid as T  [Slon Slat Sdpt] = coordfromnc(ncS); % but normaly is the same grid as T
44    
45    % Salinity field ref;
46    global is_SALTanom
47    if exist('is_SALTanom')
48      if is_SALTanom == 1
49        bS = 35;
50      else
51        bS = 0;
52      end
53    end
54    
55    
56  %%%%%%%%%%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Line 60  ALPHA = zeros(nz,ny,nx).*NaN; Line 71  ALPHA = zeros(nz,ny,nx).*NaN;
71  for iz = 1 : nz  for iz = 1 : nz
72    if toshow,disp(strcat('Compute alpha for level:',num2str(iz),'/',num2str(nz)));end    if toshow,disp(strcat('Compute alpha for level:',num2str(iz),'/',num2str(nz)));end
73    TEMP = ncT{4}(iz,:,:);    TEMP = ncT{4}(iz,:,:);
74    SALT = ncS{4}(iz,:,:) + 35;    SALT = ncS{4}(iz,:,:) + bS;
75    PRES = (0.09998*9.81*Tdpt(iz))*ones(ny,nx);    PRES = (0.09998*9.81*Tdpt(iz))*ones(ny,nx);
76    ALPHA(iz,:,:) = sw_alpha(SALT,TEMP,PRES,'ptmp');    ALPHA(iz,:,:) = sw_alpha(SALT,TEMP,PRES,'ptmp');
77  end %for iz  end %for iz
# Line 123  nc{ncid}(:,:,:)        = ALPHA; Line 134  nc{ncid}(:,:,:)        = ALPHA;
134  nc=close(nc);  nc=close(nc);
135    
136    
137    % Output:
138    switch nargout
139     case 1
140      varargout(1) = ALPHA;
141     case 2
142      varargout(1) = ALPHA;
143      varargout(2) = Tlon;
144     case 3
145      varargout(1) = ALPHA;
146      varargout(2) = Tlon;
147      varargout(3) = Tlat;
148     case 4
149      varargout(1) = ALPHA;
150      varargout(2) = Tlon;
151      varargout(3) = Tlat;
152      varargout(4) = Tdpt;
153    end

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22