% PROJECT_STARTUP initialisation of matlab/octave environment for PROJECT project

%+
%
% .. _project_startup.m:
%
% ==================
% project_startup.m
% ==================
%
% ----------------------------------------------------------------
% initialisation of matlab/octave environment for PROJECT project
% ----------------------------------------------------------------
%
% DESCRIPTION
% ===========
%
% Define :
%
% - path for matlab/octave commands used in PROJECT project
% - IO directories in global variables
%
% This file can be either run classically when current directory
% is ${PROJECT}::
%
%  >> project_startup
%
%
% If linked or copy to ./startup.m, it will be automatically
% run by matlab at start.
%
% If linked or copy to ${HOME}/.octaverc, it will be automatically
% run by octave at start.
%
% SEE ALSO
% ========
%
% :ref:`project_profile.sh`
%
% TODO
% ====
%
% EVOLUTIONS
% ==========
%
% - fplod 20110105T164207Z aedon.locean-ipsl.upmc.fr (Darwin)
%
%   * creation
%
%
%-
%
%clear all
%
matlab_minimal_version_required = '7.4';
octave_minimal_version_required = '3.0.2';
%
%disp('iii : adding path to PROJECT matlab tools')
%
% test if PROJECT environment set
global PROJECT;
PROJECT=getenv('PROJECT');
%if ( isempty(PROJECT) )
% error('eee : PROJECT environment not set');
%else
% disp(['iii : PROJECT =' PROJECT])
%end
%
% add path
addpath(PROJECT);
%
% IO directories
% test if PROJECT_ID environment set

global PROJECT_ID;
PROJECT_ID=getenv('PROJECT_ID');
%if ( isempty(PROJECT_ID) )
% error('eee : PROJECT_ID environment not set');
%end
%
% test if PROJECT_OD environment set
global PROJECT_OD;
PROJECT_OD=getenv('PROJECT_OD');
%if ( isempty(PROJECT_OD) )
% error('eee : PROJECT_OD environment not set');
%end
%
global application;
global application_version;
%
% detect if either octave or matlab running
if exist('matlabpath','builtin')
 application='matlab';
 tmp=ver(application);
 application_version=tmp.Version;
 clear tmp;
 if verLessThan('matlab', matlab_minimal_version_required)
  disp(['matlab_minimal_version_required = ', matlab_minimal_version_required]);
  disp(['application_version =', application_version]);
  warning('www : you have trouble running an older matlab version');
 end
end
if exist('OCTAVE_VERSION','builtin')
 application='octave';
 application_version=version; %% WARNING : do not add () because of matlab 6
end
%
global netcdf_available
%netcdf_file=which('netcdf');
%if (isempty(netcdf_file))
%   netcdf_available=0;
%else
%   netcdf_available=1;
%end
%clear netcdf_file;
%
more on
