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