EGU General Assembly 2020
© Author(s) 2021. This work is distributed under
the Creative Commons Attribution 4.0 License.

SuperflexPy: a new open source framework for building conceptual hydrological models

Marco Dal Molin1,2, Dmitri Kavetski1,3, and Fabrizio Fenicia1
Marco Dal Molin et al.
  • 1EAWAG, SIAM, Dübendorf, Switzerland (
  • 2Centre of Hydrogeology and Geothermics (CHYN), University of Neuchatel, Neuchatel, Switzerland
  • 3School of Civil, Environmental and Mining Engineering, University of Adelaide, Adelaide, Australia

Hydrological models represent a fundamental tool for linking data with theories in scientific studies. Conceptual models are among the most frequently used type of models in catchment scale studies, due to their low computational requirements and ease of interpretation. Model selection requires the comparison of model alternatives, which is complicated by differences in conceptualization, implementation, and source code availability of the models present in the literature. For this reason, several model-building frameworks have been introduced in the last decade, which facilitate model comparisons by enabling different model alternatives within the same software and numerical architecture. These frameworks, however, have their own limitations, including the difficulty of extension from a user perspective, the requirement of long set-up procedures, and the need of customized input files.
Building on the decennial experience with the development and usage of Superflex, a flexible modeling framework for conceptual model building, so far implemented in FORTRAN language and not available as open source, we propose SuperflexPy, an open source Python framework for building conceptual hydrological models. SuperflexPy allows the user to build fully customized models using generic elements (i.e. reservoirs, splitters, junctions, lag functions, etc.) and to arrange them as desired, for example to reflect lumped or semi-distributed model configurations. SuperflexPy is easy to configure through modular initialization scripts, easy to extend with custom functionalities, and easy to interface with other frameworks, making it an essential element for creating a continuous and reproducible pipeline that goes from raw data to model results and interpretation.
In this presentation, we will introduce this framework, showcasing some applications and highlighting its potential in the context of open science.

How to cite: Dal Molin, M., Kavetski, D., and Fenicia, F.: SuperflexPy: a new open source framework for building conceptual hydrological models, EGU General Assembly 2020, Online, 4–8 May 2020, EGU2020-5110,, 2020

Display materials

Display file

Comments on the display material

AC: Author Comment | CC: Community Comment | Report abuse

Display material version 1 – uploaded on 01 May 2020
  • CC1: Hello Marco, Riccardo Rigon, 03 May 2020

    How does it works ? When will you be presenting ?


    • AC1: Reply to CC1, Marco Dal Molin, 04 May 2020

      Hi Riccardo.

      We have the session on Monday afternoon but it is not clear to me if and how we will present it.

      Anyway, since the session is quite generic, we decided to not go into the details in the slides. We are currently creating the documentation of the model (it will be soon available at the link ) that should explain the functioning of the framework.

      The general idea is to release the documentation and the updates to the code only when they are completed. We don't want to release work-in-progress versions. If someone is interested in using the framework right now and wants to know more (and get work-in-progress versions of code and documentation) can contact the authors by e-mail.

      Thank you for the interest.

  • CC2: Question on SuperFlexPy, Nicola Di Marco, 04 May 2020

    Hi Marco, very nice presentation.

    One question: does the proposed framework account for human disturbances on a catchment? Hydropower reservoirs for instance.

    If not, are you planning to implement such impacts on natural hydrological cycle?



    • AC2: Reply to CC2, Marco Dal Molin, 05 May 2020

      Hi Nicola. Thank you for your interest.

      As I said to Riccardo, it is difficult to explain how the framework actually works without giving you a proper documentation, and I am sorry for that. The documentation is almost ready and it will be published soon at the link . If you go there now, you can subscribe to a mailing list so we will send you an e-mail when there are updates.

      Regarding to your question on hydropower plants: right now we haven't implemented them explicitly as part of the framework but, as you will see after reading the documentation, the main purpose of the framework is to provide an infrastructure that makes easier for a modeler to implement customized elements. While we will provide the implementation of some common elements present in popular conceptual models (e.g. GR4J), the framework has not to be intended as a collection of elements.

      Therefore, I think that the framework can accommodate easily the simulation of man-made infrastructures. It has to be discussed and clarified which would be the proper format (e.g. represent the infrastructure as an element inside the lumped model structure, or as a subcatchment alone, etc.)

      Anyway, I will be happy to continue this discussion once the documentation is out.

      • CC3: Reply to AC2, Nicola Di Marco, 05 May 2020

        Thank you very much Marco, I will follow the progress of your framework!


  • CC4: Integration FORTRAN-Python, Juan Colonese, 05 May 2020

    Hello Marco,

    I'm currently working on a project with similar goal: integrate some models implemented in FORTRAN in one framework using Python. Did you coded the models in the python package or did you integrate the legacy FORTRAN code? If so, what was your approach to this integration? used numpy, extensions or any other?

    Look foward to give superflexpy a try!


    Juan Colonese

    • AC3: Reply to CC4, Marco Dal Molin, 05 May 2020


      We decided to go for a complete new implementation since libraries like numpy and numba give us enough speed and compromise less on flexibility.

      If the fortran code is simple you can use f2py to interface python with Fortran but you may need to modify your Fortran code.

      • CC5: Reply to AC3, Juan Colonese, 05 May 2020

        Ok, thanks for the answer. We were debating about this and came for f2py as well. I would personally go for it as you did, but there some proprietary issues in company's FORTRAN code. 

        Thanks Marco and I'll certainly follow up your work.