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

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.22