forked from MITgcm/gcmfaces
-
Notifications
You must be signed in to change notification settings - Fork 3
/
gcmfaces_demo.m
155 lines (142 loc) · 5.58 KB
/
gcmfaces_demo.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
function []=gcmfaces_demo();
% GCMFACES_DEMO demonstrate capabilities of the gcmfaces toolbox.
%
%expected directory structure:
%
% gcmfaces (codes)
% MITprof (codes)
% nctiles_grid (ECCO v4 grid)
% release2_climatology (ECCO v4 output)
% sample_input (additional demo material)
%
%the ECCO v4 grid can be obtained as follows:
%
% wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release2/nctiles_grid
% mv mit.ecco-group.org/ecco_for_las/version_4/release2/nctiles_grid .
% rm -rf mit.ecco-group.org
%
%to activate example_transports:
%
% mkdir release2_climatology
% wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release2/nctiles_climatology
% mv mit.ecco-group.org/ecco_for_las/version_4/release2/nctiles_climatology release2_climatology/.
% rm -rf mit.ecco-group.org
%
%to activate example_MITprof:
%
% mkdir release2_climatology
% wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release2/nctiles_climatology
% mv mit.ecco-group.org/ecco_for_las/version_4/release2/nctiles_climatology release2_climatology/.
% wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release2/profiles
% mv mit.ecco-group.org/ecco_for_las/version_4/release2/profiles release2_climatology/.
% rm -rf mit.ecco-group.org
%
%to activate example_budget:
%
% mkdir sample_input
% wget --recursive ftp://mit.ecco-group.org/gforget/nctiles_budget_2d
% mv mit.ecco-group.org/gforget/nctiles_budget_2d sample_input/.
% rm -rf mit.ecco-group.org
%
% call sequence:
% addpath gcmfaces;
% addpath MITprof;
% gcmfaces_demo;
%choose verbose level
fprintf('\n Please set the amount of explanatory text display :\n');
fprintf(' 0: none.\n');
fprintf(' 1: comments.\n');
fprintf(' 2: comments preceeded with calling sequence.\n');
fprintf(' 3: same as 2, but preceeded with pause.\n');
verbose=input(' and/or type return. 0 is the default. \n');
if isempty(verbose); verbose=0; end;
fprintf('\n');
%so that gcmfaces_msg will work even before calling gcmfaces_global:
tmp1=which('gcmfaces_demo');
[PATH,NAME,EXT] = fileparts(tmp1);
addpath([PATH filesep 'gcmfaces_misc' filesep]);
global myenv;
myenv.issueWarnings=0;%skip warnings
myenv.verbose=verbose;%apply verbose level selected by user
%
fprintf('\n\n');
gcmfaces_msg('/////////////////////////////////////');
gcmfaces_msg('demo of gcmfaces_global and MITprof_global','// PART 0 :');
gcmfaces_msg('/////////////////////////////////////');
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
fprintf('\n\n');
if myenv.verbose>0;
gcmfaces_msg(['* gcmfaces_global: adds gcmfaces directories to path' ...
' and define environment variables (see myenv)']);
end;
myenv=[];
gcmfaces_global;%this will display warning
myenv.issueWarnings=0;%skip warnings
myenv.verbose=verbose;%apply verbose level selected by user
if myenv.verbose>0;
gcmfaces_msg('* (this warning gets resolved below by calling grid_load)');
end;
%if ~isempty(which('MITprof_global'));
% MITprof_global;
% if myenv.verbose>0;
% gcmfaces_msg('* MITprof_global: adds MITprof directories to path');
% end;
%end;
fprintf('\n\n');
gcmfaces_msg('/////////////////////////////////////');
gcmfaces_msg('demo of grid_load','// PART 1 :');
gcmfaces_msg('/////////////////////////////////////');
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
fprintf('\n\n');
grid_load;
fprintf('\n\n');
gcmfaces_msg('/////////////////////////////////////');
gcmfaces_msg('demo of plotting routines','// PART 1 :');
gcmfaces_msg('/////////////////////////////////////');
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
fprintf('\n\n');
example_display;
fprintf('\n\n');
gcmfaces_msg('///////////////////////////////////////////');
gcmfaces_msg('demo of interpolation and remapping ','// PART 2 :');
gcmfaces_msg('///////////////////////////////////////////');
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
fprintf('\n\n');
example_interp;
fprintf('\n\n');
gcmfaces_msg('///////////////////////////////////////////');
gcmfaces_msg('demo of bin averaging data sample to grid','// PART 2 :');
gcmfaces_msg('///////////////////////////////////////////');
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
fprintf('\n\n');
fld=example_bin_average;
fprintf('\n\n');
gcmfaces_msg('///////////////////////////////////////////');
gcmfaces_msg('demo of smoothing through diffusion','// PART 2 :');
gcmfaces_msg('///////////////////////////////////////////');
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
fprintf('\n\n');
example_smooth(fld);
fprintf('\n\n');
gcmfaces_msg('/////////////////////////////////////////');
gcmfaces_msg('demo of transport computations','// PART 3 :');
gcmfaces_msg('/////////////////////////////////////////');
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
fprintf('\n\n');
diags=example_transports;
if ~isempty(diags);
fprintf('\n\n');
gcmfaces_msg('/////////////////////////////////////////');
gcmfaces_msg('demo of transport display','// PART 3 :');
gcmfaces_msg('/////////////////////////////////////////');
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
fprintf('\n\n');
example_transports_disp(diags);
end;
fprintf('\n\n');
gcmfaces_msg('/////////////////////////////////////////');
gcmfaces_msg('demo of budget computations','// PART 4 :');
gcmfaces_msg('/////////////////////////////////////////');
if myenv.verbose>0; gcmfaces_msg('please hit return','// >> '); pause; end;
fprintf('\n\n');
example_budget;