1 | % VARAMMA_STARTUP initialisation of matlab/octave environment for VARAMMA project |
---|
2 | |
---|
3 | %+ |
---|
4 | % |
---|
5 | % .. _varamma_startup.m: |
---|
6 | % |
---|
7 | % ================= |
---|
8 | % varamma_startup.m |
---|
9 | % ================= |
---|
10 | % |
---|
11 | % --------------------------------------------------------------- |
---|
12 | % initialisation of matlab/octave environment for VARAMMA project |
---|
13 | % --------------------------------------------------------------- |
---|
14 | % |
---|
15 | % DESCRIPTION |
---|
16 | % =========== |
---|
17 | % |
---|
18 | % Define : |
---|
19 | % - path for matlab/octave commands used in VARAMMA project |
---|
20 | % - IO directories in global variables |
---|
21 | % |
---|
22 | % This file can be either run classicaly when current directory |
---|
23 | % is ${PROJECT}:: |
---|
24 | % |
---|
25 | % >> varamma_startup |
---|
26 | % |
---|
27 | % |
---|
28 | % If linked or copy to ./startup.m, it will be automaticaly |
---|
29 | % run by matlab at start. |
---|
30 | % |
---|
31 | % If linked or copy to ${HOME}/.octaverc, it will be automaticaly |
---|
32 | % run by octave at start. |
---|
33 | % |
---|
34 | % SEE ALSO |
---|
35 | % ======== |
---|
36 | % |
---|
37 | % :ref:`varamma_profile.sh` |
---|
38 | % |
---|
39 | % TODO |
---|
40 | % ==== |
---|
41 | % |
---|
42 | % Minimal version octave : 3.0 still true ?! |
---|
43 | % |
---|
44 | % intwarning error |
---|
45 | % |
---|
46 | % intwarning octave |
---|
47 | % |
---|
48 | % EVOLUTIONS |
---|
49 | % ========== |
---|
50 | % |
---|
51 | % $Id$ |
---|
52 | % |
---|
53 | % $URL% |
---|
54 | % |
---|
55 | % - fplod 20110802T142257Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
56 | % |
---|
57 | % * force GNUTERM to X11 if running octave on MacOS |
---|
58 | % |
---|
59 | % - fplod 20110520T095918Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
60 | % |
---|
61 | % * introducing octave version 3.4 (available on cratos) |
---|
62 | % |
---|
63 | % - fplod 20110503T070338Z |
---|
64 | % |
---|
65 | % * replace VARAMMA by PROJECT |
---|
66 | % |
---|
67 | % - fplod 20110314T114224Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
68 | % |
---|
69 | % * add global variable VARAMMA to be used in rundemos |
---|
70 | % |
---|
71 | % - fplod 20110309T111014Z loholt1 |
---|
72 | % |
---|
73 | % * add 7.10 for matlab (case on matlab in loholt1) |
---|
74 | % * reactivate netcdf detection |
---|
75 | % either netcdf.open is available (case on matlab in loholt1 |
---|
76 | % or matlab on jaclod windows) or not (case on matlab and octave on |
---|
77 | % LOCEAN plateforms |
---|
78 | % |
---|
79 | % - fplod 20110307T171843Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
80 | % |
---|
81 | % * no more intwarning when matlab 7.11 is running |
---|
82 | % |
---|
83 | % - fplod 20110302T105216Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
84 | % |
---|
85 | % * add intwarning when octave 3.2.3 is running (on aedon) |
---|
86 | % |
---|
87 | % - fplod 20110228T131154Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
88 | % |
---|
89 | % * add intwarning when octave 3.2.4 is running (on cratos) |
---|
90 | % |
---|
91 | % - fplod 20110217T153835Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
92 | % |
---|
93 | % * controle of error/warning |
---|
94 | % see http://www.kxcad.net/cae_MATLAB/techdoc/ref/intwarning.html |
---|
95 | % see http://www.gnu.org/software/octave/doc/interpreter/Enabling-and-Disabling-Warnings.html |
---|
96 | % |
---|
97 | % - fplod 20101022T142723Z zeus.locean-ipsl.upmc.fr (Linux) |
---|
98 | % |
---|
99 | % * reactivation of application and application version detection |
---|
100 | % |
---|
101 | % - fplod 20100726T135206Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
102 | % |
---|
103 | % * fix on value of netcdf_available (boolean) |
---|
104 | % |
---|
105 | % - fplod 20100721T10000Z |
---|
106 | % |
---|
107 | % * add utilitaires to path |
---|
108 | % |
---|
109 | % - fplod 20100712T072903Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
110 | % |
---|
111 | % * add external_matlab to path |
---|
112 | % |
---|
113 | % - fplod 20100615T150000Z |
---|
114 | % |
---|
115 | % * test if nectdf available |
---|
116 | % |
---|
117 | % - fplod 20100608T123239Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
118 | % |
---|
119 | % * make application_version useable in functions |
---|
120 | % |
---|
121 | % - fplod 20100525T095121Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
122 | % |
---|
123 | % * moved from MSG project to VARAMMA |
---|
124 | % |
---|
125 | % - fplod 20100503T102901Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
126 | % |
---|
127 | % * creation |
---|
128 | % |
---|
129 | %- |
---|
130 | % |
---|
131 | %clear all |
---|
132 | % |
---|
133 | matlab_minimal_version_required = '7.4'; |
---|
134 | octave_minimal_version_required = '3.0.2'; |
---|
135 | % |
---|
136 | %disp('iii : adding path to PROJECT matlab tools') |
---|
137 | % |
---|
138 | % test if PROJECT environment set |
---|
139 | global PROJECT; |
---|
140 | PROJECT=getenv('PROJECT'); |
---|
141 | %if ( isempty(PROJECT) ) |
---|
142 | % error('eee : PROJECT environment not set'); |
---|
143 | %else |
---|
144 | % disp(['iii : PROJECT =' PROJECT]) |
---|
145 | %end |
---|
146 | % |
---|
147 | % add path |
---|
148 | addpath(PROJECT); |
---|
149 | %addpath([PROJECT '/src/external_matlab/']); |
---|
150 | addpath([PROJECT '/src/utilitaires/']); |
---|
151 | % |
---|
152 | % IO directories |
---|
153 | % test if PROJECT_ID environment set |
---|
154 | |
---|
155 | global PROJECT_ID; |
---|
156 | PROJECT_ID=getenv('PROJECT_ID'); |
---|
157 | %if ( isempty(PROJECT_ID) ) |
---|
158 | % error('eee : PROJECT_ID environment not set'); |
---|
159 | %end |
---|
160 | % |
---|
161 | % test if PROJECT_OD environment set |
---|
162 | global PROJECT_OD; |
---|
163 | PROJECT_OD=getenv('PROJECT_OD'); |
---|
164 | %if ( isempty(PROJECT_OD) ) |
---|
165 | % error('eee : PROJECT_OD environment not set'); |
---|
166 | %end |
---|
167 | % |
---|
168 | global application; |
---|
169 | global application_version; |
---|
170 | % |
---|
171 | % detect if either octave or matlab running |
---|
172 | if exist('matlabpath','builtin') |
---|
173 | application='matlab'; |
---|
174 | tmp=ver(application); |
---|
175 | application_version=tmp.Version; |
---|
176 | clear tmp; |
---|
177 | if verLessThan('matlab', matlab_minimal_version_required) |
---|
178 | disp(['matlab_minimal_version_required = ', matlab_minimal_version_required]); |
---|
179 | disp(['application_version =', application_version]); |
---|
180 | warning('www : you have trouble running an older matlab version'); |
---|
181 | end |
---|
182 | end |
---|
183 | if exist('OCTAVE_VERSION','builtin') |
---|
184 | application='octave'; |
---|
185 | application_version=version; %% WARNING : do not add () because of matlab 6 |
---|
186 | end |
---|
187 | % |
---|
188 | global netcdf_open_available |
---|
189 | netcdf_open=which('netcdf.open'); |
---|
190 | if (isempty(netcdf_open)) |
---|
191 | netcdf_open_available=0; |
---|
192 | else |
---|
193 | netcdf_open_available=1; |
---|
194 | end |
---|
195 | clear netcdf_open |
---|
196 | % |
---|
197 | % set up terminal |
---|
198 | switch application |
---|
199 | case {'matlab'} |
---|
200 | case {'octave'} |
---|
201 | if ismac() |
---|
202 | setenv('GNUTERM','X11'); |
---|
203 | end |
---|
204 | otherwise |
---|
205 | error(['unknown application version running ', application , ' ' ,application_version]); |
---|
206 | end |
---|
207 | |
---|
208 | % severe warning and errors |
---|
209 | switch application |
---|
210 | case {'matlab'} |
---|
211 | switch application_version |
---|
212 | case {'7.4'} |
---|
213 | intwarning('on') |
---|
214 | case {'7.10','7.11'} |
---|
215 | disp([ 'non intwarning when matlab is running']); |
---|
216 | otherwise |
---|
217 | error(['unknown application version running ', application , ' ' ,application_version]); |
---|
218 | end |
---|
219 | |
---|
220 | s = warning('on', 'MATLAB:intConvertNaN'); |
---|
221 | % turn on MATLAB:divideByZero |
---|
222 | s = warning('on', 'MATLAB:divideByZero'); |
---|
223 | % show warnings |
---|
224 | %++debug warning('query','all'); |
---|
225 | %++debug intwarning('query') |
---|
226 | case {'octave'} |
---|
227 | switch application_version |
---|
228 | case {'3.0.2'} |
---|
229 | disp([ 'non intwarning when octave is running']); |
---|
230 | case {'3.2.3','3.2.4'} |
---|
231 | intwarning('on') |
---|
232 | case {'3.4.0'} |
---|
233 | disp([ 'no more intwarning when octave is running']); |
---|
234 | otherwise |
---|
235 | error(['unknown application version running ', application , ' ' ,application_version]); |
---|
236 | end |
---|
237 | s = warning('on', 'Octave:divideByZero'); |
---|
238 | % show warnings |
---|
239 | %++ debug warning('query','all') |
---|
240 | %++ 33 s=warning('query','all') |
---|
241 | %++ 33 s.identifier |
---|
242 | %++ 33 s.state |
---|
243 | otherwise |
---|
244 | error('unknown application running'); |
---|
245 | end |
---|
246 | more on |
---|