Python script example

A Python script describing the steps of initializing, running and terminate a MIKE SHE model is shown below.

import datetime                                         #Import daytime module

import MShePy                                         #Import MShePy module

MShePy.wm.initialize(r"C:\Users\PETR.she")     #Initialize the model

currentTime=MShePy.wm.currentTime()            #Find the initial timestep

EndTime=currentTime+datetime.timedelta(days=5)         #Calculate the end timestep after 5 days

MShePy.wm.runToTime(EndTime)                                   #Run the model until the end timestep

MShePy.wm.terminate(True)                   #Terminate the simulation