Skip to content

1. Installation

GilesFearon edited this page Oct 31, 2024 · 16 revisions

To run OpenDrift simulations locally, you need to first have the opendrift mamba/conda environment set up, according to the OpenDrift install instructions. These instructions require you to have mamba installed, but it should also work with conda if you haven't made the move yet.

At the time of writing, the master branch of the OpenDrift code does not read our native CROCO output files properly - it doesn't crash but the CROCO currents are ignored. This is likely a bug introduced in one of the latest releases, and we still need to resolve this. For the purposes of this tutorial, please checkout an older version of the code which we are currently running operationally, and we know works:

cd opendrift # i.e. the directory that was created when cloning the OpenDrift source code
git checkout v1.11.0 # this was the December 2023 release

Once you've set up your opendrift environment, you can clone the somisana-opendrift repo to your local machine. If you are expecting to participate in developing the code, you should use SSH protocol, which requires that you've added your local SSH key to your GitHub account settings. Then do this wherever you would like the code:

git clone [email protected]:SAEON/somisana-opendrift.git

Alternatively, if you're not anticipating developing and pushing changes to this repo, you can also use HTTPS protocol (only do one of these clone commands!):

git clone https://github.com/SAEON/somisana-opendrift.git

Then navigate to the root directory of the repo, and install the code into your opendrift environment:

cd somisana-opendrift
conda activate opendrift
pip install --no-deps -e .

Now you'll be able to import all the functions inside the opendrift_tools directory without having to manually add this directory to your python path. To test your installation you can activate your opendrift environment, run python, and then:

import opendrift # imports the standard OpenDrift code
import opendrift_tools # imports our somisana-opendrift tools

If the imports work without errors, you should be good to go.

You may want to install additional packages on top of the default opendrift environment. For instance, if you would like to use spyder:

mamba install spyder

If you just want to run a quick OpenDrift simulation using the tools in this repo, you don't have to install anything (not even python). You can rather just run the Docker image for the repo as described here

Clone this wiki locally