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

Annotation of /MITgcm_contrib/jmc_script/grph_StD.m

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


Revision 1.4 - (hide annotations) (download)
Fri Sep 27 23:11:26 2013 UTC (10 years, 7 months ago) by jmc
Branch: MAIN
Changes since 1.3: +5 -5 lines
some minor adjustments

1 jmc 1.3 prefix='dynStD';
2     namA={'r16b','r17a'};
3     %namA={'r17a'};
4 jmc 1.2 Nexp=size(namA,2);
5 jmc 1.1 %-
6 jmc 1.3 %namA(2)={'r16a'};
7 jmc 1.1
8 jmc 1.4 % $Header: /u/gcmpack/MITgcm_contrib/jmc_script/grph_StD.m,v 1.3 2008/11/08 18:26:09 jmc Exp $
9 jmc 1.1 % $Name: $
10    
11    
12     nItMx=1e10*ones(1,Nexp); %nItMx(3)=11;
13 jmc 1.3 nItMx=2400*ones(1,Nexp);
14 jmc 1.2 namLg=namA ; namLg=strrep(namLg,'_','\_');
15 jmc 1.1 %-----------
16     %- test if the variable krd is define :
17     if size(who('krd'),1) > 0,
18     fprintf('krd is defined and = %i \n',krd);
19     else
20     fprintf('krd undefined ; set to 1 \n'); krd=1 ;
21     end
22     if krd > 0,
23     %- define list of fields to read in:
24     %listV={'Eta','U','V','W','T','S','DETADT2','RELHUM','Phi'};
25 jmc 1.4 %listV={'Eta','W','T','S','CONVADJ','DETADT2'};
26 jmc 1.2 %listV={'Eta','UE_VEL_C','VN_VEL_C','W','T','DETADT2','Phi'};
27 jmc 1.1 %- or take all them:
28 jmc 1.4 clear listV ; listV='all_flds';
29 jmc 1.1 %-----------
30    
31     %- start to read the longest record:
32     n=1; rf=-1; if strcmp(char(listV),'all_flds'), rf=0; end
33     [ntA(n),rList,tim,vv1,listV] = ...
34 jmc 1.2 read_StD(prefix,namA(n),listV);
35 jmc 1.1 nIt=ntA(n); nk=size(vv1,1); nRg=size(vv1,3);
36     %- set global dims: & load vvA --> vvB
37     nbV=size(listV,2);
38     nrec=nIt; n3d=nk; nReg=nRg;
39     vvA=zeros(n3d,nrec,nReg,5,nbV,Nexp); tiA=zeros(nrec,2,Nexp);
40     vvA(1:nk,1:nIt,1:nRg,:,:,n)=vv1; tiA(1:nIt,:,n)=tim;
41     %----
42     for n=2:Nexp,
43     [ntA(n),rList,tim,vv1,listV] = ...
44 jmc 1.2 read_StD(prefix,namA(n),listV);
45 jmc 1.1 nIt=ntA(n); nk=size(vv1,1); nRg=size(vv1,3);
46     if (nrec < nIt),
47     fprintf('\n');
48     error([' Nb of records=',int2str(nIt),' exceeds nrec=',int2str(nrec)]);
49     end
50     if (n3d < nk),
51     fprintf('\n');
52     error([' Nb of Levels=',int2str(nk),' exceeds n3d=',int2str(n3d)]);
53     end
54     vvA(1:nk,1:nIt,1:nRg,:,:,n)=vv1; tiA(1:nIt,:,n)=tim;
55     end;
56     if krd == 2,
57     fprintf('save to "sav_StD.mat" file ...');
58     save('sav_StD.mat','vvA','tiA','ntA','rList','listV');
59     fprintf(' done\n')
60     end
61     elseif krd < 0,
62     fprintf('load from "sav_StD.mat" file ...');
63     load sav_StD
64     fprintf(' done\n'); nbV=size(listV,2);
65     end
66     if krd ~= 0,
67     ttA=squeeze(tiA(:,2,:));
68 jmc 1.4 ttA=ttA/3600; titT='hrs'; ttA=ttA/24; titT='days';
69     ttA=ttA/30 ; titT='month'; ttA=ttA/12 ; titT='year';
70 jmc 1.1 end
71     %=========================================================
72    
73     ttax1=0 ; ttax2=0 ; ttay=zeros(nbV,2);
74     %-- fixed time axis bound :
75 jmc 1.2 % ttax1=15.; ttax2=20.;
76 jmc 1.1 %-- fixed Y axis bound :
77     % ttay(4,:)=[0 0.6];
78     %-----------
79     fprintf('Total length: ntA=');fprintf(' %i ,',ntA); fprintf(' \n');
80     for n=1:Nexp,
81     fprintf(' exp %i : time(d):%10.2f ->%10.2f \n', n,ttA(1,n),ttA(ntA(n),n) );
82     end;
83     %--
84    
85     list_on=zeros(1,nbV);
86     nbG=8;
87     nbG=min(nbG,nbV); list_on(1:nbG)=1 ;
88     %list_on(1:6)=[1 1 1 1 1 1];
89    
90     isA=ones(1,Nexp); ieA=ntA;
91     %- limit the length : for search of isA <->1500y: find(ttA(:,2) == 1500)
92     %isA=isA*31 ; % drop the 1rst mnth (1 Monitor/d)
93 jmc 1.3 isA=isA*2 ; % drop the 1rst mnth (1 Monitor/30d)
94 jmc 1.1 %isA(1)=31 ; isA(2)=4 ; % drop the 1rst mnth
95 jmc 1.3 %ieA(:)=240; %isA(:)=1;
96 jmc 1.1
97     linA(1,:)='k-'; % ieA(1)=60 ; % ieA(1)=1152 ;
98     linA(2,:)='b-';
99     linA(3,:)='r-';
100     linA(4,:)='g-';
101     linA(5,:)='m-';
102     linA(6,:)='c-';
103    
104     ieA=min(ieA,nItMx);
105     %titall='AIM , Cubic-G (32x32) , cpl-FM Forcing' ;
106 jmc 1.3 titall='Global Ocean, Cubic-G (32x32) , CORE Forc (2)' ;
107 jmc 1.2 %titall='Dyncore test-case 5 (cs-32)' ;
108 jmc 1.1
109     %=========================================================
110    
111     for ng=1:nbV,
112     %-------------------
113     flag=list_on(ng); kl=0;
114     vv1=vvA(:,:,:,:,ng,:); namV=char(listV(ng));
115     titv=strrep(namV,'_','\_');
116     %if strcmp(namV,'Eta'), vv1=vv1/100; titv='Eta [mb]'; end
117 jmc 1.3 %if strcmp(namV,'T'), kl=1; end % <-- to get surf.Temp
118 jmc 1.1 %if ng == 1, flag=2*list_on(1) ; end
119     if kl > 0, titv=[titv,'\_',int2str(kl)];
120     fprintf([' var= ',namV,' at level k= %i \n'],kl);
121     end
122    
123     if flag == 1
124     %--
125     figure(ng); set(ng,'position',[100+100*ng 60+40*ng 500 700]);clf;
126 jmc 1.3 var=squeeze(vv1(1+kl,:,1,:,:)); dd=zeros(5,Nexp); av=zeros(5,Nexp);
127     for n=1:Nexp,
128     dd(:,n)=max(var(isA(n):ieA(n),:,n))-min(var(isA(n):ieA(n),:,n));
129     av(:,n)=mean(var(isA(n):ieA(n),:,n));
130     end
131 jmc 1.1 for nv=1:4,
132     subplot(410+nv); ttmn=' Mx-mn:'; ttav=' Av:';
133     for n=1:Nexp,
134     plot(ttA(isA(n):ieA(n),n),var(isA(n):ieA(n),nv,n),linA(n,:));
135     if n == 1, hold on ; end ;
136     ttmn=sprintf([ttmn,' %2.1e ;'],dd(nv,n));
137     ttav=sprintf([ttav,' %3.2e ;'],av(nv,n));
138     end ; hold off ;
139     AA=axis ; dAA=AA(4)-AA(3);
140     if AA(3)*AA(4) <= 0, AA(3)=min(AA(3),-dAA/10); AA(4)=max(AA(4),dAA/10); end
141 jmc 1.2 if ttax1 < ttax2, AA(1)=ttax1; AA(2)=ttax2; end;
142 jmc 1.1 axis(AA); grid ;
143     if nv == 1, title(['Avr ',titv,' ',ttmn]); end
144     if nv == 2, title(['Std-Dev ',titv,' ',ttav]); end
145 jmc 1.2 if nv == 3, title(['min ',titv,' ',ttav]); legend(namLg,0); end
146 jmc 1.1 if nv == 4, title(['Max ',titv,' ',ttav]); end
147     end ; xlabel(titT);
148     %--
149     axes('position',[.01,.01,.99,.99],'Visible','off');
150     T=text(0.5,0.97,titall);
151     set(T,'HorizontalAlignment','center','FontSize',12);
152     Td=text(0.99,0.01,date);
153     set(Td,'HorizontalAlignment','right','FontSize',6);
154     %---
155     end
156    
157     %-------------------
158     end
159    
160     %=========================================================

  ViewVC Help
Powered by ViewVC 1.1.22