1 |
|
function []=gcmfaces_demo(); |
2 |
%call sequence: |
% GCMFACES_DEMO demonstrate capabilities of the gcmfaces toolbox. |
|
% |
|
|
% addpath gcmfaces; gcmfaces_demo; |
|
3 |
% |
% |
4 |
%expected directory structure: |
%expected directory structure: |
5 |
% |
% |
7 |
% MITprof (codes) |
% MITprof (codes) |
8 |
% nctiles_grid (ECCO v4 grid) |
% nctiles_grid (ECCO v4 grid) |
9 |
% release1 (ECCO v4 output) |
% release1 (ECCO v4 output) |
10 |
% sample_input (test material) |
% sample_input (additional demo material) |
11 |
% |
% |
12 |
%to activate example_remap: |
%the ECCO v4 grid can be obtained as follows: |
13 |
% |
% |
14 |
% mkdir sample_input |
% wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_grid |
15 |
% wget ftp://mit.ecco-group.org/gforget/testcase_remap.mat |
% mv mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_grid . |
16 |
% mv testcase_remap.mat sample_input/. |
% rm -rf mit.ecco-group.org |
17 |
% |
% |
18 |
%to activate example_transports: |
%to activate example_transports: |
19 |
% |
% |
20 |
% mkdir release1 |
% mkdir release1 |
21 |
% wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_climatology |
% wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_climatology |
22 |
% mv mit.ecco-group.org/gforget/nctiles_climatology release1/. |
% mv mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_climatology release1/. |
23 |
% rm -rf mit.ecco-group.org |
% rm -rf mit.ecco-group.org |
24 |
% |
% |
25 |
%to activate example_budget: |
%to activate example_budget: |
26 |
% |
% |
27 |
|
% mkdir sample_input |
28 |
% wget --recursive ftp://mit.ecco-group.org/gforget/nctiles_budget_2d |
% wget --recursive ftp://mit.ecco-group.org/gforget/nctiles_budget_2d |
29 |
% mv mit.ecco-group.org/gforget/nctiles_budget_2d sample_input/. |
% mv mit.ecco-group.org/gforget/nctiles_budget_2d sample_input/. |
30 |
% rm -rf mit.ecco-group.org |
% rm -rf mit.ecco-group.org |
31 |
% |
% |
32 |
|
% call sequence: |
33 |
|
% addpath gcmfaces; |
34 |
|
% addpath MITprof; |
35 |
|
% gcmfaces_demo; |
36 |
|
|
37 |
%choose verbose 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'); |
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'); |
47 |
addpath gcmfaces; |
|
48 |
gcmfaces_global; |
%so that gcmfaces_msg will work even before calling gcmfaces_global: |
49 |
myenv.issueWarnings=0; |
tmp1=which('gcmfaces_demo'); |
50 |
myenv.verbose=verbose; |
[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 path and environment variables (myenv) by calling gcmfaces_global'); |
gcmfaces_msg(['* gcmfaces_global: adds gcmfaces directories to path' ... |
64 |
|
' and define environment variables (see myenv)']); |
65 |
end; |
end; |
66 |
|
myenv=[]; |
67 |
addpath MITprof; |
gcmfaces_global;%this will display warning |
68 |
if ~isempty(which('MITprof_global')); |
myenv.issueWarnings=0;%skip warnings |
69 |
MITprof_global; |
myenv.verbose=verbose;%apply verbose level selected by user |
70 |
if myenv.verbose>0; |
if myenv.verbose>0; |
71 |
gcmfaces_msg('* set MITprof path by calling MITprof_global'); |
gcmfaces_msg('* (this warning gets resolved below by calling grid_load)'); |
|
end; |
|
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'); |
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'); |
fprintf('\n\n'); |
90 |
gcmfaces_msg('/////////////////////////////////////'); |
gcmfaces_msg('/////////////////////////////////////'); |
91 |
gcmfaces_msg('demo of plotting routines','// PART 1 :'); |
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; |
|
96 |
|
|
97 |
fprintf('\n\n'); |
fprintf('\n\n'); |
98 |
gcmfaces_msg('///////////////////////////////////////////'); |
gcmfaces_msg('///////////////////////////////////////////'); |
99 |
gcmfaces_msg('demo of remapping and smoothing','// PART 2 :'); |
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 |
|
|
105 |
if 1;%one method to map lon-lat fields to gcmfaces |
fprintf('\n\n'); |
106 |
example_remap(1); |
gcmfaces_msg('///////////////////////////////////////////'); |
107 |
else;%alternatives |
gcmfaces_msg('demo of bin averaging data sample to grid','// PART 2 :'); |
108 |
example_griddata; |
gcmfaces_msg('///////////////////////////////////////////'); |
109 |
example_interp; |
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
110 |
example_faces2latlon2faces; |
fprintf('\n\n'); |
111 |
end; |
fld=example_bin_average; |
112 |
example_bin_average(1);%incl. call to example_smooth.m; |
|
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'); |
fprintf('\n\n'); |
122 |
gcmfaces_msg('/////////////////////////////////////////'); |
gcmfaces_msg('/////////////////////////////////////////'); |
123 |
gcmfaces_msg('demo of transport computations','// PART 3 :'); |
gcmfaces_msg('demo of transport computations','// PART 3 :'); |
|
gcmfaces_msg('please hit return','// >> '); |
|
124 |
gcmfaces_msg('/////////////////////////////////////////'); |
gcmfaces_msg('/////////////////////////////////////////'); |
125 |
|
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
126 |
fprintf('\n\n'); |
fprintf('\n\n'); |
|
pause; |
|
127 |
diags=example_transports; |
diags=example_transports; |
128 |
|
|
129 |
if ~isempty(diags); |
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); |
example_transports_disp(diags); |
137 |
end; |
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'); |
|
pause; |
|
145 |
example_budget; |
example_budget; |
146 |
|
|