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

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

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


Revision 1.1 - (hide annotations) (download)
Fri Jul 8 13:18:04 2011 UTC (14 years ago) by gforget
Branch: MAIN
- added: cost_xx.m that compute/plot the mean and variance of controls.
- cost_bp.m, cost_sst.m, cost_altimeter_disp.m : revised captions for wrote2tex.
- plot_driver.m : add title, sections, cost_xx. split basic_diags_ecco_disp.
- cost_altimeter.m : mask out data poleward of 66. resolve divide by zero
  warnings by applying masks, and switching off the warning.
- basic_diags_ecco.m : split in three using new setDiags paramater; speed-up I/O
  by using rdmds2workspace_list.m; fix heat and salt transport computations (missing
  factors); include time averaging for setDiags='B'; save mygrid to basic_diags_ecco_mygrid.mat
- basic_diags_ecco_disp.m : split in three using new setDiags paramater; load mygrid
  from basic_diags_ecco_mygrid.mat; improve captions for write2tex; set time averaging
  period to 92-07; include computation of zonal mean climatology for setDiags='C';
  use depthStretchPlot for section; add air-sea fluxes and ice plots; fix transports
  time series plots;

1 gforget 1.1 function []=cost_xx(dirModel,doComp,varargin);
2     %object: compute cost function term for atmospheric controls
3     %inputs: dirModel is the model directory
4     % doComp is a switch (1->compute; 0->display)
5     %optional: addToTex
6    
7     if nargin>2; addToTex=varargin{1}; else; addToTex=0; end;
8    
9     for ii=1:6;
10     switch ii;
11     case 1; xxName='atemp'; sigName='cap_sigma_tmp2m_degC_eccollc.bin'; cc=2; uni='K';
12     case 2; xxName='aqh'; sigName='cap_sigma_spfh2m_eccollc.bin'; cc=2; uni='g/kg';
13     case 3; xxName='tauu'; sigName='cap_sigma_ustr_eccollc.bin'; cc=0.04; uni='N/m2';
14     case 4; xxName='tauv'; sigName='cap_sigma_vstr_eccollc.bin'; cc=0.04; uni='N/m2';
15     case 5; xxName='lwdown'; sigName='cap_sigma_dlw_eccollc.bin'; cc=20; uni='W/m2';
16     case 6; xxName='swdown'; sigName='cap_sigma_dsw_eccollc.bin'; cc=40; uni='W/m2';
17     end;
18    
19     if doComp;
20    
21     %load grid
22     dirGrid='GRID/';
23     global mygrid;
24     gcmfaces_path; grid_load(dirGrid,5,'compact');
25     dirSig='/net/weddell/raid3/gforget/ecco_v4/xx_forcing/uncertainties/';
26    
27     %read model cost output
28     fld_xx=rdmds2gcmfaces([dirModel 'ADXXfiles/xx_' xxName '.effective.*']);
29     fld_sig=v4_read_bin([dirSig sigName],1,0);
30    
31     if strcmp(xxName,'aqh'); fld_xx=fld_xx*1000; fld_sig=fld_sig*1000; end;
32    
33     %compute xx stats
34     fld_rms=sqrt(mean(fld_xx.^2,3));
35     fld_mean=mean(fld_xx,3);
36     fld_std=std(fld_xx,[],3);
37    
38     %mask
39     fld_rms=fld_rms.*mygrid.mskC(:,:,1);
40     fld_sig=fld_sig.*mygrid.mskC(:,:,1);
41     fld_mean=fld_mean.*mygrid.mskC(:,:,1);
42     fld_std=fld_std.*mygrid.mskC(:,:,1);
43    
44     clear fld_xx;
45    
46     eval(['save ' dirModel '/mat/cost_xx_' xxName '.mat fld_* cc uni;']);
47    
48     else;%display previously computed results
49    
50     global mygrid;
51    
52     eval(['load ' dirModel '/mat/cost_xx_' xxName '.mat;']);
53    
54     figure;
55     m_map_gcmfaces(fld_sig,0,{'myCaxis',[0:0.05:0.5 0.6:0.1:1 1.25]*cc});
56     myCaption={['prior uncertainty -- ' xxName ' (' uni ')']};
57     if addToTex; write2tex([dirModel 'tex/myPlots.tex'],2,myCaption,gcf); end;
58    
59     figure;
60     m_map_gcmfaces(fld_rms,0,{'myCaxis',[0:0.05:0.5 0.6:0.1:1 1.25]*cc});
61     myCaption={['rms adjustment -- ' xxName ' (' uni ')']};
62     if addToTex; write2tex([dirModel 'tex/myPlots.tex'],2,myCaption,gcf); end;
63    
64     figure;
65     m_map_gcmfaces(fld_std,0,{'myCaxis',[0:0.05:0.5 0.6:0.1:1 1.25]*cc});
66     myCaption={['std adjustment -- ' xxName ' (' uni ')']};
67     if addToTex; write2tex([dirModel 'tex/myPlots.tex'],2,myCaption,gcf); end;
68    
69     figure;
70     m_map_gcmfaces(fld_mean,0,{'myCaxis',[-0.5:0.05:0.5]*cc});
71     myCaption={['mean adjustment -- ' xxName ' (' uni ')']};
72     if addToTex; write2tex([dirModel 'tex/myPlots.tex'],2,myCaption,gcf); end;
73    
74     end;
75    
76     end;%for ii=1:6;
77    

  ViewVC Help
Powered by ViewVC 1.1.22