Back to home page

MITgcm

 
 

    


Warning, /utils/matlab/cs_grid/latloncap/plot_compact_mdsio.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit 05129367 on 2007-08-06 21:04:56 UTC
05129367e5 Patr*0001 
                0002 mitfields = 'y'
                0003 if mitfields == 'y'
                0004   ypre  = 'run_ad'
                0005   ydate = '0000000000'
                0006   yvar = 'adxx_theta'
                0007 else
                0008   binfile='run_ad/adxx_theta.0000000000.llc.0.bin';
                0009 end
                0010 cmin = -5.e-3
                0011 cmax =  5.e-3
                0012 
                0013 % "facet" sizes
                0014 % Fifteent level llc_cs90x90x360
                0015 nr=360;nb=90;ng=90;
                0016 nf=ones(6,2);
                0017 nf(1,:)=[nb nr]; nf(2,:)=[ng nr]; nf(3,:)=[ng nb];
                0018 nf(4,:)=[nr nb]; nf(5,:)=[nr ng]; nf(6,:)=[nb ng];
                0019 fdim=prod(nf,2); fd2= cumsum(fdim); fd1=fd2-fdim+1;
                0020 mapIO=1; Nfaces=6;
                0021 
                0022 % Read global bathymetry file
                0023 lgx=2*nb+2*ng+2*nr;
                0024 lgy=nr;
                0025 
                0026 % Bathymetry
                0027   if mapIO == -1,
                0028    gbathy=zeros(lgx,lgy);
                0029    fid=fopen(binfile,'r','ieee-be');
                0030    gbathy=fread(fid,size(gbathy),'float64');
                0031    fclose(fid);
                0032    phi=gbathy;
                0033   else
                0034    gbathy=zeros(fd2(end),1);
                0035    if mitfields == 'y'
                0036      AAA=rdmds([ ypre, '/', yvar, '.', ydate ]);
                0037      gbathy=reshape(squeeze(AAA(:,:,1)),fd2(end),1);
                0038    else
                0039      fid=fopen(binfile,'r','ieee-be');
                0040      gbathy=fread(fid,size(gbathy),'float64');
                0041      fclose(fid);
                0042    end
                0043 %- convert to old format:
                0044    phi=zeros(lgx,lgy); ish=0;
                0045    for n=1:Nfaces,
                0046     is0=ish+1; ie0=ish+nf(n,1);
                0047     phi(is0:ie0,1:nf(n,2))=reshape(gbathy(fd1(n):fd2(n),1),[nf(n,:)]);
                0048     ish=ie0 ;
                0049    end
                0050   end
                0051 
                0052 % Layout facets in a "connected" form.
                0053 lgx=2*nb+2*ng;
                0054 lgy=nr+nb;
                0055 foo=zeros(lgx,lgy);
                0056 xx=[phi(1:nb,1:nr)' phi(nb+1:nb+ng,1:nr)' flipud(phi(nb+2*ng+1:nb+2*ng+nr,1:nb)) ...
                0057     flipud(phi(nb+2*ng+nr+1:nb+2*ng+nr+nr,1:ng))]';
                0058 foo(1:lgx,1:nr)=xx;
                0059 % Duplicate 4 arctic faces on top
                0060 foo(1:nb,       nr+1:nr+ng)=flipud(phi(nb+ng+1:nb+ng+ng,1:nb)');
                0061 foo(1*nb+1:2*nb,nr+1:nr+ng)=phi(nb+ng+1:nb+ng+ng,1:nb);
                0062 foo(2*nb+1:3*nb,nr+1:nr+ng)=fliplr(phi(nb+ng+1:nb+ng+ng,1:nb)');
                0063 foo(3*nb+1:4*nb,nr+1:nr+ng)=flipud(fliplr(phi(nb+ng+1:nb+ng+ng,1:nb)));
                0064 %
                0065 % Fill in depths shallower than a certain depth;
                0066 foo(find(foo==0.))=NaN;
                0067 
                0068 figure
                0069   pcolor(flipud(foo'));
                0070 axis ij;
                0071 shading flat
                0072   set(gca,'XTick',0:30:360);
                0073   set(gca,'YTick',0:45:450);
                0074 grid on
                0075 caxis([cmin cmax]);
                0076 colorbar