Read this article when you want to get started with python scripts in SOBEK 3 or if you would like to share your user scripts via OpenEarth.

Introduction

With scripts in DeltaShell you can add customized features to SOBEK:

  • Set, delete and modify time series data (e. g. boundary condition input)
  • Modify model data during runtime
  • Read and write input and output data

All scripts in DeltaShell are written in Python.

We distinguish two types of scripts:

  • Official released scripts come with official SOBEK releases. For official scripts quality standards like backwards compatibility apply.
  • User scripts don't have official status. SOBEK users share their scripts via OpenEarth.

Getting started

Add local copy of the Open Earth SOBEK script repository to your scripting folder:

  • In the Toolbox, select the folder "Scripts" and open this location with windows explorer or another file manager.
  • Add a folder "SOBEK" and checkout the Open Earth SVN repository to this folder.

Alternative: cange the scripting folder to the local copy of the Open Earth SVN repository:


Tutorials

Folders

  • bin: for binary files. This is a default OpenEarth folder, not used.
  • docs: for documentation of scripts. User manuals, memos, theses, articles and other documents can be stored here.
  • Scripts: This folder contains the python source code. Assign your script to one of the following categories:
    • GenericScripts: Scripts for generic use that are not related to one specific plug-in.
    • ScriptsForIntegratedModels: Scripts that are related to more than one plug-in (model).
    • ScriptsForOneModel: Scripts that are related to one plug-in (model)
  • tests: For benchmark tests and demonstration cases. Add simple models to test your script with to this folder.

Good practice for developing SOBEK scripts

Quality standards for python code

  • Add the author's name and contact details to all files.
  • Mention the revision of DeltaShell the script runs with. This can be very helpful in cases of DeltaShell API changes.
  • Follow PEP 8

Working with Subversion (SVN)

  • Before committing a change, first update your local working copy.
  • Do one commit per change, don't put multiple changes in one commit.