/[MITgcm]/MITgcm_contrib/jmc_script/grph_StD.m
ViewVC logotype

Diff of /MITgcm_contrib/jmc_script/grph_StD.m

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

revision 1.1 by jmc, Thu May 29 23:47:13 2008 UTC revision 1.9 by jmc, Sat Sep 10 22:05:35 2016 UTC
# Line 1  Line 1 
1  Nexp=3;   prefix='dynStD';
2    Nc=4; nc=Nc*ones(1,Nexp); prefix='stDiag';  %prefix='iceStD';
3   namA(1,1:Nc)='r06a';   namA={'g02','b02'};
4   namA(2,1:Nc)='r07a';  %namA={'r17a'};
5   namA(3,1:Nc)='r07b';   Nexp=size(namA,2);
6  %-  %-
7    
8  % $Header$  % $Header$
9  % $Name$  % $Name$
10    
   
11  nItMx=1e10*ones(1,Nexp); %nItMx(3)=11;  nItMx=1e10*ones(1,Nexp); %nItMx(3)=11;
12  %nItMx=360*ones(1,Nexp);  %nItMx=2400*ones(1,Nexp);
13  namLg=namA ; for n=1:Nexp, namLg(n,find(namLg(n,:)=='_'))='-'; end  namLg=namA ; namLg=strrep(namLg,'_','\_');
14    undef=123456.7;
15  %-----------  %-----------
 %- ngEn = Nb of Energy plot: = 2 or = 4  ;  
 ngEn=2;  
16  %- test if the variable krd is define :  %- test if the variable krd is define :
17  if size(who('krd'),1) > 0,  if size(who('krd'),1) > 0,
18   fprintf('krd is defined and = %i \n',krd);   fprintf('krd is defined and = %i \n',krd);
# Line 24  end Line 22  end
22  if krd > 0,  if krd > 0,
23  %- define list of fields to read in:  %- define list of fields to read in:
24  %listV={'Eta','U','V','W','T','S','DETADT2','RELHUM','Phi'};  %listV={'Eta','U','V','W','T','S','DETADT2','RELHUM','Phi'};
25  %listV={'Eta','U','V','W','T','S','CONVADJ','DETADT2'};  %listV={'Eta','W','T','S','CONVADJ','DETADT2'};
26    %listV={'Eta','UE_VEL_C','VN_VEL_C','W','T','DETADT2','Phi'};
27  %- or take all them:  %- or take all them:
28  clear listV ; listV='all_flds';   clear listV ; listV='all_flds';
29  %-----------  %-----------
30    
31  %- start to read the longest record:  %- start to read the longest record:
32    n=1; rf=-1; if strcmp(char(listV),'all_flds'), rf=0; end    n=1; rf=-1; if strcmp(char(listV),'all_flds'), rf=0; end
33    [ntA(n),rList,tim,vv1,listV] = ...    [ntA(n),rList,tim,vv1,listV] = ...
34      read_StD(prefix,namA(n,1:nc(n)),listV);      read_StD(prefix,namA(n),listV);
35    nIt=ntA(n); nk=size(vv1,1); nRg=size(vv1,3);    nIt=ntA(n); nk=size(vv1,1); nRg=size(vv1,3);
36  %- set global dims: & load vvA --> vvB  %- set global dims: & load vvA --> vvB
37    nbV=size(listV,2);    nbV=size(listV,2);
# Line 42  clear listV ; listV='all_flds'; Line 41  clear listV ; listV='all_flds';
41  %----  %----
42   for n=2:Nexp,   for n=2:Nexp,
43    [ntA(n),rList,tim,vv1,listV] = ...    [ntA(n),rList,tim,vv1,listV] = ...
44      read_StD(prefix,namA(n,1:nc(n)),listV);      read_StD(prefix,namA(n),listV);
45    nIt=ntA(n); nk=size(vv1,1); nRg=size(vv1,3);    nIt=ntA(n); nk=size(vv1,1); nRg=size(vv1,3);
46    if (nrec < nIt),    if (nrec < nIt),
47      fprintf('\n');      fprintf('\n');
# Line 58  clear listV ; listV='all_flds'; Line 57  clear listV ; listV='all_flds';
57     fprintf('save to "sav_StD.mat" file ...');     fprintf('save to "sav_StD.mat" file ...');
58     save('sav_StD.mat','vvA','tiA','ntA','rList','listV');     save('sav_StD.mat','vvA','tiA','ntA','rList','listV');
59     fprintf(' done\n')     fprintf(' done\n')
60   end   end
61  elseif krd < 0,  elseif krd < 0,
62   fprintf('load from "sav_StD.mat" file ...');   fprintf('load from "sav_StD.mat" file ...');
63   load sav_StD   load sav_StD
# Line 66  elseif krd < 0, Line 65  elseif krd < 0,
65  end  end
66  if krd ~= 0,  if krd ~= 0,
67   ttA=squeeze(tiA(:,2,:));   ttA=squeeze(tiA(:,2,:));
68   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';
69     ttA=ttA/30 ; titT='month'; ttA=ttA/12 ; titT='year';
70  end  end
71  %=========================================================  %=========================================================
72    
73  ttax1=0 ; ttax2=0 ; ttay=zeros(nbV,2);  ttax1=0 ; ttax2=0 ; ttay=zeros(nbV,2);
74  %-- fixed time axis bound :  %-- fixed time axis bound :
75  % ttax1=3; ttax2=3.3;  % ttax1=15.; ttax2=20.;
76  %-- fixed Y axis bound :  %-- fixed Y axis bound :
77  % ttay(4,:)=[0 0.6];  % ttay(4,:)=[0 0.6];
78  %-----------  %-----------
# Line 83  end; Line 83  end;
83  %--  %--
84    
85  list_on=zeros(1,nbV);  list_on=zeros(1,nbV);
86  nbG=8;  nbG=18;
87  nbG=min(nbG,nbV); list_on(1:nbG)=1 ;  nbG=min(nbG,nbV); list_on(1:nbG)=1 ;
88    %if nbG < nbV, list_on=0; list_on(nbG:nbV)=1; end %- to get 2nd set of plots
89  %list_on(1:6)=[1 1 1 1 1 1];  %list_on(1:6)=[1 1 1 1 1 1];
90    
91  isA=ones(1,Nexp); ieA=ntA;  isA=ones(1,Nexp); ieA=ntA;
92  %- limit the length : for search of isA <->1500y: find(ttA(:,2) == 1500)  %- limit the length : for search of isA <->1500y: find(ttA(:,2) == 1500)
93  %isA=isA*31 ; % drop the 1rst mnth (1 Monitor/d)  %isA=isA*31 ; % drop the 1rst mnth (1 Monitor/d)
94  %isA=isA*36 ; % drop the 1rst year (1 Monitor/10d)  isA=isA*2 ; % drop the 1rst mnth (1 Monitor/30d)
95  %isA(1)=31 ; isA(2)=4 ; % drop the 1rst mnth  %isA(1)=31 ; isA(2)=4 ; % drop the 1rst mnth
96  %ieA(:)=360; isA(:)=1;  %ieA(:)=240; %isA(:)=1;
97    
98  linA(1,:)='k-'; % ieA(1)=60 ; % ieA(1)=1152 ;  linA(1,:)='k-'; % ieA(1)=60 ; % ieA(1)=1152 ;
99  linA(2,:)='b-';  linA(2,:)='b-';
# Line 102  linA(5,:)='m-'; Line 103  linA(5,:)='m-';
103  linA(6,:)='c-';  linA(6,:)='c-';
104    
105  ieA=min(ieA,nItMx);  ieA=min(ieA,nItMx);
106  %titall='AIM , Cubic-G (32x32) , cpl-FM Forcing' ;  %titall='AIM , Cubic-G (32x32) , cpl-FM Forcing' ;
107  titall='Global Ocean, Cubic-G (32x32) , NCEP Forc (2)' ;  titall='Global Ocean, Cubic-G (32x32) , CORE Forc (2)' ;
108    %titall='Dyncore test-case 5 (cs-32)' ;
109    
110  %=========================================================  %=========================================================
111    ng=0; fxb=100; fyb=60; fdx=100; fdy=40; fsc=1.;
112  for ng=1:nbV,  %fyb=-360; fxb=-2600; fdy=60; fsc=1.5;
113    
114    for jv=1:nbV,
115  %-------------------  %-------------------
116   flag=list_on(ng); kl=0;   flag=list_on(jv); kl=0;
117   vv1=vvA(:,:,:,:,ng,:); namV=char(listV(ng));   vv1=vvA(:,:,:,:,jv,:); namV=char(listV(jv));
118   titv=strrep(namV,'_','\_');   titv=strrep(namV,'_','\_');
119  %if strcmp(namV,'Eta'), vv1=vv1/100; titv='Eta [mb]'; end  %if strcmp(namV,'Eta'), vv1=vv1/100; titv='Eta [mb]'; end
120  %if strcmp(namV,'T'), kl=1; end  %if strcmp(namV,'T'), kl=1; end         % <-- to get surf.Temp
 %if ng == 1, flag=2*list_on(1) ; end  
121   if kl > 0, titv=[titv,'\_',int2str(kl)];   if kl > 0, titv=[titv,'\_',int2str(kl)];
122     fprintf([' var= ',namV,' at level k= %i \n'],kl);     fprintf([' var= ',namV,' at level k= %i \n'],kl);
123   end   end
124    
125   if flag == 1   if flag == 1
126  %--  %--
127    figure(ng); set(ng,'position',[100+100*ng 60+40*ng 500 700]);clf;    ng=ng+1;
128  % if ng == 2, var=squeeze(vv1(2,:,1,:,:)); end % to get surf.Temp  %- reset "ng" to jv for fix fig number (independent of which one is in list_on):
129    var=squeeze(vv1(1+kl,:,1,:,:));    %ng=jv;
130    dd=squeeze(max(var)-min(var)); av=squeeze(mean(var));    figure(ng); set(ng,'position',[fxb+fdx*ng fyb+fdy*ng [500 700]*fsc]);clf;
131     if Nexp == 1, av=av'; dd=dd'; end ;    var=squeeze(vv1(1+kl,:,1,:,:)); dd=zeros(5,Nexp); av=zeros(5,Nexp);
132      for n=1:Nexp,
133       tmp=var(isA(n):ieA(n),:,n); [I]=find(tmp(:,1)==undef); tmp(I,:)=0;
134       av(:,n)=sum(tmp);
135       if length(I) < size(tmp,1), av(:,n)=av(:,n)/(size(tmp,1)-length(I)); end
136       tmp(I,:)=NaN; dd(:,n)=max(tmp)-min(tmp);
137      end
138      var(find(var==undef))=NaN;
139    for nv=1:4,    for nv=1:4,
140      subplot(410+nv); ttmn=' Mx-mn:'; ttav=' Av:';      subplot(410+nv); ttmn=' Mx-mn:'; ttav=' Av:';
141      for n=1:Nexp,      for n=1:Nexp,
# Line 134  for ng=1:nbV, Line 144  for ng=1:nbV,
144        ttmn=sprintf([ttmn,' %2.1e ;'],dd(nv,n));        ttmn=sprintf([ttmn,' %2.1e ;'],dd(nv,n));
145        ttav=sprintf([ttav,' %3.2e ;'],av(nv,n));        ttav=sprintf([ttav,' %3.2e ;'],av(nv,n));
146      end ; hold off ;      end ; hold off ;
     if ttax1 < ttax2, AA=axis; axis([ttax1 ttax2 AA(3:4)]); end;  
147      AA=axis ; dAA=AA(4)-AA(3);      AA=axis ; dAA=AA(4)-AA(3);
148      if AA(3)*AA(4) <= 0, AA(3)=min(AA(3),-dAA/10); AA(4)=max(AA(4),dAA/10); end      if AA(3)*AA(4) <= 0, AA(3)=min(AA(3),-dAA/10); AA(4)=max(AA(4),dAA/10); end
149        if ttax1 < ttax2, AA(1)=ttax1; AA(2)=ttax2; end;
150      axis(AA); grid ;      axis(AA); grid ;
    %AA=axis; text(AA(1)*.9+AA(2)*.1,AA(3)*0.1+AA(4)*0.9,ttmn);  
151      if nv == 1, title(['Avr ',titv,'  ',ttmn]); end      if nv == 1, title(['Avr ',titv,'  ',ttmn]); end
152      if nv == 2, title(['Std-Dev ',titv,'  ',ttav]); end      if nv == 2, title(['Std-Dev ',titv,'  ',ttav]); end
153      if nv == 3, title(['min ',titv,'  ',ttav]); legend(namLg(1:Nexp,:),0); end      if nv == 3, title(['min ',titv,'  ',ttav]); legend(namLg,0); end
154      if nv == 4, title(['Max ',titv,'  ',ttav]); end      if nv == 4, title(['Max ',titv,'  ',ttav]); end
    %if nv == 2, title(['Del-2 ',titv,'  ',ttav]); end  
155    end ; xlabel(titT);    end ; xlabel(titT);
156  %--  %--
157    axes('position',[.01,.01,.99,.99],'Visible','off');    axes('position',[.01,.01,.99,.99],'Visible','off');
# Line 151  for ng=1:nbV, Line 159  for ng=1:nbV,
159    set(T,'HorizontalAlignment','center','FontSize',12);    set(T,'HorizontalAlignment','center','FontSize',12);
160    Td=text(0.99,0.01,date);    Td=text(0.99,0.01,date);
161    set(Td,'HorizontalAlignment','right','FontSize',6);    set(Td,'HorizontalAlignment','right','FontSize',6);
162  %---  %---
163   end   end
164    
165  %-------------------  %-------------------
166  end  end
167    
168  %=========================================================  %=========================================================

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.22