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