/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_demo.m
ViewVC logotype

Diff of /MITgcm_contrib/gael/matlab_class/gcmfaces_demo.m

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

revision 1.6 by gforget, Thu Feb 12 21:29:30 2015 UTC revision 1.18 by gforget, Fri Nov 18 15:44:59 2016 UTC
# Line 1  Line 1 
1    function []=gcmfaces_demo();
2  choiceGrid='v4';  % GCMFACES_DEMO demonstrate capabilities of the gcmfaces toolbox.
3    %
4  %need to replace the missing v3 files...  %expected directory structure:
5    %
6    %  gcmfaces     (codes)
7    %  MITprof      (codes)
8    %  nctiles_grid (ECCO v4 grid)
9    %  release1     (ECCO v4 output)
10    %  sample_input (additional demo material)
11    %
12    %the ECCO v4 grid can be obtained as follows:
13    %
14    %  wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_grid
15    %  mv mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_grid .
16    %  rm -rf mit.ecco-group.org
17  %  %
18  %choose grid for test  %to activate example_transports:
19  % fprintf('\n Please set the demo grid : \n');  %
20  % fprintf('    ''llc'': lat-lon-cap grid (5 faces). \n');  %  mkdir release1
21  % fprintf('    ''ll'' : simple lat-lon grid (1 face). \n');  %  wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_climatology
22  % choiceGrid=input(' and type return. ''llc'' is the default.\n');  %  mv mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_climatology release1/.
23  % if isempty(choiceGrid); choiceGrid='llc'; end;  %  rm -rf mit.ecco-group.org
24  % if strcmp(choiceGrid,'llc'); choiceGrid='v4';  %
25  % elseif strcmp(choiceGrid,'ll'); choiceGrid='v3';  %to activate example_budget:
26  % else; error('wrong grid choice');  %
27  % end;  %  mkdir sample_input
28    %  wget --recursive ftp://mit.ecco-group.org/gforget/nctiles_budget_2d
29    %  mv mit.ecco-group.org/gforget/nctiles_budget_2d sample_input/.
30    %  rm -rf mit.ecco-group.org
31    %
32    % call sequence:
33    %  addpath gcmfaces;
34    %  addpath MITprof;
35    %  gcmfaces_demo;
36    
37  %choose verbise level  %choose verbose level
38  fprintf('\n Please set the amount of explanatory text display :\n');  fprintf('\n Please set the amount of explanatory text display :\n');
39  fprintf('    0: none.\n');  fprintf('    0: none.\n');
40  fprintf('    1: comments.\n');  fprintf('    1: comments.\n');
# Line 23  fprintf('    3: same as 2, but preceeded Line 43  fprintf('    3: same as 2, but preceeded
43  verbose=input(' and/or type return. 0 is the default. \n');  verbose=input(' and/or type return. 0 is the default. \n');
44  if isempty(verbose); verbose=0; end;  if isempty(verbose); verbose=0; end;
45    
46  %initialize environment variables and mygrid  fprintf('\n');
 addpath gcmfaces;  
 gcmfaces_global;  
 myenv.verbose=verbose;  
 if myenv.verbose>0;  
     gcmfaces_msg('* set path and environment variables (myenv) by calling gcmfaces_global');  
 end;  
47    
48  if ~isempty(which('MITprof_global'));  %so that gcmfaces_msg will work even before calling gcmfaces_global:
49  MITprof_global;  tmp1=which('gcmfaces_demo');
50    [PATH,NAME,EXT] = fileparts(tmp1);
51    addpath([PATH filesep 'gcmfaces_misc' filesep]);
52    global myenv;
53    myenv.issueWarnings=0;%skip warnings
54    myenv.verbose=verbose;%apply verbose level selected by user
55    %
56    fprintf('\n\n');
57    gcmfaces_msg('/////////////////////////////////////');
58    gcmfaces_msg('demo of gcmfaces_global and MITprof_global','// PART 0 :');
59    gcmfaces_msg('/////////////////////////////////////');
60    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
61    fprintf('\n\n');
62  if myenv.verbose>0;  if myenv.verbose>0;
63      gcmfaces_msg('* set MITprof path by calling MITprof_global');      gcmfaces_msg(['* gcmfaces_global: adds gcmfaces directories to path' ...
64                     ' and define environment variables (see myenv)']);
65  end;  end;
66    myenv=[];
67    gcmfaces_global;%this will display warning
68    myenv.issueWarnings=0;%skip warnings
69    myenv.verbose=verbose;%apply verbose level selected by user
70    if myenv.verbose>0;
71        gcmfaces_msg('* (this warning gets resolved below by calling grid_load)');
72  end;  end;
73    
74    %if ~isempty(which('MITprof_global'));
75    %    MITprof_global;
76    %    if myenv.verbose>0;
77    %        gcmfaces_msg('* MITprof_global: adds MITprof directories to path');
78    %    end;
79    %end;
80    
81  fprintf('\n\n');  fprintf('\n\n');
82  gcmfaces_msg('/////////////////////////////////////////');  gcmfaces_msg('/////////////////////////////////////');
83  gcmfaces_msg('demo of transport computations','// PART 1 :');  gcmfaces_msg('demo of grid_load','// PART 1 :');
84  gcmfaces_msg('please hit return','// >> ');  gcmfaces_msg('/////////////////////////////////////');
85  gcmfaces_msg('/////////////////////////////////////////');  if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
86  fprintf('\n\n');  fprintf('\n\n');
87  pause;  grid_load;
 diags=example_transports(choiceGrid);  
 if ~isempty(diags);  
     example_transports_disp(diags);  
 end;  
88    
89  fprintf('\n\n');  fprintf('\n\n');
90  gcmfaces_msg('/////////////////////////////////////');  gcmfaces_msg('/////////////////////////////////////');
91  gcmfaces_msg('demo of plotting routines','// PART 2 :');  gcmfaces_msg('demo of plotting routines','// PART 1 :');
 gcmfaces_msg('please hit return','// >> ');  
92  gcmfaces_msg('/////////////////////////////////////');  gcmfaces_msg('/////////////////////////////////////');
93    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
94  fprintf('\n\n');  fprintf('\n\n');
95  pause;  example_display;
 plot_one_field(choiceGrid,0);%%incl. call to m_map_gcmfaces;  
96    
97  fprintf('\n\n');  fprintf('\n\n');
98  gcmfaces_msg('///////////////////////////////////////////');  gcmfaces_msg('///////////////////////////////////////////');
99  gcmfaces_msg('demo of gridding v interpolating','// PART 3 :');  gcmfaces_msg('demo of interpolation and remapping ','// PART 2 :');
 gcmfaces_msg('please hit return','// >> ');  
100  gcmfaces_msg('///////////////////////////////////////////');  gcmfaces_msg('///////////////////////////////////////////');
101    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
102  fprintf('\n\n');  fprintf('\n\n');
103  pause;  example_interp;
104  example_bin_average(choiceGrid,1);%incl. call to example_smooth.m;  
105  example_griddata(choiceGrid);  fprintf('\n\n');
106  example_interp(choiceGrid);  gcmfaces_msg('///////////////////////////////////////////');
107  example_faces2latlon2faces(choiceGrid);  gcmfaces_msg('demo of bin averaging data sample to grid','// PART 2 :');
108    gcmfaces_msg('///////////////////////////////////////////');
109    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
110    fprintf('\n\n');
111    fld=example_bin_average;
112    
113    fprintf('\n\n');
114    gcmfaces_msg('///////////////////////////////////////////');
115    gcmfaces_msg('demo of smoothing through diffusion','// PART 2 :');
116    gcmfaces_msg('///////////////////////////////////////////');
117    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
118    fprintf('\n\n');
119    example_smooth(fld);
120    
121    fprintf('\n\n');
122    gcmfaces_msg('/////////////////////////////////////////');
123    gcmfaces_msg('demo of transport computations','// PART 3 :');
124    gcmfaces_msg('/////////////////////////////////////////');
125    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
126    fprintf('\n\n');
127    diags=example_transports;
128    
129    if ~isempty(diags);
130        fprintf('\n\n');
131        gcmfaces_msg('/////////////////////////////////////////');
132        gcmfaces_msg('demo of transport display','// PART 3 :');
133        gcmfaces_msg('/////////////////////////////////////////');
134        if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
135        fprintf('\n\n');
136        example_transports_disp(diags);
137    end;
138    
139  fprintf('\n\n');  fprintf('\n\n');
140  gcmfaces_msg('/////////////////////////////////////////');  gcmfaces_msg('/////////////////////////////////////////');
141  gcmfaces_msg('demo of budget computations','// PART 4 :');  gcmfaces_msg('demo of budget computations','// PART 4 :');
 gcmfaces_msg('please hit return','// >> ');  
142  gcmfaces_msg('/////////////////////////////////////////');  gcmfaces_msg('/////////////////////////////////////////');
143    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
144  fprintf('\n\n');  fprintf('\n\n');
145  pause;  example_budget;
 example_budget(choiceGrid);  
146    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.22