top of page

Flood Modeller API | Save time and efforts by creating your own script

By Daisy Lambert, Graduate hydraulic modeller


As a graduate hydraulic modeller with intermediate Python skills, I’ve been given the opportunity to get involved with the flood modeller API. This has been a great experience, a fun challenge, allowed me to further develop my Python skills as well as expand my modelling knowledge. Here, I share my experience of creating a script to convert models from TUFLOW Estry to flood modeller 1D.

For those of you who are not familiar with it, the Flood Modeller API acts as a bridge between the flood modelling software and the Python programming language. By writing your own scripts, you can integrate your own custom tools and workflows to significantly boost your productivity and deliver innovative solutions to your clients by automating different tasks.


If you have ever built a model yourself, you know how repetitive certain tasks can be. Converting a model from one format to another is, in essence, a model build task. When I set out to convert the model, I first listed out the tasks I would need to do:


· Create the river cross sections

· Name the unit

· Add the cross-section profile data

· Add the roughness values

· Add in the distance to next values

· Geospatially locate each unit

· Arrange the network in the correct order


The first five tasks are extremely tedious and will be repeated for every cross section meaning that opportunity for mistakes with manual input is high and automating any of these tasks will save hours of effort! Hence the motivation to build a conversion tool using the Flood Modeller Python API. Thanks to the latest release of the Flood Modeller API and prior knowledge of various Python packages, I was able to write a script to automate the tasks listed above.


In a few seconds, the script allows to convert all the river sections and correctly input the associated data. In my example case, which contains 48 river cross sections, if we assume that each river unit takes 3 minutes to build, we have saved nearly 2.5 hours of effort before considering time taken for checking or breaks.

Converting TUFLOW Estry models to flood modeller 1D

Creating, understanding, and running a script such as the one I have written can represent a barrier preventing many people from using the tool. That’s why a built-in toolbox feature within the Flood Modeller API will soon be available allowing for scripts to be converted to a user-friendly format with prompted inputs. This is the intention with my 1D conversion script. Once it is tested, it will be added to the toolbox so users with less programming skills can use it. Watch this space!

One of the most exciting things about the Flood Modeller API is the fact that it is open source, meaning that anyone can develop their own tools. You can then request these to be merged into the main Flood Modeller API or you can keep these for internal use only.

Additionally, if there is a tool or a component of the API you would like to see developed but do not have the ability to do it yourself, we encourage you to submit your ideas via the Flood Modeller GitHub page and it could be developed for future releases!


First-time user?

Explore the GitHub Codespace which allows you to access training material to get to grips with the basics of both Python programming and the features of the Flood Modeller API.


Want to know more about the API?

Read more about the Flood Modeller API or join our API experts for a live webinar where they will provide a comprehensive overview of Flood Modeller's Python API, and demonstrate how it can help you streamline processes and drive innovation for your business.

Комментарии


bottom of page