1 |
function []=MITprof_global(varargin); |
2 |
% |
3 |
% MITPROF_GLOBAL calls gcmfaces_global, adds MITprof paths, adds |
4 |
% defines MITprof_climdir and MITprof_griddir in myenv, and |
5 |
% adds myenv (global variable) to caller routine workspace |
6 |
|
7 |
%get/define global variables: |
8 |
gcmfaces_global; |
9 |
|
10 |
warning(sprintf(['This version of MITprof, from an old CVS server, is now \n' ... |
11 |
' considered deprecated. Future devopment will proceed, instead, \n' ... |
12 |
' via GitHub. For up to date documentation, please refer to \n' ... |
13 |
' http://gcmfaces.readthedocs.io/en/latest/'])); |
14 |
|
15 |
%take care of path: |
16 |
test0=which('MITprof_load.m'); |
17 |
if isempty(test0); |
18 |
test0=which('MITprof_global.m'); ii=strfind(test0,filesep); |
19 |
mydir=test0(1:ii(end)); |
20 |
% |
21 |
addpath(fullfile(mydir)); |
22 |
addpath(fullfile(mydir,'profiles_process_main_v2')); |
23 |
addpath(fullfile(mydir,'profiles_IO_v2')); |
24 |
addpath(fullfile(mydir,'profiles_IO_external')); |
25 |
addpath(fullfile(mydir,'profiles_misc')); |
26 |
addpath(fullfile(mydir,'profiles_stats')); |
27 |
addpath(fullfile(mydir,'ecco_v4')); |
28 |
addpath(fullfile(mydir,'profiles_devel')); |
29 |
end; |
30 |
|
31 |
%environment variables: |
32 |
if ~isfield(myenv,'MITprof_dir'); |
33 |
test0=which('MITprof_global.m'); ii=strfind(test0,filesep); |
34 |
myenv.MITprof_dir=test0(1:ii(end)); |
35 |
% |
36 |
gridDir=''; |
37 |
tmpDir=fullfile(myenv.gcmfaces_dir,'..','GRID',filesep); |
38 |
if isdir(tmpDir); gridDir=tmpDir; end; |
39 |
tmpDir=fullfile(myenv.gcmfaces_dir,'..','nctiles_grid',filesep); |
40 |
if isdir(tmpDir); gridDir=tmpDir; end; |
41 |
if isdir('GRID/'); gridDir='GRID/'; end; |
42 |
if isdir('nctiles_grid/'); gridDir='nctiles_grid/'; end; |
43 |
|
44 |
if isempty(gridDir); |
45 |
fprintf('\n please indicate the ECCO v4 grid directory (e.g., ''nctiles_grid/'') \n\n'); |
46 |
fprintf(' It can be obtained as follows: \n'); |
47 |
fprintf(' wget --recursive ftp://mit.ecco-group.org/ecco_for_las/version_4/release2/nctiles_grid/ .\n'); |
48 |
fprintf(' mv mit.ecco-group.org/ecco_for_las/version_4/release2/nctiles_grid/ . \n\n'); |
49 |
gridDir=input(''); |
50 |
end; |
51 |
|
52 |
addpath(gridDir); |
53 |
fil=which('GRID.0001.nc'); |
54 |
if isempty(fil); fil=which('XC.meta'); end; |
55 |
if isempty(fil); error('could not find grid'); end; |
56 |
myenv.MITprof_griddir=[fileparts(fil) filesep]; |
57 |
% |
58 |
climDir=''; |
59 |
tmpDir=fullfile(myenv.gcmfaces_dir,'sample_input','OCCAetcONv4GRID',filesep); |
60 |
if isdir(tmpDir); climDir=tmpDir; end; |
61 |
tmpDir=fullfile(myenv.MITprof_dir,'..','gcmfaces_climatologies',filesep); |
62 |
if isdir(tmpDir); climDir=tmpDir; end; |
63 |
tmpDir=fullfile('sample_input','OCCAetcONv4GRID',filesep); |
64 |
if isdir(tmpDir); climDir=tmpDir; end; |
65 |
tmpDir=fullfile('gcmfaces_climatologies',filesep); |
66 |
if isdir(tmpDir); climDir=tmpDir; end; |
67 |
|
68 |
addpath(climDir); |
69 |
fil=which('sigma_T_mad_feb2013.bin'); |
70 |
if isempty(fil); |
71 |
fprintf('\n please indicate the climatologies directory (e.g., ''gcmfaces_climatologies/'') \n\n'); |
72 |
fprintf(' It can be obtained as follows: \n'); |
73 |
fprintf(' wget --recursive ftp://mit.ecco-group.org/gforget/OCCAetcONv4GRID .\n'); |
74 |
fprintf(' mv mit.ecco-group.org/gforget/OCCAetcONv4GRID gcmfaces_climatologies \n\n'); |
75 |
climDir=input(''); |
76 |
end; |
77 |
|
78 |
addpath(climDir); |
79 |
fil=which('sigma_T_mad_feb2013.bin'); |
80 |
if isempty(fil); error('could not find sigma_T_mad_feb2013.bin'); end; |
81 |
myenv.MITprof_climdir=[fileparts(fil) filesep]; |
82 |
|
83 |
end; |
84 |
|
85 |
%send to workspace: |
86 |
evalin('caller','global mygrid myenv'); |
87 |
|