addpath
By default, MATLAB and Python cannot locate ISSM and external packages. We demonstrate here how to remedy this.
MATLAB
NOTE: There does not currently exist a method for starting MATLAB from the GUI with ISSM loaded.
Before starting MATLAB, you will need to run:
source $ISSM_DIR/etc/environment.sh
from the command line. This will modify certain environment variables so that ISSM and external packages are available to other programs.
As noted in our compilation instructions, it may be easiest to simply add this to your shell configuration file:
export ISSM_DIR=<ISSMPATH>
source $ISSM_DIR/etc/environment.sh
setenv ISSM_DIR <ISSMPATH>
source $ISSM_DIR/etc/environment.csh
where <ISSMPATH>
is the path to the ISSM parent directory (e.g. /home/<user>/svn/issm/trunk
).
Once MATLAB is started, you must tell it where to find ISSM and external libraries by running:
addpath <ISSMPATH>/bin <ISSMPATH>/lib
You can verify that ISSM works by executing:
issmversion
You should get a message similar to:
Ice-sheet and Sea-level System Model (ISSM) Version 4.22
(website: http://issm.jpl.nasa.gov contact:issm@jpl.nasa.gov)
Build date: Wed Sep 18 14:00:06 PDT 2023
Copyright (c) 2009-2023 California Institute of Technology
to get started type: issmdoc
You can avoid having to run the addpath
command every time MATLAB is started by creating an alias for MATLAB in your shell configuration file:
alias matlab='matlab -r "addpath ${ISSM_DIR}/bin ${ISSM_DIR}/lib"'
Python
In Python, you can add ISSM's function to the current path with the following command:
import os
import sys
sys.path.append(os.getenv('ISSM_DIR') + '/bin')
sys.path.append(os.getenv('ISSM_DIR') + '/lib')
You can verify that ISSM works by executing:
from issmversion import issmversion
You should get a message similar to this:
Ice-sheet and Sea-level System Model (ISSM) Version 4.22
(website: http://issm.jpl.nasa.gov contact:issm@jpl.nasa.gov)
Build date: Wed Sep 18 14:00:06 PDT 2023
Copyright (c) 2009-2023 California Institute of Technology
Developers
Developers use the MATLAB and Python scripts in $ISSM_DIR/src/m
instead of $ISSM_DIR/bin
. As such, we need to modify the paths a bit differently.
MATLAB
Again, run:
source $ISSM_DIR/etc/environment.sh
from the command line, then run following in MATLAB:
addpath <ISSMDIR>/src/m/dev
devpath
where <ISSMPATH>
is the path to the ISSM parent directory.
Alternatively, you can start MATLAB from the command line with:
matlab -r "addpath ${ISSM_DIR}/src/m/dev; devpath;"
Python
Before starting Python, run the following on the command line:
export PYTHONPATH="${ISSM_DIR}/src/m/dev"
export PYTHONSTARTUP="${PYTHONPATH}/devpath.py"
For IPython users, launch the interface with:
ipython -i ${ISSM_DIR}/src/m/dev/devpath.py
NOTE: When compiling ISSM, the following option should be added to the configuration script ($ISSM_DIR/configure.sh
) to prevent MATLAB and Python scripts from being added to $ISSM_DIR/bin
:
--enable-development