1 |
|
function []=gcmfaces_demo(); |
2 |
%to load the ECCO v4 / LLC90 grid: |
% GCMFACES_DEMO demonstrate capabilities of the gcmfaces toolbox. |
3 |
|
% |
4 |
|
%expected directory structure: |
5 |
% |
% |
6 |
%nF=5; |
% gcmfaces (codes) |
7 |
%fileFormat='compact'; |
% MITprof (codes) |
8 |
%dirGrid=fullfile([myenv.gcmfaces_dir '../']); |
% nctiles_grid (ECCO v4 grid) |
9 |
%dirGrid=fullfile(dirGrid,'GRID/'); |
% release1 (ECCO v4 output) |
10 |
% |
% sample_input (additional demo material) |
11 |
%to instead load e.g. your MITgcm lat-lon grid, |
% |
12 |
%you would edit the example routines to look like: |
%the ECCO v4 grid can be obtained as follows: |
13 |
% |
% |
14 |
% nF=1; |
% wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_grid |
15 |
% fileFormat='straight'; |
% mv mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_grid . |
16 |
% dirGrid='./'; |
% 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_MITprof: |
26 |
|
% |
27 |
|
% mkdir release2_climatology |
28 |
|
% wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release2/nctiles_climatology |
29 |
|
% mv mit.ecco-group.org/ecco_for_las/version_4/release1/nctiles_climatology release2_climatology/. |
30 |
|
% wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release2/profiles |
31 |
|
% mv mit.ecco-group.org/ecco_for_las/version_4/release1/profiles release2_climatology/. |
32 |
|
% rm -rf mit.ecco-group.org |
33 |
% |
% |
34 |
%to activate example_budget: |
%to activate example_budget: |
35 |
% |
% |
36 |
%wget --recursive ftp://mit.ecco-group.org/gforget/nctiles_budget |
% mkdir sample_input |
37 |
%mv mit.ecco-group.org/gforget/nctiles_budget gcmfaces/sample_input/. |
% wget --recursive ftp://mit.ecco-group.org/gforget/nctiles_budget_2d |
38 |
%rm -rf mit.ecco-group.org |
% mv mit.ecco-group.org/gforget/nctiles_budget_2d sample_input/. |
39 |
% |
% rm -rf mit.ecco-group.org |
40 |
%to activate example_remap: |
% |
41 |
% |
% call sequence: |
42 |
%wget ftp://mit.ecco-group.org/gforget/testcase_remap.mat |
% addpath gcmfaces; |
43 |
%mv testcase_remap.mat gcmfaces/sample_input/. |
% addpath MITprof; |
44 |
|
% gcmfaces_demo; |
45 |
|
|
46 |
%choose verbose level |
%choose verbose level |
47 |
fprintf('\n Please set the amount of explanatory text display :\n'); |
fprintf('\n Please set the amount of explanatory text display :\n'); |
52 |
verbose=input(' and/or type return. 0 is the default. \n'); |
verbose=input(' and/or type return. 0 is the default. \n'); |
53 |
if isempty(verbose); verbose=0; end; |
if isempty(verbose); verbose=0; end; |
54 |
|
|
55 |
%initialize environment variables and mygrid |
fprintf('\n'); |
56 |
addpath gcmfaces; |
|
57 |
gcmfaces_global; |
%so that gcmfaces_msg will work even before calling gcmfaces_global: |
58 |
myenv.issueWarnings=0; |
tmp1=which('gcmfaces_demo'); |
59 |
myenv.verbose=verbose; |
[PATH,NAME,EXT] = fileparts(tmp1); |
60 |
|
addpath([PATH filesep 'gcmfaces_misc' filesep]); |
61 |
|
global myenv; |
62 |
|
myenv.issueWarnings=0;%skip warnings |
63 |
|
myenv.verbose=verbose;%apply verbose level selected by user |
64 |
|
% |
65 |
|
fprintf('\n\n'); |
66 |
|
gcmfaces_msg('/////////////////////////////////////'); |
67 |
|
gcmfaces_msg('demo of gcmfaces_global and MITprof_global','// PART 0 :'); |
68 |
|
gcmfaces_msg('/////////////////////////////////////'); |
69 |
|
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
70 |
|
fprintf('\n\n'); |
71 |
if myenv.verbose>0; |
if myenv.verbose>0; |
72 |
gcmfaces_msg('* set path and environment variables (myenv) by calling gcmfaces_global'); |
gcmfaces_msg(['* gcmfaces_global: adds gcmfaces directories to path' ... |
73 |
|
' and define environment variables (see myenv)']); |
74 |
end; |
end; |
75 |
|
myenv=[]; |
76 |
addpath MITprof; |
gcmfaces_global;%this will display warning |
77 |
if ~isempty(which('MITprof_global')); |
myenv.issueWarnings=0;%skip warnings |
78 |
MITprof_global; |
myenv.verbose=verbose;%apply verbose level selected by user |
79 |
if myenv.verbose>0; |
if myenv.verbose>0; |
80 |
gcmfaces_msg('* set MITprof path by calling MITprof_global'); |
gcmfaces_msg('* (this warning gets resolved below by calling grid_load)'); |
|
end; |
|
81 |
end; |
end; |
82 |
|
|
83 |
|
%if ~isempty(which('MITprof_global')); |
84 |
|
% MITprof_global; |
85 |
|
% if myenv.verbose>0; |
86 |
|
% gcmfaces_msg('* MITprof_global: adds MITprof directories to path'); |
87 |
|
% end; |
88 |
|
%end; |
89 |
|
|
90 |
|
fprintf('\n\n'); |
91 |
|
gcmfaces_msg('/////////////////////////////////////'); |
92 |
|
gcmfaces_msg('demo of grid_load','// PART 1 :'); |
93 |
|
gcmfaces_msg('/////////////////////////////////////'); |
94 |
|
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
95 |
|
fprintf('\n\n'); |
96 |
|
grid_load; |
97 |
|
|
98 |
fprintf('\n\n'); |
fprintf('\n\n'); |
99 |
gcmfaces_msg('/////////////////////////////////////'); |
gcmfaces_msg('/////////////////////////////////////'); |
100 |
gcmfaces_msg('demo of plotting routines','// PART 1 :'); |
gcmfaces_msg('demo of plotting routines','// PART 1 :'); |
|
gcmfaces_msg('please hit return','// >> '); |
|
101 |
gcmfaces_msg('/////////////////////////////////////'); |
gcmfaces_msg('/////////////////////////////////////'); |
102 |
|
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
103 |
fprintf('\n\n'); |
fprintf('\n\n'); |
104 |
pause; |
example_display; |
|
plot_one_field; |
|
105 |
|
|
106 |
fprintf('\n\n'); |
fprintf('\n\n'); |
107 |
gcmfaces_msg('///////////////////////////////////////////'); |
gcmfaces_msg('///////////////////////////////////////////'); |
108 |
gcmfaces_msg('demo of remapping and smoothing','// PART 2 :'); |
gcmfaces_msg('demo of interpolation and remapping ','// PART 2 :'); |
|
gcmfaces_msg('please hit return','// >> '); |
|
109 |
gcmfaces_msg('///////////////////////////////////////////'); |
gcmfaces_msg('///////////////////////////////////////////'); |
110 |
|
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
111 |
fprintf('\n\n'); |
fprintf('\n\n'); |
112 |
pause; |
example_interp; |
113 |
|
|
114 |
if 1;%one method to map lon-lat fields to gcmfaces |
fprintf('\n\n'); |
115 |
example_remap(1); |
gcmfaces_msg('///////////////////////////////////////////'); |
116 |
else;%alternatives |
gcmfaces_msg('demo of bin averaging data sample to grid','// PART 2 :'); |
117 |
example_griddata; |
gcmfaces_msg('///////////////////////////////////////////'); |
118 |
example_interp; |
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
119 |
example_faces2latlon2faces; |
fprintf('\n\n'); |
120 |
end; |
fld=example_bin_average; |
121 |
example_bin_average(1);%incl. call to example_smooth.m; |
|
122 |
|
fprintf('\n\n'); |
123 |
|
gcmfaces_msg('///////////////////////////////////////////'); |
124 |
|
gcmfaces_msg('demo of smoothing through diffusion','// PART 2 :'); |
125 |
|
gcmfaces_msg('///////////////////////////////////////////'); |
126 |
|
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
127 |
|
fprintf('\n\n'); |
128 |
|
example_smooth(fld); |
129 |
|
|
130 |
fprintf('\n\n'); |
fprintf('\n\n'); |
131 |
gcmfaces_msg('/////////////////////////////////////////'); |
gcmfaces_msg('/////////////////////////////////////////'); |
132 |
gcmfaces_msg('demo of transport computations','// PART 3 :'); |
gcmfaces_msg('demo of transport computations','// PART 3 :'); |
|
gcmfaces_msg('please hit return','// >> '); |
|
133 |
gcmfaces_msg('/////////////////////////////////////////'); |
gcmfaces_msg('/////////////////////////////////////////'); |
134 |
|
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
135 |
fprintf('\n\n'); |
fprintf('\n\n'); |
|
pause; |
|
136 |
diags=example_transports; |
diags=example_transports; |
137 |
|
|
138 |
if ~isempty(diags); |
if ~isempty(diags); |
139 |
|
fprintf('\n\n'); |
140 |
|
gcmfaces_msg('/////////////////////////////////////////'); |
141 |
|
gcmfaces_msg('demo of transport display','// PART 3 :'); |
142 |
|
gcmfaces_msg('/////////////////////////////////////////'); |
143 |
|
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
144 |
|
fprintf('\n\n'); |
145 |
example_transports_disp(diags); |
example_transports_disp(diags); |
146 |
end; |
end; |
147 |
|
|
148 |
fprintf('\n\n'); |
fprintf('\n\n'); |
149 |
gcmfaces_msg('/////////////////////////////////////////'); |
gcmfaces_msg('/////////////////////////////////////////'); |
150 |
gcmfaces_msg('demo of budget computations','// PART 4 :'); |
gcmfaces_msg('demo of budget computations','// PART 4 :'); |
|
gcmfaces_msg('please hit return','// >> '); |
|
151 |
gcmfaces_msg('/////////////////////////////////////////'); |
gcmfaces_msg('/////////////////////////////////////////'); |
152 |
|
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end; |
153 |
fprintf('\n\n'); |
fprintf('\n\n'); |
|
pause; |
|
154 |
example_budget; |
example_budget; |
155 |
|
|