Back to home page

MITgcm

 
 

    


Warning, /utils/exch2/matlab-topology-generator/generate_blanklist.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit 9c1498e5 on 2009-05-26 18:14:38 UTC
503a931bd8 Dimi*0001 % Generate blanklist.example.txt for baseline cs32 setup
                0002 % Requires:
                0003 % MITgcm/verification/global_ocean.cs32x15/input/bathy_Hmin50.bin
                0004 
9c1498e5f5 Dimi*0005 % Another way to get list of empty files is to compile
                0006 % and run (1 iter is enough) without blank-tile and:
                0007 % grep 'Empty tile' output.txt
                0008 % or MPI:
                0009 % grep 'Empty tile' STDOUT.*
                0010 % give this list.
                0011 
503a931bd8 Dimi*0012 addpath ../../matlab/cs_grid/read_cs    % readbin.m location
                0013 nr=32;                                  % face dimension
                0014 nf=6;                                   % number of faces
                0015 tnx=8;tny=4;                            % tile subgrid sizes
                0016 
                0017 fname='../../../verification/global_ocean.cs32x15/input/bathy_Hmin50.bin';
                0018 bathy=readbin(fname,[nr*6 nr],1,'real*8');
                0019 bathy(find(bathy))=1;                   % surface coastline mask
                0020 
                0021 % map the surface coastline and plot tiles
                0022 clf
                0023 image(bathy','CDataMapping','scaled');
                0024 set(gca,'ydir','normal')
                0025 hold on
                0026 for i=(tnx+.5):tnx:(nr*nf)
                0027   plot([i i],[.5 (nr+.5)],'k')
                0028 end
                0029 for i=(tny+.5):tny:nr
                0030   plot([.5 (nr*nf+.5)],[i i],'k')
                0031 end
                0032 
                0033 % generate blanklist and number the tiles in the figure
                0034 blanklist=[];
                0035 for f=1:nf
                0036   for j=1:(nr/tny)
                0037     for i=1:(nr/tnx)
                0038       i1=(f-1)*nr+(i-1)*tnx+1;
                0039       i2=(f-1)*nr+i*tnx;
                0040       j1=(j-1)*tny+1;
                0041       j2=j*tny;
                0042       n=(f-1)*nr+(j-1)*tny+i;
                0043       if sum(sum(bathy(i1:i2,j1:j2)))==0
                0044         blanklist=[blanklist n];
                0045       end
                0046       text(i1+2,j1+2,int2str(n))
                0047     end
                0048   end
                0049 end
                0050 disp(blanklist)