/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_diags/diags_driver.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/gcmfaces_diags/diags_driver.m

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


Revision 1.10 - (hide annotations) (download)
Tue Dec 2 17:59:43 2014 UTC (10 years, 7 months ago) by gforget
Branch: MAIN
Changes since 1.9: +29 -28 lines
- improve handling of records, diags_grid_parms.mat.
- clean-up and tabs.

1 gforget 1.6 function []=diags_driver(dirModel,dirMat,years,setDiags,doInteractive);
2 gforget 1.1 %object: compute the various cost and physics
3     % diagnosits from model output
4 gforget 1.6 %input: dirModel is the directory containing 'diags/' or 'nctiles/'
5     % dirMat is the directory where diagnostics results will be saved
6     % if isempty(dirMat) then [dirModel 'mat/'] is used by default
7     % years (vector) that states years (or sets of 12 records) to compute
8     % if years=[1:4] then the first 4 years are computed
9     %(optional) setDiags further specifies physical diags to be computed
10     % if setDiags='A' then one set of diags ('A') is computed
11     % By default three sets of diags ('A','B','C') are computed.
12     %(optional) doInteractive=1 allows users to specify parameters interactively
13     % doInteractive = 0 (default) uses ECCO v4 parameters
14     % and omits budgets and model-data misfits analyses
15 gforget 1.10 %
16 gforget 1.6 %notes : eventually should also use dirMat, dirTex interactively for years=[];
17 gforget 1.1
18     gcmfaces_global; global myparms;
19    
20     %%%%%%%%%%%%%%%
21     %pre-processing
22     %%%%%%%%%%%%%%%
23    
24 gforget 1.6 if isempty(who('doInteractive')); doInteractive=0; end;
25     myswitch=diags_pre_process(dirModel,dirMat,doInteractive);
26 gforget 1.1
27 gforget 1.9 dirModel=[dirModel '/'];
28     if isempty(dirMat); dirMat=[dirModel 'mat/']; else; dirMat=[dirMat '/']; end;
29    
30 gforget 1.10 %%%%%%%%%%%%%%%%%%%%
31     %set loop parameters
32     %%%%%%%%%%%%%%%%%%%%
33    
34     years=years-myparms.yearFirst+1;
35     if myparms.diagsAreMonthly;
36     years=years(years<=myparms.recInAve(2)/12);
37     lChunk=12;
38     end;
39     if myparms.diagsAreAnnual;
40     years=years(years<=myparms.recInAve(2));
41     lChunk=1;
42 gforget 1.7 end;
43    
44 gforget 1.1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45     %now do the selected computation chunk:
46     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47    
48     if ~isempty(who('setDiags'));
49 gforget 1.10
50 gforget 1.1 %physical diagnostics
51 gforget 1.6 for myYear=years;
52     diags_select(dirModel,dirMat,setDiags,lChunk,myYear);
53 gforget 1.1 end;
54    
55 gforget 1.10 %need profiles, cost, ctrl, budget, 'B' to work in this way too
56    
57 gforget 1.6 else;
58 gforget 1.1
59 gforget 1.6 for myYear=years;
60 gforget 1.10
61 gforget 1.6 %standard physical diagnostics :
62 gforget 1.10 % diags_select(dirModel,dirMat,'A',lchunk,myYear);
63     if myYear==years(1);
64     recInAve=[myparms.recInAve(1):myparms.recInAve(2)];
65     diags_select(dirModel,dirMat,'B',1,recInAve);
66 gforget 1.7 end;
67 gforget 1.10 % diags_select(dirModel,dirMat,'C',lchunk,myYear);
68    
69     %budgets :
70 gforget 1.1 if myswitch.doBudget;
71 gforget 1.10 for kk=myparms.budgetList;
72     diags_select(dirModel,dirMat,{'D',kk},lchunk,myYear);
73 gforget 1.1 end;
74     end;
75 gforget 1.10
76     %model-data misfits :
77 gforget 1.6 % in situ profiles fit
78 gforget 1.9 if myswitch.doProfiles&myYear==years(1); insitu_diags(dirMat,1); end;
79 gforget 1.6 % altimeter fit
80 gforget 1.9 if myswitch.doCost&myYear==years(1); cost_altimeter(dirModel,dirMat); end;
81 gforget 1.6 % other cost terms
82 gforget 1.9 if myswitch.doCost&myYear==years(1); cost_sst(dirModel,dirMat,1); end;
83     if myswitch.doCost&myYear==years(1); cost_bp(dirModel,dirMat,1); end;
84     if myswitch.doCost&myYear==years(1); cost_seaicearea(dirModel,dirMat,1); end;
85 gforget 1.6 % controls
86 gforget 1.9 if myswitch.doCtrl&myYear==years(1); cost_xx(dirModel,dirMat,1); end;
87 gforget 1.10
88 gforget 1.1 end;
89    
90     end;
91    

  ViewVC Help
Powered by ViewVC 1.1.22