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 |
|
|
fileTex=[dirTex 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.4 |
eval(['load ' dirMat 'cost_altimeter_' suf '.mat myflds;']); |
52 |
gforget |
1.1 |
|
53 |
gforget |
1.8 |
%mask for plotting |
54 |
|
|
if isfield(myflds,'msk_100pts'); |
55 |
|
|
MSK=myflds.msk_100pts; |
56 |
|
|
else; |
57 |
|
|
MSK=mygrid.mskC(:,:,1); |
58 |
|
|
end; |
59 |
|
|
%hack to omit any masking : MSK(:)=1; |
60 |
|
|
|
61 |
gforget |
1.1 |
if strcmp(suf,'modMobs'); tit='modeled-observed'; |
62 |
|
|
elseif strcmp(suf,'obs'); tit='observed'; |
63 |
|
|
elseif strcmp(suf,'mod'); tit='modeled'; |
64 |
|
|
else; error('unknown field'); |
65 |
|
|
end |
66 |
|
|
|
67 |
gforget |
1.9 |
if choicePlot==1; tit=[tit ' log(variance)']; uni='(m$^2$)'; |
68 |
|
|
elseif choicePlot==2; tit=' log(prior error variance)'; uni='(m$^2$)'; |
69 |
gforget |
1.8 |
else; tit=[tit ' cost']; uni=''; |
70 |
gforget |
1.1 |
end; |
71 |
|
|
|
72 |
|
|
if choicePlot==1;%rms |
73 |
gforget |
1.8 |
|
74 |
|
|
if strcmp(suf,'modMobs'); |
75 |
|
|
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]; |
76 |
|
|
figure; m_map_gcmfaces(100*MSK.*myflds.dif_mdt,0,{'myCaxis',100*cc}); drawnow; |
77 |
gforget |
1.9 |
myCaption={'mean dynamic topography misfit (cm)'}; |
78 |
gforget |
1.8 |
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
79 |
|
|
end; |
80 |
|
|
|
81 |
|
|
cc=[-4:0.2:-1]-0.5; |
82 |
|
|
figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_smooth.^2)),0,{'myCaxis',cc}); drawnow; |
83 |
|
|
myCaption={tit,'-- sea level anomaly ',uni,' -- large space/time scales'}; |
84 |
|
|
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
85 |
|
|
|
86 |
|
|
cc=[-4:0.2:-1]; |
87 |
|
|
figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_point.^2)),0,{'myCaxis',cc}); drawnow; |
88 |
|
|
myCaption={tit,'-- sea level anomaly ',uni,' -- pointwise'}; |
89 |
|
|
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
90 |
|
|
|
91 |
|
|
if 0; |
92 |
|
|
figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_point35d.^2)),0,{'myCaxis',cc}); drawnow; |
93 |
|
|
myCaption={tit,'-- sea level anomaly ',uni,' -- large time scales'}; |
94 |
|
|
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
95 |
|
|
|
96 |
|
|
figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_35dMsmooth.^2)),0,{'myCaxis',cc}); drawnow; |
97 |
|
|
myCaption={tit,'-- sea level anomaly ',uni,' -- point35d minus lsc'}; |
98 |
|
|
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
99 |
|
|
|
100 |
|
|
figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_pointMpoint35d.^2)),0,{'myCaxis',cc}); drawnow; |
101 |
|
|
myCaption={tit,'-- sea level anomaly ',uni,' -- point minus point35d'}; |
102 |
|
|
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
103 |
|
|
end; |
104 |
|
|
|
105 |
gforget |
1.1 |
elseif choicePlot==2;%uncertainty fields |
106 |
gforget |
1.8 |
|
107 |
|
|
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]; |
108 |
|
|
figure; m_map_gcmfaces(100*myflds.sig_mdt,0,{'myCaxis',100*cc}); drawnow; |
109 |
gforget |
1.9 |
myCaption={'mean dynamic topography prior uncertainty (cm)'}; |
110 |
gforget |
1.8 |
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
111 |
|
|
|
112 |
|
|
cc=[-4:0.2:-1]-0.5; |
113 |
|
|
figure; m_map_gcmfaces(log10(MSK.*(myflds.sig_sladiff_smooth.^2)),0,{'myCaxis',cc}); drawnow; |
114 |
|
|
myCaption={tit,'-- sea level anomaly ',uni,' -- large space/time scales'}; |
115 |
|
|
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
116 |
|
|
|
117 |
|
|
cc=[-4:0.2:-1]; |
118 |
|
|
figure; m_map_gcmfaces(log10(MSK.*(myflds.sig_sladiff_point.^2)),0,{'myCaxis',cc}); drawnow; |
119 |
|
|
myCaption={tit,'-- sea level anomaly ',uni,' -- pointwise'}; |
120 |
|
|
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
121 |
|
|
|
122 |
gforget |
1.1 |
else;%cost |
123 |
gforget |
1.8 |
|
124 |
|
|
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; |
125 |
|
|
|
126 |
|
|
figure; m_map_gcmfaces(MSK.*((myflds.dif_mdt.^2)./(myflds.sig_mdt.^2)),0,{'myCaxis',cc}); drawnow; |
127 |
|
|
myCaption={tit,'-- mean dynamic topography ',uni}; |
128 |
|
|
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
129 |
|
|
|
130 |
|
|
figure; m_map_gcmfaces(MSK.*((myflds.rms_sladiff_smooth.^2)./(myflds.sig_sladiff_smooth.^2)),0,{'myCaxis',cc}); drawnow; |
131 |
|
|
myCaption={tit,'-- sea level anomaly ',uni,' -- large space/time scales'}; |
132 |
|
|
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
133 |
|
|
|
134 |
|
|
figure; m_map_gcmfaces(MSK.*((myflds.rms_sladiff_point.^2)./(myflds.sig_sladiff_point.^2)),0,{'myCaxis',cc}); drawnow; |
135 |
|
|
myCaption={tit,'-- sea level anomaly ',uni,' -- pointwise'}; |
136 |
|
|
if addToTex; write2tex(fileTex,2,myCaption,gcf); end; |
137 |
|
|
|
138 |
gforget |
1.1 |
end; |
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
|