/[MITgcm]/MITgcm_contrib/dyncore_ASP/csgrids/grid_shift_x.m
ViewVC logotype

Contents of /MITgcm_contrib/dyncore_ASP/csgrids/grid_shift_x.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sat May 31 22:19:13 2008 UTC (15 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: HEAD
add grid-files for cs32 (with Longitude in [0-360]).

1
2 kwr=1;
3 nc=32; np=nc+1; n6x=6*nc; nPg=n6x*nc;
4 xShift=+180;
5
6 %inpName='tile.mitgrid';
7 %rDir='/home/jmc/exp/inp_CS_grid/';
8 inpName='dxC3_dXYa';
9 rDir='../grid_cs_input/';
10 %outpName='tile.newgrid';
11 outpName=[inpName,'_x0'];
12
13 for n=1:6,
14 %-- read :
15 %if strcmp(inpName(1:4),'tile'),
16 %if strcmp(inpName(5:end),'.mitgrid'),
17 p=strfind(inpName,'.');
18 if isempty(p),
19 namF=sprintf([rDir,inpName,'.face%3.3i.bin'],n);
20 else
21 i=min(p);
22 namF=sprintf([rDir,inpName(1:i-1),'%3.3i',inpName(i:end)],n);
23 end
24 fid=fopen(namF,'r','b');
25 vv1=fread(fid,'real*8');
26 fclose(fid);
27 s=size(vv1,1); k1=s/np/np;
28 fprintf(['read: ',namF,' : size: %i (%ix%ix%i)\n'],s,np,np,k1);
29 vv1=reshape(vv1,[np np k1]);
30 %-- do not add angle:
31 vv2=vv1; k2=k1;
32 %- XC YC DXF DYF RA XG YG DXV DYU RAZ DXC DYC RAW RAS DXG DYG:
33 %------------------------------------------------------------------
34 %- shift long:
35 vv2(:,:,1)=vv2(:,:,1)+xShift;
36 vv2(:,:,6)=vv2(:,:,6)+xShift;
37
38 %-- write:
39 if kwr == 1,
40 % if ~strcmp(outpName(1:4),'tile'),
41 p=strfind(outpName,'.');
42 if isempty(p),
43 namW=sprintf([outpName,'.face%3.3i.bin'],n);
44 else
45 namW=sprintf([outpName(1:p-1),'%3.3i',outpName(p:end)],n);
46 end
47 fid=fopen(namW,'w','b');
48 fwrite(fid,vv2,'real*8');
49 fclose(fid);
50 fprintf([' write to file: ',namW,' %i 2D.var(%ix%i)\n'],k2,np,np);
51 end
52 end

  ViewVC Help
Powered by ViewVC 1.1.22