--- MITgcm_contrib/jmc_script/grph_StD.m 2008/05/29 23:47:13 1.1 +++ MITgcm_contrib/jmc_script/grph_StD.m 2016/09/10 22:05:35 1.9 @@ -1,20 +1,18 @@ -Nexp=3; - Nc=4; nc=Nc*ones(1,Nexp); prefix='stDiag'; - namA(1,1:Nc)='r06a'; - namA(2,1:Nc)='r07a'; - namA(3,1:Nc)='r07b'; + prefix='dynStD'; +%prefix='iceStD'; + namA={'g02','b02'}; +%namA={'r17a'}; + Nexp=size(namA,2); %- -% $Header: /home/ubuntu/mnt/e9_copy/MITgcm_contrib/jmc_script/grph_StD.m,v 1.1 2008/05/29 23:47:13 jmc Exp $ +% $Header: /home/ubuntu/mnt/e9_copy/MITgcm_contrib/jmc_script/grph_StD.m,v 1.9 2016/09/10 22:05:35 jmc Exp $ % $Name: $ - nItMx=1e10*ones(1,Nexp); %nItMx(3)=11; -%nItMx=360*ones(1,Nexp); -namLg=namA ; for n=1:Nexp, namLg(n,find(namLg(n,:)=='_'))='-'; end +%nItMx=2400*ones(1,Nexp); +namLg=namA ; namLg=strrep(namLg,'_','\_'); +undef=123456.7; %----------- -%- ngEn = Nb of Energy plot: = 2 or = 4 ; -ngEn=2; %- test if the variable krd is define : if size(who('krd'),1) > 0, fprintf('krd is defined and = %i \n',krd); @@ -24,15 +22,16 @@ if krd > 0, %- define list of fields to read in: %listV={'Eta','U','V','W','T','S','DETADT2','RELHUM','Phi'}; -%listV={'Eta','U','V','W','T','S','CONVADJ','DETADT2'}; +%listV={'Eta','W','T','S','CONVADJ','DETADT2'}; +%listV={'Eta','UE_VEL_C','VN_VEL_C','W','T','DETADT2','Phi'}; %- or take all them: -clear listV ; listV='all_flds'; + clear listV ; listV='all_flds'; %----------- %- start to read the longest record: n=1; rf=-1; if strcmp(char(listV),'all_flds'), rf=0; end [ntA(n),rList,tim,vv1,listV] = ... - read_StD(prefix,namA(n,1:nc(n)),listV); + read_StD(prefix,namA(n),listV); nIt=ntA(n); nk=size(vv1,1); nRg=size(vv1,3); %- set global dims: & load vvA --> vvB nbV=size(listV,2); @@ -42,7 +41,7 @@ %---- for n=2:Nexp, [ntA(n),rList,tim,vv1,listV] = ... - read_StD(prefix,namA(n,1:nc(n)),listV); + read_StD(prefix,namA(n),listV); nIt=ntA(n); nk=size(vv1,1); nRg=size(vv1,3); if (nrec < nIt), fprintf('\n'); @@ -58,7 +57,7 @@ fprintf('save to "sav_StD.mat" file ...'); save('sav_StD.mat','vvA','tiA','ntA','rList','listV'); fprintf(' done\n') - end + end elseif krd < 0, fprintf('load from "sav_StD.mat" file ...'); load sav_StD @@ -66,13 +65,14 @@ end if krd ~= 0, ttA=squeeze(tiA(:,2,:)); - ttA=ttA/86400; titT='days'; ttA=ttA/30 ; titT='month'; ttA=ttA/12 ; titT='year'; + ttA=ttA/3600; titT='hrs'; ttA=ttA/24; titT='days'; + ttA=ttA/30 ; titT='month'; ttA=ttA/12 ; titT='year'; end %========================================================= ttax1=0 ; ttax2=0 ; ttay=zeros(nbV,2); %-- fixed time axis bound : -% ttax1=3; ttax2=3.3; +% ttax1=15.; ttax2=20.; %-- fixed Y axis bound : % ttay(4,:)=[0 0.6]; %----------- @@ -83,16 +83,17 @@ %-- list_on=zeros(1,nbV); -nbG=8; +nbG=18; nbG=min(nbG,nbV); list_on(1:nbG)=1 ; +%if nbG < nbV, list_on=0; list_on(nbG:nbV)=1; end %- to get 2nd set of plots %list_on(1:6)=[1 1 1 1 1 1]; isA=ones(1,Nexp); ieA=ntA; -%- limit the length : for search of isA <->1500y: find(ttA(:,2) == 1500) +%- limit the length : for search of isA <->1500y: find(ttA(:,2) == 1500) %isA=isA*31 ; % drop the 1rst mnth (1 Monitor/d) -%isA=isA*36 ; % drop the 1rst year (1 Monitor/10d) +isA=isA*2 ; % drop the 1rst mnth (1 Monitor/30d) %isA(1)=31 ; isA(2)=4 ; % drop the 1rst mnth -%ieA(:)=360; isA(:)=1; +%ieA(:)=240; %isA(:)=1; linA(1,:)='k-'; % ieA(1)=60 ; % ieA(1)=1152 ; linA(2,:)='b-'; @@ -102,30 +103,39 @@ linA(6,:)='c-'; ieA=min(ieA,nItMx); -%titall='AIM , Cubic-G (32x32) , cpl-FM Forcing' ; -titall='Global Ocean, Cubic-G (32x32) , NCEP Forc (2)' ; +%titall='AIM , Cubic-G (32x32) , cpl-FM Forcing' ; +titall='Global Ocean, Cubic-G (32x32) , CORE Forc (2)' ; +%titall='Dyncore test-case 5 (cs-32)' ; %========================================================= - -for ng=1:nbV, +ng=0; fxb=100; fyb=60; fdx=100; fdy=40; fsc=1.; +%fyb=-360; fxb=-2600; fdy=60; fsc=1.5; + +for jv=1:nbV, %------------------- - flag=list_on(ng); kl=0; - vv1=vvA(:,:,:,:,ng,:); namV=char(listV(ng)); + flag=list_on(jv); kl=0; + vv1=vvA(:,:,:,:,jv,:); namV=char(listV(jv)); titv=strrep(namV,'_','\_'); %if strcmp(namV,'Eta'), vv1=vv1/100; titv='Eta [mb]'; end -%if strcmp(namV,'T'), kl=1; end -%if ng == 1, flag=2*list_on(1) ; end +%if strcmp(namV,'T'), kl=1; end % <-- to get surf.Temp if kl > 0, titv=[titv,'\_',int2str(kl)]; fprintf([' var= ',namV,' at level k= %i \n'],kl); end if flag == 1 %-- - figure(ng); set(ng,'position',[100+100*ng 60+40*ng 500 700]);clf; -% if ng == 2, var=squeeze(vv1(2,:,1,:,:)); end % to get surf.Temp - var=squeeze(vv1(1+kl,:,1,:,:)); - dd=squeeze(max(var)-min(var)); av=squeeze(mean(var)); - if Nexp == 1, av=av'; dd=dd'; end ; + ng=ng+1; +%- reset "ng" to jv for fix fig number (independent of which one is in list_on): + %ng=jv; + figure(ng); set(ng,'position',[fxb+fdx*ng fyb+fdy*ng [500 700]*fsc]);clf; + var=squeeze(vv1(1+kl,:,1,:,:)); dd=zeros(5,Nexp); av=zeros(5,Nexp); + for n=1:Nexp, + tmp=var(isA(n):ieA(n),:,n); [I]=find(tmp(:,1)==undef); tmp(I,:)=0; + av(:,n)=sum(tmp); + if length(I) < size(tmp,1), av(:,n)=av(:,n)/(size(tmp,1)-length(I)); end + tmp(I,:)=NaN; dd(:,n)=max(tmp)-min(tmp); + end + var(find(var==undef))=NaN; for nv=1:4, subplot(410+nv); ttmn=' Mx-mn:'; ttav=' Av:'; for n=1:Nexp, @@ -134,16 +144,14 @@ ttmn=sprintf([ttmn,' %2.1e ;'],dd(nv,n)); ttav=sprintf([ttav,' %3.2e ;'],av(nv,n)); end ; hold off ; - if ttax1 < ttax2, AA=axis; axis([ttax1 ttax2 AA(3:4)]); end; AA=axis ; dAA=AA(4)-AA(3); if AA(3)*AA(4) <= 0, AA(3)=min(AA(3),-dAA/10); AA(4)=max(AA(4),dAA/10); end + if ttax1 < ttax2, AA(1)=ttax1; AA(2)=ttax2; end; axis(AA); grid ; - %AA=axis; text(AA(1)*.9+AA(2)*.1,AA(3)*0.1+AA(4)*0.9,ttmn); if nv == 1, title(['Avr ',titv,' ',ttmn]); end if nv == 2, title(['Std-Dev ',titv,' ',ttav]); end - if nv == 3, title(['min ',titv,' ',ttav]); legend(namLg(1:Nexp,:),0); end + if nv == 3, title(['min ',titv,' ',ttav]); legend(namLg,0); end if nv == 4, title(['Max ',titv,' ',ttav]); end - %if nv == 2, title(['Del-2 ',titv,' ',ttav]); end end ; xlabel(titT); %-- axes('position',[.01,.01,.99,.99],'Visible','off'); @@ -151,10 +159,10 @@ set(T,'HorizontalAlignment','center','FontSize',12); Td=text(0.99,0.01,date); set(Td,'HorizontalAlignment','right','FontSize',6); -%--- +%--- end -%------------------- +%------------------- end %=========================================================