Global Index (short | long) | Local contents | Local Index (short | long)
[slpnmc, nxanmc, nyanmc, slph, nxah, nyah, slpc, nxac, nyac]=read_nmc;
[slpnmc, nxanmc, nyanmc, slph, nxah, nyah, slpc, nxac, nyac]=read_nmc; slpnmc, slph, slpc -- slp for nmc, hack, and control data files. nxanmc, nxah, nxac -- nxa for nmc, hack, and control data files. nyanmc, nyah, nyac -- nya for nmc, hack, and control data files. This function reads the history files in the directory: /home/disk/hayes2/dvimont/ccm/T42 It outputs one file: slp.mat -- this contains all the variables listed above. One can retrieve information about the objects stored in a netcdf file by using the command: var(nc, num) -- where num is the number of the variable you want information for
function [slpnmc, nxanmc, nyanmc, slph, nxah, nyah, slpc, nxac, nyac]=read_nmc; cd /home/disk/hayes2/dvimont/ccm/T42 % Define frames lim=[0 360 -90 90]; % Set file inputs file_id1='/home/disk/hayes2/dvimont/ccm/T42/'; file_id2='.nc'; % Read defaults file_in=[file_id1, 'slp.monthly.cl7995', file_id2] [x,nxa,nya,nti,nday,xa,ya,time,xdim,xid]=readnc(file_in,lim); limind = [1 length(nya) 1 length(nxa)]; nc = netcdf(file_in, 'nowrite'); slpnmc = nc{'slp'}(:,limind(1):limind(2),limind(3):limind(4)); nc = close(nc); nxanmc = nxa; nyanmc = nya; % Do the same for hack.nc file_in=[file_id1, 'hack', file_id2] [x,nxa,nya,nti,nday,xa,ya,time,xdim,xid]=readnc(file_in,lim); limind = [1 length(nya) 1 length(nxa)]; nc = netcdf(file_in, 'nowrite'); slph = nc{'PSL'}(:,limind(1):limind(2),limind(3):limind(4)); nc = close(nc); nxah = nxa; nyah = nya; % Do the same for control.nc file_in=[file_id1, 'control', file_id2] [x,nxa,nya,nti,nday,xa,ya,time,xdim,xid]=readnc(file_in,lim); limind = [1 length(nya) 1 length(nxa)]; nc = netcdf(file_in, 'nowrite'); slpc = nc{'PSL'}(:,limind(1):limind(2),limind(3):limind(4)); nc = close(nc); nxac = nxa; nyac = nya; % Interpolate slpnmc to the same grid as slpc and slph [ntm, ny, nx] = size(slpnmc); ntmvec = 1:ntm; nxanmc2 = [(nxanmc((nx-1):nx)-360); nxanmc; (nxanmc(1:2)+360)]; slp2 = shiftdim(slpnmc, 2); slp2 = [slp2(((nx-1):nx),:,:); slp2; slp2(1:2,:,:)]; slp2 = shiftdim(slp2, 1); slp2 = interpn(ntmvec, nyanmc, nxanmc2, slp2, ntmvec, nyah, nxah); slpnmc = slp2.*100; save slp.mat slpnmc slph slpc nxanmc nxah nxac nyanmc nyah nyac