/[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.1 by gforget, Tue Jun 21 21:07:09 2011 UTC revision 1.18 by gforget, Fri Nov 18 15:44:59 2016 UTC
# Line 1  Line 1 
1    function []=gcmfaces_demo();
2  %environment variables:  % 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    %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    %to activate example_transports:
19    %
20    %  mkdir release1
21    %  wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_climatology
22    %  mv mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_climatology release1/.
23    %  rm -rf mit.ecco-group.org
24    %
25    %to activate example_budget:
26    %
27    %  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 verbose level
38    fprintf('\n Please set the amount of explanatory text display :\n');
39    fprintf('    0: none.\n');
40    fprintf('    1: comments.\n');
41    fprintf('    2: comments preceeded with calling sequence.\n');
42    fprintf('    3: same as 2, but preceeded with pause.\n');
43    verbose=input(' and/or type return. 0 is the default. \n');
44    if isempty(verbose); verbose=0; end;
45    
46    fprintf('\n');
47    
48    %so that gcmfaces_msg will work even before calling gcmfaces_global:
49    tmp1=which('gcmfaces_demo');
50    [PATH,NAME,EXT] = fileparts(tmp1);
51    addpath([PATH filesep 'gcmfaces_misc' filesep]);
52  global myenv;  global myenv;
53  myenv.gcmfaces_verbose=0;  myenv.issueWarnings=0;%skip warnings
54  myenv.gcmfaces_dir=[pwd '/gcmfaces/'];  myenv.verbose=verbose;%apply verbose level selected by user
55  myenv.MITprof_verbose=0;  %
56  myenv.MITprof_dir=[pwd '/gcmfaces/'];  fprintf('\n\n');
57  myenv.useNativeMatlabNetcdf = ~isempty(which('netcdf.open'));  gcmfaces_msg('/////////////////////////////////////');
58    gcmfaces_msg('demo of gcmfaces_global and MITprof_global','// PART 0 :');
59  %re-init mygrid:  gcmfaces_msg('/////////////////////////////////////');
60  global mygrid; mygrid=[];  if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
61    fprintf('\n\n');
62  choiceGrid='v4';  if myenv.verbose>0;
63        gcmfaces_msg(['* gcmfaces_global: adds gcmfaces directories to path' ...
64  %transform those to functions with v3/v4 arguments:                   ' and define environment variables (see myenv)']);
65  basic_diags_compute_v3_or_v4(choiceGrid);  end;
66  basic_diags_display_v3_or_v4(choiceGrid);  myenv=[];
67    gcmfaces_global;%this will display warning
68  example_bin_average(choiceGrid,1);%incl. call to example_smooth.m;  myenv.issueWarnings=0;%skip warnings
69  example_griddata(choiceGrid);  myenv.verbose=verbose;%apply verbose level selected by user
70  example_interp(choiceGrid);  if myenv.verbose>0;
71        gcmfaces_msg('* (this warning gets resolved below by calling grid_load)');
72  plot_one_field(choiceGrid,0);%%incl. call to m_map_gcmfaces;  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');
82    gcmfaces_msg('/////////////////////////////////////');
83    gcmfaces_msg('demo of grid_load','// PART 1 :');
84    gcmfaces_msg('/////////////////////////////////////');
85    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
86    fprintf('\n\n');
87    grid_load;
88    
89    fprintf('\n\n');
90    gcmfaces_msg('/////////////////////////////////////');
91    gcmfaces_msg('demo of plotting routines','// PART 1 :');
92    gcmfaces_msg('/////////////////////////////////////');
93    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
94    fprintf('\n\n');
95    example_display;
96    
97    fprintf('\n\n');
98    gcmfaces_msg('///////////////////////////////////////////');
99    gcmfaces_msg('demo of interpolation and remapping ','// PART 2 :');
100    gcmfaces_msg('///////////////////////////////////////////');
101    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
102    fprintf('\n\n');
103    example_interp;
104    
105    fprintf('\n\n');
106    gcmfaces_msg('///////////////////////////////////////////');
107    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');
140    gcmfaces_msg('/////////////////////////////////////////');
141    gcmfaces_msg('demo of budget computations','// PART 4 :');
142    gcmfaces_msg('/////////////////////////////////////////');
143    if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
144    fprintf('\n\n');
145    example_budget;
146    

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

  ViewVC Help
Powered by ViewVC 1.1.22