How to create your own script

Except from the existing scripts it is also possible to create your own script. This requires some knowledge of Python and the structure of the library. On this page some information about the library is given.


The library contains the functions which can be used in your own script. These function interact with the MorphAn broncode. Thus, without knowledge of the MorphAn code, the user can still add there own functionalities. Due to the fact that the code changes for every release, it is important to use the library corresponding to your own release of MorphAn. The scripts in the library is ordered by the functionalities. So all the scripts related to a Duros computation are located in the Duros folder. The list below descibe the different folders in the library:

  • Duros: Scripts related to a Duros computation
  • MorphAn: Scripts related to the MorphAn functions. For instance the contains the functions to interact with the MorphAn models
  • Utils: Scripts which contain basic MorphAn functions.
  • XBeach: Scripts related to a XBeach computation


To make use of the functions in the library, these function must be imported. The Python line below shows how to import the GetModel function from the Morphan folder.

from Libraries.MorphAn.Models import GetModel

It is also possible to import all the function from a certain folder. This can be done with the *. See the example below.

from Libraries.MorphAn.Models import *

When these functions are imported, it is possible to use the function in your script.


Tips and tricks

  • To check an variable the show variable button can be used. This will open a window the existing variables.
  • With the command #region it is possible to group parts of code in a region, which can be collapsed.

  • It is possible to show the sub functions of a variable. When a dot is placed behind the variable, there will arise a window the sub functions.