Skip to content
Johannes Röhrs edited this page Dec 21, 2018 · 103 revisions

Image

OpenDrift is a software for modeling the trajectories and fate of objects or substances drifting in the ocean, or even in the atmosphere.

OpenDrift is open source, and is programmed in Python. As the software is very generic, it is rather a "framework" than a "trajectory model" in the traditional sense. Trajectory models for specific purposes (e.g. oil drift, search and rescue, larvae drift etc) may reuse all common functionality from the core model, and need only implement a Python Class describing the purpose-specific processes (physics/biology etc). See Requirements and Data model for more detailed information.

A journal paper about OpenDrift is published in Geoscientific Model Development. A paper describing the technical details of the oil spill module OpenOil is published in Ocean Science.

OpenDrift animation

Some key features:

  • Open source, GPL v2 license, providing full transparency - no black boxes
  • Very simple installation, core OpenDrift requires only Python standard libraries
  • Platform independent, runs on Linux, Mac/OS X, Windows
  • Python2 and Python3 compliant
  • Fast - typical simulation time is ~30 seconds for a 66 hour simulation with 1000 particles
  • Modular, may simulate transport and fate of any kind of of particles (oil, ships, persons, icebergs etc.)
    • Simple to make new modules, based on existing modules or blank template
  • May use input forcing data (e.g. current, wind and waves) from any model, in any file format and any map projection
    • avoids need to preprocess driver data
    • map reprojection and vector rotation performed on-the-fly, using PyProj library
    • may use input forcing from remote datasets (e.g. Thredds)
  • May use backup driver models (e.g. current, wind, waves) for robustness if first choice is not available
  • May run backwards in time by simply specifying a negative time step
  • Output saved to CF-compliant netCDF files (but export modules may be written for other formats).
  • Basic graphical user interface (presently supports only OpenOil and Leeway)
  • Input from ensemble models

Disclaimer

OpenDrift is still in early development phase, and should be used with care for real studies and applications.

Download and installation

The latest version of OpenDrift can be downloaded from here or with Git:

git clone https://github.com/OpenDrift/opendrift.git

OpenDrift and its dependencies is installed with the command:

cd opendrift; 
python setup.py develop --user

The --user flag can be omitted if you want OpenDrift to be available for other users on the same machine. By including the keyword develop it is not necessary to re-install OpenDrift after each update (git pull).

To be able to run the commandline scripts, add the folder scrips to your PATH, e.g in .bashrc:

export PATH=$PATH:$OPENDRIFT_FOLDER/opendrift/scripts/

If some of the requirements should be missing, the recommendation is to first install Miniconda, and then install requirements with the command:

conda install --yes hdf4 numpy scipy matplotlib basemap basemap-data-hires netcdf4 configobj pillow gdal pyproj ffmpeg future

If Basemap gives the error KeyError: 'PROJ_LIB', you may need to set the environment variable:

export PROJ_LIB=$HOME/miniconda2/share/proj/(eventually miniconda3).

OpenDrift supports both Python2 and Python3, but the oil drift module (OpenOil) depends on the NOAA OilLibrary which is not Python3 compliant. Thus if oil drift simulations are of interest, Miniconda2 and not Miniconda3 should be used. After installing requirements, OpenDrift can be installed with commands given above.

Note that there is an issue with some versions of GDAL in Conda, resulting in error TypeError: in method 'Geometry_Transform', argument 2 of type 'OSRCoordinateTransformationShadow' As a workaround, set the environment variable GDAL_DATA equal to the folder given by $gdal-config --datadir

OpenDrift has been tested on various Linux, Mac and Windows operating systems.

Testing

To test that OpenDrift works as expected, run the script testall in the root folder. On Windows, tests can be run from dos prompt in the main opendrift-folder with the following command:

python -m unittest discover tests -p test_*.py

The last line of the output should report that all tests have been executed successfully.

For a demonstration of various capabilities, run some of the executable example scripts located in the subfolder examples. Some of the scripts use sample netCDF files provided in the test_data folder, and others obtain data from online resources (Thredds). If this works well, you may play with the model by editing the example scripts.

Here is a detailed explanation of the steps involved when running the model.

License

OpenDrift is licensed under GPL v2.0

Citation

If you have found OpenDrift useful for your study, please cite it as:

Dagestad, K.-F., Röhrs, J., Breivik, Ø., and Ådlandsvik, B.: OpenDrift v1.0: a generic framework for trajectory modelling, Geosci. Model Dev., 11, 1405-1420, https://doi.org/10.5194/gmd-11-1405-2018, 2018.

For the oil spill module OpenOil, please cite in addition to above:

Röhrs, J., Dagestad, K.-F., Asbjørnsen, H., Nordam, T., Skancke, J., Jones, C. E., and Brekke, C.: The effect of vertical mixing on the horizontal drift of oil spills, Ocean Sci., 14, 1581-1601, https://doi.org/10.5194/os-14-1581-2018, 2018.

Contact

Please create an issue or contact [email protected] for any questions.

Click here if you want to receive emails about important changes or releases.

Clone this wiki locally