| 1 | 
 nx=120;ny=31;nz=29;n=nx*ny*nz;nens=30;iter=68; | 
 nx=120;ny=31;nz=29;n=nx*ny*nz;nens=30; | 
| 2 | 
  | 
 %iter=68; | 
| 3 | 
  | 
 z=15; | 
| 4 | 
  | 
 disp=1; | 
| 5 | 
  | 
 disprms=0; | 
| 6 | 
  | 
 jpg=0; | 
| 7 | 
  | 
 vars=['U' 'V' 'W' 'P' 'T']; | 
| 8 | 
  | 
 U=find(vars=='U'); | 
| 9 | 
  | 
 V=find(vars=='V'); | 
| 10 | 
  | 
 W=find(vars=='W'); | 
| 11 | 
  | 
 P=find(vars=='P'); | 
| 12 | 
  | 
 T=find(vars=='T'); | 
| 13 | 
  | 
 varnum= size(vars,2); | 
| 14 | 
  | 
  | 
| 15 | 
  | 
  | 
| 16 | 
 filename=sprintf('%s','../00/assimilate/pickup.in') | 
 %filename=sprintf('%s','../da/00/assimilate/pickup.in') | 
| 17 | 
 %filename=sprintf('%s%03i%s','../00/assimilate/pickup.',iter,'.out') | 
 filename=sprintf('%s%03i%s','../da/00/assimilate/pickup.',iter,'.out'); | 
| 18 | 
 fid=fopen(filename,'r','ieee-be'); | 
 %filename=sprintf('%s','../da/i90/00/assimilate/pickup.0000016820.001.001.data') | 
| 19 | 
  | 
  fid=fopen(filename,'r','ieee-be'); | 
| 20 | 
 foo=fread(fid,13*n+ny*nx,'float64'); | 
 foo=fread(fid,13*n+ny*nx,'float64'); | 
| 21 | 
 %s=0; mn(k+1)=mean(foo(s*n+1:s*n+n)); | 
 i=0;tru(:,:,:,U)=reshape(foo(i*n+1:(i+1)*n),[nx ny nz]); | 
| 22 | 
 i=0;truu=reshape(foo(i*n+1:(i+1)*n),[nx ny nz]); | 
 i=3;tru(:,:,:,V)=reshape(foo(i*n+1:(i+1)*n),[nx ny nz]); | 
| 23 | 
 i=3;truv=reshape(foo(i*n+1:(i+1)*n),[nx ny nz]); | 
 i=6;tru(:,:,:,W)=reshape(foo(i*n+1:(i+1)*n),[nx ny nz]); | 
| 24 | 
 i=6;truw=reshape(foo(i*n+1:(i+1)*n),[nx ny nz]); | 
 i=7;tru(:,:,:,T)=reshape(foo(i*n+1:(i+1)*n),[nx ny nz]); | 
| 25 | 
  | 
 fclose(fid); | 
| 26 | 
  | 
  | 
| 27 | 
  | 
  | 
| 28 | 
 for k=1:nens | 
 for k=1:nens | 
| 29 | 
 %k=0; | 
 %k=0; | 
| 30 | 
 %filename=sprintf('%s%02i%s%03i%s','../',k,'/assimilate/pickup.',iter,'.out') | 
 %filename=sprintf('%s%02i%s','../da/',k,'/assimilate/pickup.in') | 
| 31 | 
 filename=sprintf('%s%02i%s','../',k,'/assimilate/pickup.in') | 
 filename=sprintf('%s%02i%s%03i%s','../da/',k,'/assimilate/pickup.',iter,'.out') | 
| 32 | 
  | 
 %filename=sprintf('%s%02i%s','../da/i90/',k,'/assimilate/pickup.0000016820.001.001.data') | 
| 33 | 
 fid=fopen(filename,'r','ieee-be'); | 
 fid=fopen(filename,'r','ieee-be'); | 
| 34 | 
 foo=fread(fid,13*n+ny*nx,'float64'); | 
 foo=fread(fid,13*n+ny*nx,'float64'); | 
 | 
 %s=0; mn(k+1)=mean(foo(s*n+1:s*n+n)); | 
  | 
 | 
 i=0;memu(:,k)=foo(i*n+1:(i+1)*n); | 
  | 
 | 
 i=3;memv(:,k)=foo(i*n+1:(i+1)*n); | 
  | 
 | 
 i=6;memw(:,k)=foo(i*n+1:(i+1)*n); | 
  | 
| 35 | 
 fclose(fid); | 
 fclose(fid); | 
| 36 | 
  | 
 filename=sprintf('%s%02i%s%03i%s','../da/',k,'/assimilate/pickup_nh.',iter,'.out') | 
| 37 | 
  | 
 fid=fopen(filename,'r','ieee-be'); | 
| 38 | 
  | 
 foonh=fread(fid,2*n,'float64'); | 
| 39 | 
  | 
 fclose(fid); | 
| 40 | 
  | 
 i=0;mem(:,U,k)=foo(i*n+1:(i+1)*n); | 
| 41 | 
  | 
 i=3;mem(:,V,k)=foo(i*n+1:(i+1)*n); | 
| 42 | 
  | 
 i=6;mem(:,W,k)=foo(i*n+1:(i+1)*n); | 
| 43 | 
  | 
 i=7;mem(:,T,k)=foo(i*n+1:(i+1)*n); | 
| 44 | 
  | 
 i=0;mem(:,P,k)=foonh(i*n+1:(i+1)*n); | 
| 45 | 
  | 
 end | 
| 46 | 
  | 
  | 
| 47 | 
  | 
 ens=reshape(mean(mem,3),[nx ny nz varnum]); | 
| 48 | 
  | 
  | 
| 49 | 
  | 
 rms=reshape(std(mem,0,3),[nx ny nz varnum]); | 
| 50 | 
  | 
  | 
| 51 | 
  | 
 iterstr=sprintf('%i',iter); | 
| 52 | 
  | 
 if(disprms) | 
| 53 | 
  | 
    for i=1:varnum | 
| 54 | 
  | 
       figure(i);imagesc(rms(:,:,z,i));colorbar; | 
| 55 | 
  | 
       title(strcat(vars(i),' ensemble rms, iter ',iterstr)); | 
| 56 | 
  | 
    end | 
| 57 | 
  | 
 end | 
| 58 | 
  | 
  | 
| 59 | 
  | 
  | 
| 60 | 
  | 
 if (jpg) | 
| 61 | 
  | 
   for i=1:varnum | 
| 62 | 
  | 
     set(i,'PaperPositionMode', 'manual'); | 
| 63 | 
  | 
     set(i,'PaperPosition',[0.25 0.25 8 10.5]); | 
| 64 | 
  | 
     t=get(get(get(i,'CurrentAxes'),'Title'),'String'); | 
| 65 | 
  | 
     outfilename=sprintf('%s%s%i','rms',t(1),iter); | 
| 66 | 
  | 
     print('-djpeg', outfilename); | 
| 67 | 
  | 
   end | 
| 68 | 
  | 
 end | 
| 69 | 
  | 
  | 
| 70 | 
  | 
 if (disp) | 
| 71 | 
  | 
   subplot(4,2,1);imagesc(tru(:,:,z,U));colorbar; | 
| 72 | 
  | 
   subplot(4,2,3);imagesc(tru(:,:,z,V));colorbar; | 
| 73 | 
  | 
   subplot(4,2,5);imagesc(tru(:,:,z,W));colorbar; | 
| 74 | 
  | 
   subplot(4,2,7);imagesc(tru(:,:,z,T));colorbar; | 
| 75 | 
  | 
  | 
| 76 | 
  | 
   subplot(4,2,2);imagesc(ens(:,:,z,U));colorbar; | 
| 77 | 
  | 
   subplot(4,2,4);imagesc(ens(:,:,z,V));colorbar; | 
| 78 | 
  | 
   subplot(4,2,6);imagesc(ens(:,:,z,W));colorbar; | 
| 79 | 
  | 
   subplot(4,2,8);imagesc(ens(:,:,z,T));colorbar; | 
| 80 | 
  | 
   title(sprintf('%s%i','truth and ensemble mean after assim ',iter)); | 
| 81 | 
 end | 
 end | 
 | 
 ensu(:,:,:)=reshape(mean(memu,2),[nx ny nz]); | 
  | 
 | 
 ensv(:,:,:)=reshape(mean(memv,2),[nx ny nz]); | 
  | 
 | 
 ensw(:,:,:)=reshape(mean(memw,2),[nx ny nz]); | 
  |