/[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.8 - (hide annotations) (download)
Sun Jan 19 14:56:55 2014 UTC (11 years, 6 months ago) by gforget
Branch: MAIN
Changes since 1.7: +84 -72 lines
- cost_altimeter.m :
  update error fields (slaerr_largescale_r4.err, slaerr_gridscale_r4.err)
  allow for 'mat/cost/' subdirectory
  omit 1992, and synchronize point and smooth (ttShift=17)
  define msk_point (time variable) and msk_100pts (time mean)
  sladiff_smooth etc are subsample according to msk_point
  all displays are applied msk_100pts
- cost_bp.m, cost_sst.m, cost_xx.m, cost_seaicearea.m :
  allow for 'mat/cost/' subdirectory

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.1 runName=pwd; tmp1=strfind(runName,'/'); runName=runName(tmp1(end)+1:end);
44    
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.2 if choicePlot==1; tit=[tit ' rms']; uni='(cm)';
68     elseif choicePlot==2; tit='prior uncertainty'; uni='(cm)';
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     tmp1=strfind(tit,'rms');
78     if ~isempty(tmp1); tit2=[tit(1:tmp1-1) 'difference' tit(tmp1+3:end)]; else; tit2=tit; end;
79     myCaption={tit2,'-- mean dynamic topography ',uni};
80     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
81     end;
82    
83     cc=[-4:0.2:-1]-0.5;
84     figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_smooth.^2)),0,{'myCaxis',cc}); drawnow;
85     myCaption={tit,'-- sea level anomaly ',uni,' -- large space/time scales'};
86     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
87    
88     cc=[-4:0.2:-1];
89     figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_point.^2)),0,{'myCaxis',cc}); drawnow;
90     myCaption={tit,'-- sea level anomaly ',uni,' -- pointwise'};
91     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
92    
93     if 0;
94     figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_point35d.^2)),0,{'myCaxis',cc}); drawnow;
95     myCaption={tit,'-- sea level anomaly ',uni,' -- large time scales'};
96     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
97    
98     figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_35dMsmooth.^2)),0,{'myCaxis',cc}); drawnow;
99     myCaption={tit,'-- sea level anomaly ',uni,' -- point35d minus lsc'};
100     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
101    
102     figure; m_map_gcmfaces(log10(MSK.*(myflds.rms_sladiff_pointMpoint35d.^2)),0,{'myCaxis',cc}); drawnow;
103     myCaption={tit,'-- sea level anomaly ',uni,' -- point minus point35d'};
104     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
105     end;
106    
107 gforget 1.1 elseif choicePlot==2;%uncertainty fields
108 gforget 1.8
109     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];
110     figure; m_map_gcmfaces(100*myflds.sig_mdt,0,{'myCaxis',100*cc}); drawnow;
111     myCaption={tit,'-- mean dynamic topography ',uni};
112     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
113    
114     cc=[-4:0.2:-1]-0.5;
115     figure; m_map_gcmfaces(log10(MSK.*(myflds.sig_sladiff_smooth.^2)),0,{'myCaxis',cc}); drawnow;
116     myCaption={tit,'-- sea level anomaly ',uni,' -- large space/time scales'};
117     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
118    
119     cc=[-4:0.2:-1];
120     figure; m_map_gcmfaces(log10(MSK.*(myflds.sig_sladiff_point.^2)),0,{'myCaxis',cc}); drawnow;
121     myCaption={tit,'-- sea level anomaly ',uni,' -- pointwise'};
122     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
123    
124 gforget 1.1 else;%cost
125 gforget 1.8
126     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;
127    
128     figure; m_map_gcmfaces(MSK.*((myflds.dif_mdt.^2)./(myflds.sig_mdt.^2)),0,{'myCaxis',cc}); drawnow;
129     myCaption={tit,'-- mean dynamic topography ',uni};
130     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
131    
132     figure; m_map_gcmfaces(MSK.*((myflds.rms_sladiff_smooth.^2)./(myflds.sig_sladiff_smooth.^2)),0,{'myCaxis',cc}); drawnow;
133     myCaption={tit,'-- sea level anomaly ',uni,' -- large space/time scales'};
134     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
135    
136     figure; m_map_gcmfaces(MSK.*((myflds.rms_sladiff_point.^2)./(myflds.sig_sladiff_point.^2)),0,{'myCaxis',cc}); drawnow;
137     myCaption={tit,'-- sea level anomaly ',uni,' -- pointwise'};
138     if addToTex; write2tex(fileTex,2,myCaption,gcf); end;
139    
140 gforget 1.1 end;
141    
142    
143    
144    
145    

  ViewVC Help
Powered by ViewVC 1.1.22