% IRCAAM_STARTUP initialisation of matlab/octave environment for IRCAAM project

%+
%
% ================
% ircaam_startup.m
% ================
%
% --------------------------------------------------------------
% initialisation of matlab/octave environment for IRCAAM project
% --------------------------------------------------------------
%
% DESCRIPTION
% ===========
%
% Define :
%  - path for matlab/octave commands used in IRCAAM project
%  - IO directories in global variables
%
% This file can be either run classicaly when current directory
% is ${IRCAAM} :
% ..
%
%  >> ircaam_startup
%
%
% If linked or copy to ./startup.m, it will be automaticaly
% run by matlab at start.
%
% If linked or copy to ${HOME}/.octaverc, it will be automaticaly
% run by octave at start.
%
% SEE ALSO
% ========
%
% :ref:`ircaam_profile.sh`
%
% EVOLUTIONS
% ==========
%
% $Id$
%
% - fplod 2009-01-27T11:25:50Z aedon.locean-ipsl.upmc.fr (Darwin)
%
%   * define global variables
%
% - fplod 2009-01-07T11:12:31Z aedon.locean-ipsl.upmc.fr (Darwin)
%
%   * add indice_flore directory to path
%   * more elegant way to know if eithe octave or matlab is running
%     thanks to http://enacit1.epfl.ch/cours_matlab/mfiles.html#scripts
%
% - fplod 2008-12-22T13:24:38Z aedon.locean-ipsl.upmc.fr (Darwin)
%
%   * add detection of either matlab or octave running
%
% - fplod 2008-12-22T09:38:20Z zeus.locean-ipsl.upmc.fr (Linux)
%
%   * creation
%
% TODO
% ====
%
%-
%
clear all
%
disp('iii : adding path to IRCAAM matlab tools')
%
% test if IRCAAM environment set
global IRCAAM;
IRCAAM=getenv('IRCAAM');
if ( isempty(IRCAAM) )
 error('eee : IRCAAM environment not set');
else
 disp(['iii : IRCAAM =' IRCAAM])
end
%
% add path
addpath(IRCAAM);
addpath([IRCAAM '/mode_sahelien/']);
addpath([IRCAAM '/SIMULS_IRCAAM/']);
addpath([IRCAAM '/indice_flore/']);
%
% IO directories
% test if IRCAAM_ID environment set

global IRCAAM_ID;
IRCAAM_ID=getenv('IRCAAM_ID');
if ( isempty(IRCAAM_ID) )
 error('eee : IRCAAM_ID environment not set');
end
%
% test if IRCAAM_OD environment set
global IRCAAM_OD;
IRCAAM_OD=getenv('IRCAAM_OD');
if ( isempty(IRCAAM_OD) )
 error('eee : IRCAAM_OD environment not set');
end
%
% detect if either octave or matlab running
if ~ exist('OCTAVE_VERSION')
 run_octave=0;
else
 run_octave=1;
end
%
if (run_octave == 0)
 % to display help written in ISO-LATIN
 slCharacterEncoding('ISO-8859-1');
end
%
more on
