/[MITgcm]/MITgcm_contrib/gael/matlab_class/ecco_v4/cost_altimeter_disp.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/ecco_v4/cost_altimeter_disp.m

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


Revision 1.12 - (hide annotations) (download)
Sat Nov 7 16:01:41 2015 UTC (9 years, 8 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65r, checkpoint65q
Changes since 1.11: +26 -0 lines
- add another global mean plot.

1 gforget 1.5 function []=cost_altimeter_disp(dirMat,choicePlot,suf,dirTex,nameTex);
2     %object: plot the various sea level statistics
3 gforget 1.1 % (std model-obs, model, obs, leading to cost function terms)
4 gforget 1.4 %inputs: dirMat is the model run directory
5 gforget 1.5 % choicePlot is 1 (rms) 2 (prior uncertainty) or 3 (cost)
6     % suf is 'modMobs', 'obs' or 'mod'
7     %optional: dirTex is the directory where tex and figures files are created
8     % (if not specified then display all results to screen instead)
9     % nameTex is the tex file name (default : 'myPlots')
10 gforget 1.1
11 gforget 1.5 gcmfaces_global;
12    
13     %backward compatibility test
14     test1=~isempty(dir([dirMat 'basic_diags_ecco_mygrid.mat']));
15     test2=~isempty(dir([dirMat 'diags_grid_parms.mat']));
16     if ~test1&~test2;
17 gforget 1.8 error('missing diags_grid_parms.mat')
18 gforget 1.5 elseif test2;
19 gforget 1.8 nameGrid='diags_grid_parms.mat';
20 gforget 1.5 else;
21 gforget 1.8 nameGrid='basic_diags_ecco_mygrid.mat';
22 gforget 1.5 end;
23 gforget 1.1
24 gforget 1.4 %here we always reload the grid from dirMat to make sure the same one is used throughout
25 gforget 1.5 eval(['load ' dirMat nameGrid ';']);
26 gforget 1.1
27 gforget 1.4 %determine if and where to create tex and figures files
28     dirMat=[dirMat '/'];
29     if isempty(who('dirTex'));
30 gforget 1.8 addToTex=0;
31 gforget 1.4 else;
32 gforget 1.8 if ~ischar(dirTex); error('mis-specified dirTex'); end;
33     addToTex=1;
34     if isempty(who('nameTex')); nameTex='myPlots'; end;
35 gforget 1.11 fileTex=[dirTex filesep nameTex '.tex'];
36 gforget 1.4 end;
37 gforget 1.1
38     %%%%%%%%%%%%%%%
39     %define pathes:
40     %%%%%%%%%%%%%%%
41    
42 gforget 1.4 if isempty(dirMat); dirMat=[dirModel 'mat/']; else; dirMat=[dirMat '/']; end;
43 gforget 1.10 runName=pwd; tmp1=strfind(runName,filesep); runName=runName(tmp1(end)+1:end);
44 gforget 1.1
45     %%%%%%%%%%%%%%%%%
46     %do computations:
47     %%%%%%%%%%%%%%%%%
48    
49 gforget 1.8 if isdir([dirMat 'cost/']); dirMat=[dirMat 'cost/']; end;
50    
51 gforget 1.12 %global means
52     if choicePlot==0;
53     nmMat='diags_set_C';
54     test0=~isempty(dir([dirMat 'cost_altimeter_etaglo.mat']));
55     test0=test0&~isempty(dir([dirMat '../' nmMat filesep nmMat '_*.mat']));
56     if test0;
57     eval(['load ' dirMat 'cost_altimeter_etaglo.mat;']);
58     etaglo_offset=nanmedian(etaglo_aviso_mon-etaglo_mon);
59     alldiag=diags_read_from_mat([dirMat '../' nmMat filesep],[nmMat '_*.mat']);
60     alldiag=diags_read_from_mat([dirMat '../' nmMat filesep],[nmMat '_*.mat'],'SSHglo');
61     %
62     tt=alldiag.listTimes;
63     etaglo_mass_mon=alldiag.SSHglo;
64     figure; plot(tt,etaglo_mon+etaglo_offset,'k','LineWidth',1); hold on;
65     plot(tt,etaglo_mass_mon+etaglo_offset,'b','LineWidth',1);
66     plot(tt,etaglo_mon-etaglo_mass_mon,'r','LineWidth',1);
67     plot(tt,etaglo_aviso_mon,'m','LineWidth',1);
68     legend('sea level','mass term','steric term','aviso','Location','NorthWest');
69     myCaption={'global sea level (m)'};
70     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
71     end;
72     %skip the rest
73     return;
74     end;
75    
76     %load results:
77 gforget 1.4 eval(['load ' dirMat 'cost_altimeter_' suf '.mat myflds;']);
78 gforget 1.1
79 gforget 1.8 %mask for plotting
80     if isfield(myflds,'msk_100pts');
81     MSK=myflds.msk_100pts;
82     else;
83     MSK=mygrid.mskC(:,:,1);
84     end;
85     %hack to omit any masking : MSK(:)=1;
86    
87 gforget 1.1 if strcmp(suf,'modMobs'); tit='modeled-observed';
88     elseif strcmp(suf,'obs'); tit='observed';
89     elseif strcmp(suf,'mod'); tit='modeled';
90     else; error('unknown field');
91     end
92    
93 gforget 1.9 if choicePlot==1; tit=[tit ' log(variance)']; uni='(m$^2$)';
94     elseif choicePlot==2; tit=' log(prior error variance)'; uni='(m$^2$)';
95 gforget 1.8 else; tit=[tit ' cost']; uni='';
96 gforget 1.1 end;
97    
98     if choicePlot==1;%rms
99 gforget 1.8
100     if strcmp(suf,'modMobs');
101     cc=[-0.4:0.05:-0.25 -0.2:0.03:-0.05 -0.03:0.01:0.03 0.05:0.03:0.2 0.25:0.05:0.4];
102     figure; m_map_gcmfaces(100*MSK.*myflds.dif_mdt,0,{'myCaxis',100*cc}); drawnow;
103 gforget 1.9 myCaption={'mean dynamic topography misfit (cm)'};
104 gforget 1.8 if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
105     end;
106    
107     cc=[-4:0.2:-1]-0.5;
108     figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_smooth.^2)),0,{'myCaxis',cc}); drawnow;
109     myCaption={tit,'-- sea level anomaly ',uni,' -- large space/time scales'};
110     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
111    
112     cc=[-4:0.2:-1];
113     figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_point.^2)),0,{'myCaxis',cc}); drawnow;
114     myCaption={tit,'-- sea level anomaly ',uni,' -- pointwise'};
115     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
116    
117     if 0;
118     figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_point35d.^2)),0,{'myCaxis',cc}); drawnow;
119     myCaption={tit,'-- sea level anomaly ',uni,' -- large time scales'};
120     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
121    
122     figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_35dMsmooth.^2)),0,{'myCaxis',cc}); drawnow;
123     myCaption={tit,'-- sea level anomaly ',uni,' -- point35d minus lsc'};
124     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
125    
126     figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_pointMpoint35d.^2)),0,{'myCaxis',cc}); drawnow;
127     myCaption={tit,'-- sea level anomaly ',uni,' -- point minus point35d'};
128     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
129     end;
130    
131 gforget 1.1 elseif choicePlot==2;%uncertainty fields
132 gforget 1.8
133     cc=[0:0.005:0.02 0.03:0.01:0.05 0.06:0.02:0.1 0.14:0.03:0.2 0.25:0.05:0.4];
134     figure; m_map_gcmfaces(100*myflds.sig_mdt,0,{'myCaxis',100*cc}); drawnow;
135 gforget 1.9 myCaption={'mean dynamic topography prior uncertainty (cm)'};
136 gforget 1.8 if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
137    
138     cc=[-4:0.2:-1]-0.5;
139     figure; m_map_gcmfaces(log10(MSK.*(myflds.sig_sladiff_smooth.^2)),0,{'myCaxis',cc}); drawnow;
140     myCaption={tit,'-- sea level anomaly ',uni,' -- large space/time scales'};
141     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
142    
143     cc=[-4:0.2:-1];
144     figure; m_map_gcmfaces(log10(MSK.*(myflds.sig_sladiff_point.^2)),0,{'myCaxis',cc}); drawnow;
145     myCaption={tit,'-- sea level anomaly ',uni,' -- pointwise'};
146     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
147    
148 gforget 1.1 else;%cost
149 gforget 1.8
150     cc=[0:0.005:0.02 0.03:0.01:0.05 0.06:0.02:0.1 0.14:0.03:0.2 0.25:0.05:0.4]*100;
151    
152     figure; m_map_gcmfaces(MSK.*((myflds.dif_mdt.^2)./(myflds.sig_mdt.^2)),0,{'myCaxis',cc}); drawnow;
153     myCaption={tit,'-- mean dynamic topography ',uni};
154     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
155    
156     figure; m_map_gcmfaces(MSK.*((myflds.rms_sladiff_smooth.^2)./(myflds.sig_sladiff_smooth.^2)),0,{'myCaxis',cc}); drawnow;
157     myCaption={tit,'-- sea level anomaly ',uni,' -- large space/time scales'};
158     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
159    
160     figure; m_map_gcmfaces(MSK.*((myflds.rms_sladiff_point.^2)./(myflds.sig_sladiff_point.^2)),0,{'myCaxis',cc}); drawnow;
161     myCaption={tit,'-- sea level anomaly ',uni,' -- pointwise'};
162     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
163    
164 gforget 1.1 end;
165    
166    
167    
168    
169    

  ViewVC Help
Powered by ViewVC 1.1.22