1 |
function []=MITprof_global(varargin); |
2 |
%object: take care of path and global variables (mygrid and mitprofenv), |
3 |
% and sends global variables to caller routine workspace |
4 |
%notes: - in any call, if this has not yet been done, |
5 |
% this routine also adds MITprof subdirectories |
6 |
% to the matlab path, and it defines mitprofenv. |
7 |
% - this routine replaces MITprof_path |
8 |
|
9 |
%get/define global variables: |
10 |
global mitprofenv; |
11 |
|
12 |
%take care of path: |
13 |
test0=which('MITprof_load.m'); |
14 |
if isempty(test0); |
15 |
test0=which('MITprof_global.m'); ii=strfind(test0,filesep); |
16 |
mydir=test0(1:ii(end)); |
17 |
% |
18 |
addpath(fullfile(mydir)); |
19 |
addpath(fullfile(mydir,'profiles_process_main_v2')); |
20 |
addpath(fullfile(mydir,'profiles_IO_v2')); |
21 |
addpath(fullfile(mydir,'profiles_IO_external')); |
22 |
addpath(fullfile(mydir,'profiles_misc')); |
23 |
addpath(fullfile(mydir,'profiles_stats')); |
24 |
addpath(fullfile(mydir,'ecco_v4')); |
25 |
addpath(fullfile(mydir,'profiles_devel')); |
26 |
end; |
27 |
|
28 |
%environment variables: |
29 |
if isempty(mitprofenv); |
30 |
test0=which('MITprof_global.m'); ii=strfind(test0,filesep); |
31 |
mitprofenv.MITprof_dir=test0(1:ii(end)); |
32 |
mitprofenv.verbose=0; |
33 |
mitprofenv.lessplot=0; |
34 |
mitprofenv.lesstest=0; |
35 |
mitprofenv.useNativeMatlabNetcdf = ~isempty(which('netcdf.open')); |
36 |
%... check for gcmfaces |
37 |
end; |
38 |
|
39 |
%send to workspace: |
40 |
evalin('caller','global mygrid mitprofenv'); |
41 |
|