Warning, /verification/so_box_biogeo/input/mk_obConnect.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit b3bb0a4e on 2014-11-25 01:15:51 UTC
b3bb0a4e3f Jean*0001
0002 rDir='../run/'; nf=0;
0003 kwr=1;
0004
0005 %-----------------------------
0006 gDir=rDir; %gDir='res_ex2/';
0007 G=load_grid(gDir);
0008 nx=G.dims(1); ny=G.dims(2); nr=G.dims(3);
0009 nPxy=nx*ny; npx=nx+1; npy=ny+1;
0010 %-----------------------------
0011
0012 mskInC=rdmds([rDir,'maskInC']);
0013 mskInW=rdmds([rDir,'maskInW']);
0014 mskInS=rdmds([rDir,'maskInS']);
0015
0016 msk=G.hFacC;
0017 msk=min(msk,1); msk=ceil(msk); msk1=msk(:,:,1);
0018
0019 ccB=[-1 2];
0020 xax=G.xAxC ; yax=G.yAxC;
0021 dxRed=0.1; dyRed=0; dxB=0.02; dyB=0.9;
0022 [xyP,xyB]=def_subP(2,dxRed,dyRed,dxB,dyB);
0023 xtxt=mean(xax); ytxt=yax(1)-(yax(end)-yax(1))*0.11;
0024
0025 %-- mask at OB:
0026 mskOBw=squeeze(G.hFacW(2,:,:));
0027 mskOBe=squeeze(G.hFacW(nx,:,:));
0028 mskOBn=squeeze(G.hFacS(:,ny,:));
0029 mskOBw=ceil(mskOBw);
0030 mskOBe=ceil(mskOBe);
0031 mskOBn=ceil(mskOBn);
0032
0033 %-- make connected pieces Id "by hand" (+ lot to check):
0034 k=12;
0035 nf=nf+1; figure(nf);clf; nsp=0;
0036 nsp=nsp+1; axes('position',xyP(nsp,:));
0037 var=mskInC;
0038 var(find(msk(:,:,k)==0))=NaN;
0039 %mnV=min(var(:)); MxV=max(var(:));
0040 imagesc(xax,yax,var'); set(gca,'YDir','normal');%colorbar('horiz');
0041 if ccB(2) > ccB(1), caxis(ccB); end
0042 change_colmap(-1);
0043 BB=colorbar; set(BB,'Position',xyB(nsp,:));
0044 %text(xtxt,ytxt,sprintf('min,Max= %9.5g , %9.5g', mnV, MxV))
0045 title(['maskInC + domain @ k= ',int2str(k)]);
0046
0047 k=13;
0048 mskOBw(11:ny,k)=2*mskOBw(11:ny,k);
0049 mskOBn(1,k)=2*mskOBn(1,k);
0050 mskOBn(21:nx-2,k)=3*mskOBn(21:nx-2,k);
0051 mskOBn(nx-1:nx,k)=4*mskOBn(nx-1:nx,k);
0052 mskOBe(1:10,k)=3*mskOBe(1:10,k);
0053 mskOBe(12:15,k)=5*mskOBe(12:15,k);
0054 mskOBe(17:ny,k)=4*mskOBe(17:ny,k);
0055
0056 nsp=nsp+1; axes('position',xyP(nsp,:));
0057 var=mskInC;
0058 var(find(msk(:,:,k)==0))=NaN;
0059 imagesc(xax,yax,var'); set(gca,'YDir','normal');%colorbar('horiz');
0060 if ccB(2) > ccB(1), caxis(ccB); end
0061 change_colmap(-1);
0062 BB=colorbar; set(BB,'Position',xyB(nsp,:));
0063 title(['maskInC + domain @ k= ',int2str(k)]);
0064
0065 k=14;
0066 mskOBw(11:ny,k)=2*mskOBw(11:ny,k);
0067 mskOBn(1,k)=2*mskOBn(1,k);
0068 mskOBn(1:20,k)=5*mskOBn(1:20,k);
0069 mskOBn(21:nx-2,k)=3*mskOBn(21:nx-2,k);
0070 mskOBn(nx-1:nx,k)=4*mskOBn(nx-1:nx,k);
0071 mskOBe(1:10,k)=3*mskOBe(1:10,k);
0072 mskOBe(17:ny,k)=4*mskOBe(17:ny,k);
0073
0074 nf=nf+1; figure(nf);clf; nsp=0;
0075 nsp=nsp+1; axes('position',xyP(nsp,:));
0076 var=mskInC;
0077 var(find(msk(:,:,k)==0))=NaN;
0078 imagesc(xax,yax,var'); set(gca,'YDir','normal');%colorbar('horiz');
0079 if ccB(2) > ccB(1), caxis(ccB); end
0080 change_colmap(-1);
0081 BB=colorbar; set(BB,'Position',xyB(nsp,:));
0082 title(['maskInC + domain @ k= ',int2str(k)]);
0083
0084 k=15;
0085 mskOBw(11:ny,k)=2*mskOBw(11:ny,k);
0086 mskOBn(21:nx-2,k)=4*mskOBn(21:nx-2,k);
0087 mskOBe(1:10,k)=3*mskOBe(1:10,k);
0088
0089 nsp=nsp+1; axes('position',xyP(nsp,:));
0090 var=mskInC;
0091 var(find(msk(:,:,k)==0))=NaN;
0092 imagesc(xax,yax,var'); set(gca,'YDir','normal');%colorbar('horiz');
0093 if ccB(2) > ccB(1), caxis(ccB); end
0094 change_colmap(-1);
0095 BB=colorbar; set(BB,'Position',xyB(nsp,:));
0096 title(['maskInC + domain @ k= ',int2str(k)]);
0097
0098 prec='real*4';
0099 if kwr > 0,
0100 var=mskOBn; namf='connect_obN.bin';
0101 fprintf(' write file: %-25s (%i %i)',namf,size(var));
0102 fid=fopen(namf,'w','b'); fwrite(fid,var,prec); fclose(fid);
0103 fprintf('\n');
0104 var=mskOBe; namf='connect_obE.bin';
0105 fprintf(' write file: %-25s (%i %i)',namf,size(var));
0106 fid=fopen(namf,'w','b'); fwrite(fid,var,prec); fclose(fid);
0107 fprintf('\n');
0108 var=mskOBw; namf='connect_obW.bin';
0109 fprintf(' write file: %-25s (%i %i)',namf,size(var));
0110 fid=fopen(namf,'w','b'); fwrite(fid,var,prec); fclose(fid);
0111 fprintf('\n');
0112 %- also write a zero field
0113 var=zeros(nx,nr); namf='zeros_obX.bin';
0114 fprintf(' write file: %-25s (%i %i)',namf,size(var));
0115 fid=fopen(namf,'w','b'); fwrite(fid,var,prec); fclose(fid);
0116 fprintf('\n');
0117 end
0118
0119 xob=[1:2*ny+nx]; zcp=G.rC; zfp=G.rF;
0120 zc=[1:nr]; zf=0.5:nr+0.5;
0121 xob=[1:nx]; yob=[1:ny];
0122
0123 ccB=[-0.2 5.2];
0124 nf=nf+1; figure(nf); clf;
0125 subplot(221);
0126 var=mskOBw; var(find(var==0))=NaN;
0127 imagesc(yob,zc,var'); set(gca,'YDir','reverse');%colorbar('horiz');
0128 caxis(ccB);
0129 change_colmap(-1);
0130 colorbar;
0131 title('mskOBw');
0132
0133 subplot(222);
0134 var=mskOBe; var(find(var==0))=NaN;
0135 imagesc(yob,zc,var'); set(gca,'YDir','reverse');%colorbar('horiz');
0136 caxis(ccB);
0137 %colorbar;
0138 title('mskOBe');
0139
0140 subplot(212);
0141 var=mskOBn; var(find(var==0))=NaN;
0142 imagesc(xob,zc,var'); set(gca,'YDir','reverse');%colorbar('horiz');
0143 caxis(ccB);
0144 %colorbar;
0145 title('mskOBn');
0146
0147 return
0148
0149 k1=1; ccB=[-1 2];
0150 nf=nf+1; figure(nf);clf; nsp=0;
0151 nsp=nsp+1; axes('position',xyP(nsp,:));
0152 var=mskInW;
0153 var(find(G.hFacW(:,:,k1)==0))=NaN;
0154 mnV=min(var(:)); MxV=max(var(:));
0155 imagesc(xax,yax,var'); set(gca,'YDir','normal');%colorbar('horiz');
0156 %ccB=[mnV MxV]+[-1 1]*(MxV-mnV)*0.05;
0157 if ccB(2) > ccB(1), caxis(ccB); end
0158 change_colmap(-1);
0159 BB=colorbar; set(BB,'Position',xyB(nsp,:));
0160 text(xtxt,ytxt,sprintf('min,Max= %9.5g , %9.5g', mnV, MxV))
0161 title(['maskInW + domain @ k= ',int2str(k1)]);
0162
0163 nsp=nsp+1; axes('position',xyP(nsp,:));
0164 var=mskInS;
0165 var(find(G.hFacS(:,:,k1)==0))=NaN;
0166 mnV=min(var(:)); MxV=max(var(:));
0167 imagesc(xax,yax,var'); set(gca,'YDir','normal');%colorbar('horiz');
0168 if ccB(2) > ccB(1), caxis(ccB); end
0169 change_colmap(-1);
0170 BB=colorbar; set(BB,'Position',xyB(nsp,:));
0171 text(xtxt,ytxt,sprintf('min,Max= %9.5g , %9.5g', mnV, MxV))
0172 title(['maskInS + domain @ k= ',int2str(k1)]);