...
Code Block | ||
---|---|---|
| ||
# import standard scripting library from Libraries.StandardFunctions import * # import our model from DeltaShell.Plugins.VolumeModel.Models import VolumeModel # import some DeltaShell (C#) libraries from NetTopologySuite.Extensions.Features import Feature from NetTopologySuite.Extensions.Geometries import GeometryHelper # import .Net library from System import DateTime # create an instance of our model and set the name model = VolumeModel() model.Name = "My test model" # Generate Precipitation data startDate = DateTime.Now for i in range(0,100): currentDateTime = startDate.AddHours(i) model.Precipitation[currentDateTime] = i * 1.0 # convert i to double # Generate drainagebasin for i in range(0,10): newFeature = Feature() offset = i * 100 newFeature.Geometry = GeometryHelper.GetRectangle(0 + offset,0 + offset,100+ offset,100+ offset) model.Basin.Catchments.Add(newFeature) # Add model to project AddToProject(model) # Run the model RunModel(model, True) # Open a view for the model OpenView(model) |
Info |
---|
The comments in the code should explain the different parts of the script. |
Exercise results
Run the script (Ctrl + Enter). After the script has finished running you should see something like this :
Wiki Markup |
---|
{scrollbar} |