unifhy-org / unifhy

A Unified Framework for Hydrology
https://unifhy-org.github.io/unifhy
BSD 3-Clause "New" or "Revised" License
11 stars 5 forks source link

Add support for pre-processing in `initialise` method #75

Closed ThibHlln closed 2 years ago

ThibHlln commented 2 years ago

The framework was not offering the component contributor with the opportunity to perform pre-processing tasks in initialise and use the outcome of these in e.g. run. The initialise method was dedicated to providing initial conditions for the component states, and only called if the states initial conditions were not already set by the component user (through a dump file).

To remedy this, the Component must feature an attribute to store pre-processed data in initialise accessible in run. In turn, this means that the initialise method will be called regardless of the status of the component states (i.e. initialised or not), so there needs to be another Component property to tell the component contributor whether this is the case. Finally, as part of the pre-processing, the initialise method is likely to require access to "ancillary" data. Since ancillary data is part of the component inputs alongside the driving data, the component inputs must be given to the initialise method too.

This PR implements the following:

Note that states are either all considered initialised or none considered initialised, there is no in between (i.e. initialise some states from dump and some states from default contributor value).