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 special component attribute to allow `initialise` to pass information to `run` #68

Closed ThibHlln closed 2 years ago

ThibHlln commented 2 years ago

There will be some data processing/crunching that can be done only once during a given simulation. This would typically be done in the initialise method of Component, then the information could be used in its run method as often as required. However, at the moment the only information that can be passed between initialise and run are the states initial conditions. The easiest way to make this possible would be to give Component a new attribute, e.g. called extra, pointing to a dictionary in which the component contributor can store any information they want computed once during the initialise call and retrieve it from this dictionary in run or even finalise.