Back to home page

MITgcm

 
 

    


Warning, /verification/global_ocean.90x40x15/input_ad.kapredi/get_grdchk_location.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit 61b91e10 on 2025-11-21 15:15:30 UTC
61b91e10c1 Ivan*0001 % purpose: find location of grdchk points from "data.grdchk" settings
                0002 
                0003 %- from a model run:
                0004 hFacC=rdmds('hFacC');
                0005 dims=size(hFacC); nx=dims(1); ny=dims(2); nr=dims(3);
                0006 
                0007 %- from SIZE.h :
                0008 sNx=nx/2 ; sNy=ny/2 ;
                0009 
                0010 %- from data.grdchk :
                0011  iGloPos = 31;
                0012  jGloPos = 7;
                0013  kGloPos = 1;
                0014  iGloTile = 2;
                0015  jGloTile = 2;
                0016 
                0017 %- from data.grdchk :
                0018  nstep = 450; nend = 1700;
                0019 
                0020 %- count number of wet-points in this tile(iGloTile,jGloTile):
                0021 nSx=nx/sNx; nSy=ny/sNy;
                0022 
                0023 msk=reshape(ceil(hFacC),[sNx nSx sNy nSy nr]);
                0024 mskTile=squeeze(msk(:,iGloTile,:,jGloTile,:));
                0025 
                0026 cumMsk=cumsum(reshape(mskTile,[sNx*sNy*nr 1]));
                0027 
                0028 %- find location:
                0029  ic1=iGloPos; jc1=jGloPos; kc1=kGloPos;
                0030  ijk1=ic1+(jc1-1)*sNx+(kc1-1)*sNx*sNy;
                0031  yy1=cumMsk(ijk1);
                0032 
                0033  for nstep=450,
                0034 %for nstep=[450 560 553],
                0035     %-- find the location of all grdchk points:
                0036    fprintf('In tile (%i,%i), nstep= %4i , (ic,jc,kc) = ( %2i , %2i , %2i ) :\n', ...
                0037                 iGloTile,jGloTile, nstep,ic1,jc1,kc1);
                0038    for n=0:nstep:nend
                0039      [I]=find(cumMsk==(yy1+n));
                0040      is=I(1)-1;          kg=1+floor(is/(sNx*sNy));
                0041      is=rem(is,sNx*sNy); jg=1+floor(is/sNx);
                0042      is=rem(is,sNx);     ig=1+is;
                0043      fprintf(' #%6i : i,j,k = %2i , %2i , %2i\n',n,ig,jg,kg);
                0044    end
                0045    fprintf(' ------------\n');
                0046  end
                0047 
                0048 return