Global Index (short | long) | Local contents | Local Index (short | long)
This script calls | |
---|---|
clear cd /home/disk/hayes/dvimont/ccm3.6/data/SR filin = 'MAR1.t31x15.nc' nc = netcdf(filin, 'nowrite'); ps = nc{'PS'}(:,:,:); airt = nc{'T'}(:); lev = nc{'lev'}(:); lat = nc{'lat'}(:); lon = nc{'lon'}(:); hyam = nc{'hyam'}(:); hybm = nc{'hybm'}(:); P0 = nc{'P0'}(:); ts1 = nc{'TS1'}(:); ts2 = nc{'TS2'}(:); ts3 = nc{'TS3'}(:); ts4 = nc{'TS4'}(:); nc = close(nc); [nlat, nlon] = size(ps); nlev = length(lev); ps = reshape(ps, 1, nlat*nlon); plevs = P0 * hyam * ones(1, nlat*nlon) + hybm * ps; airt = permute(airt, [2 1 3]); airt = atlev(airt, lev, ps, hyam, hybm, P0); airt = reshape(airt, nlev, nlat*nlon); sound = mean2(airt'); H = 287 * (mean(sound(16:18))) / 9.8; lam = mean((sound(17:18)-sound(16:17))' ./ (H * log(lev(17:18)./lev(16:17)))); sound = [sound (sound(18)+lam*H*log(1050/(lev(18))))] lev = [lev; 1050] H = 287 * (mean(sound(2:3))) / 9.8; lam = (sound(2)-sound(3)) / (H * log(lev(2)/lev(3))); sound(1) = sound(2) - lam * H * log(470/lev(2)) lev(1) = 4.70; airtnew = zeros(size(airt)); for i = 1:nlat*nlon; airtnew(:,i) = interp1(lev*100, sound, plevs(:,i)); end; filin = 'MAR1.t31x15.nc' nc = netcdf(filin, 'nowrite'); airt = squeeze(nc{'T'}(:,:,18,:)); nc = close(nc); airt = reshape(airt, 1, nlat*nlon); tem = reshape(ts1, 1, nlat*nlon); dtem = tem - airt; tem = airtnew(18,:) + dtem; ts1n = tem; tem = reshape(ts2, 1, nlat*nlon); dtem = tem - airt; tem = airtnew(18,:) + dtem; ts2n = tem; tem = reshape(ts3, 1, nlat*nlon); dtem = tem - airt; tem = airtnew(18,:) + dtem; ts3n = tem; tem = reshape(ts4, 1, nlat*nlon); dtem = tem - airt; tem = airtnew(18,:) + dtem; ts4n = tem; airtn = airtnew; airtnew = reshape(airtnew, nlev, nlat, nlon); airtnew = permute(airtnew, [2 1 3]); ts1n = reshape(ts1n, nlat, nlon); ts2n = reshape(ts2n, nlat, nlon); ts3n = reshape(ts3n, nlat, nlon); ts4n = reshape(ts4n, nlat, nlon); filin = 'MAR1.ATREST_INI.nc'; nc = netcdf(filin, 'write'); nc{'T'}(:) = airtnew; u = nc{'U'}(:); nc{'U'}(:) = 1e-5 * ones(size(u)); v = nc{'V'}(:); nc{'V'}(:) = 1e-5 * ones(size(v)); q = nc{'Q'}(:); nc{'Q'}(:) = 1e-12 * ones(size(q)); nc{'TS1'}(:) = ts1n; nc{'TS2'}(:) = ts2n; nc{'TS3'}(:) = ts3n; nc{'TS4'}(:) = ts4n; nc = close(nc);