|
1 | 1 | function TePV=Te_analytic(lat,pres,days,limlatSH,limlatNH,A0_SH,A0_NH,A1_SH,A1_NH,T_strat,epsS,epsN,p_hsin,p_bdin,filename)
|
2 | 2 | % Computes analytic profile as a function of latitude, pressure, and day of the year, approximating radiatively found profiles
|
3 |
| -% |
| 3 | +% |
4 | 4 | % Inputs are:
|
5 | 5 | % STRATOSPHERE:
|
6 | 6 | % lat: latitude for output grid [deg]
|
|
17 | 17 | % p_bdin: for pressures below p_bdin [hPa, size latin x days], Tin is used.
|
18 | 18 | % standard: 100hPa
|
19 | 19 | % for p_bdin < p < p_hsin, linear interpolation between the two
|
20 |
| -% filename, if present, is the name of the file containing final tau. |
| 20 | +% filename, if present, is the name of the file containing final tau. |
21 | 21 | % For usage with FMS, this should be [some directory/]temp.nc.
|
22 | 22 | % If empty, no file will be created.
|
23 | 23 | %
|
|
85 | 85 | AS(:,II) = AS(:,II(end)+1)*ones(size(II))'; % choice B: constant amplitude above p1
|
86 | 86 |
|
87 | 87 | Te0 = zeros(size(Te,1),size(Te,2),t_length); %this will be the stratospheric Te
|
88 |
| - for d=1:t_length |
| 88 | + for d=1:t_length |
89 | 89 | cosNH = cos(2*pi*(days(d ))/365); %days(d)-349 for realistic solstice, but needs change in Held-Suarez as well
|
90 | 90 | cosSH = cos(2*pi*(days(d-182.5))/365); %days(d)-166.5 for realistic solstice
|
91 | 91 | if(cosNH>0)
|
|
127 | 127 | else
|
128 | 128 | eps=epsN*cos(2*pi*days(d)/365);
|
129 | 129 | end
|
130 |
| - TeHS(l,k,d)=max(T_strat,(T0 - delT*(sin(lat(l)*pi/180).^2) - eps*sin(lat(l)*pi/180)- delv*log(sigma(k)).*(cos(lat(l)*pi/180).^4)).*(sigma(k)^kap)); |
| 130 | + TeHS(l,k,d)=max(T_strat,(T0 - delT*(sin(lat(l)*pi/180).^2) - eps*sin(lat(l)*pi/180)- delv*log(sigma(k)).*(cos(lat(l)*pi/180).^2)).*(sigma(k)^kap)); |
131 | 131 | end
|
132 | 132 | end
|
133 | 133 | end
|
|
144 | 144 | III=find(pres <= p_bdin(j,d));
|
145 | 145 | TePV(j,III,d) = Te0(j,III,d);
|
146 | 146 | end
|
147 |
| - |
| 147 | + |
148 | 148 | end
|
149 | 149 |
|
150 | 150 |
|
|
173 | 173 | phalf = zeros(length(pres)+1,1);
|
174 | 174 | phalf(2:end-1) = pres(2:end) - diff(pres)/2;
|
175 | 175 | phalf(end) = 1e3;
|
176 |
| - |
177 |
| - |
| 176 | + |
| 177 | + |
178 | 178 | Te = zeros(length(lon),length(lat),length(pres),length(days));
|
179 | 179 | for l=1:length(lon)
|
180 | 180 | Te(l,:,:,:)=TePV;
|
181 | 181 | end
|
182 |
| - |
| 182 | + |
183 | 183 | ncid = netcdf.create(filename,'64BIT_OFFSET');
|
184 | 184 | % define dimensions and variables
|
185 | 185 | lond_id = netcdf.defDim(ncid,'lon',length(lon));
|
|
189 | 189 | pd_id = netcdf.defDim(ncid,'pfull',length(pres'));
|
190 | 190 | phd_id = netcdf.defDim(ncid,'phalf',length(phalf));
|
191 | 191 | td_id = netcdf.defDim(ncid,'time',netcdf.getConstant('NC_UNLIMITED'));
|
192 |
| - |
| 192 | + |
193 | 193 | lon_id = netcdf.defVar(ncid,'lon','double',lond_id);
|
194 | 194 | netcdf.putAtt(ncid,lon_id,'long_name','longitude');
|
195 | 195 | netcdf.putAtt(ncid,lon_id,'units','degrees_E');
|
|
224 | 224 | netcdf.putAtt(ncid,t_id,'units','days since 0000-00-00 00:00:00');
|
225 | 225 | %netcdf.putAtt(ncid,t_id,'calendar_type','NO_CALENDAR'); %THIRTY_DAY_MONTHS %THIRTY_DAY_MONTHS
|
226 | 226 | %netcdf.putAtt(ncid,t_id,'calendar','NO_CALENDAR'); %writetempin_time.m
|
227 |
| - |
| 227 | + |
228 | 228 | T_id = netcdf.defVar(ncid,'temp','double',[lond_id,latd_id,pd_id,td_id]);
|
229 | 229 | netcdf.putAtt(ncid,T_id,'long_name','radiative relaxation temperature');
|
230 | 230 | netcdf.putAtt(ncid,T_id,'units','deg_K');
|
231 | 231 | netcdf.putAtt(ncid,T_id,'valid_range',[0,500]);
|
232 | 232 | netcdf.putAtt(ncid,T_id,'missing_value',-1.e+10);
|
233 |
| - |
234 |
| - |
| 233 | + |
| 234 | + |
235 | 235 | netcdf.endDef(ncid);
|
236 | 236 | % write fields
|
237 | 237 | netcdf.putVar(ncid,lon_id,lon);
|
|
242 | 242 | netcdf.putVar(ncid,ph_id,phalf);
|
243 | 243 | netcdf.putVar(ncid,t_id,0,length(days),days);
|
244 | 244 | netcdf.putVar(ncid,T_id,[0,0,0,0],[size(Te,1),size(Te,2),size(Te,3),size(Te,4)],Te);
|
245 |
| - |
246 |
| - |
| 245 | + |
| 246 | + |
247 | 247 | netcdf.close(ncid)
|
248 |
| - |
| 248 | + |
249 | 249 | end
|
250 | 250 | end
|
251 |
| - |
0 commit comments