-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn all Meteo models into "real" submodels #124
Comments
This is my first draft of the interface: class RadiationModel_V1(modeltools.SubmodelInterface):
"""Simple interface for determining all data in one step."""
@modeltools.abstractmodelmethod
def determine_data(self) -> None:
"""Read and calculate all eventually required data."""
@modeltools.abstractmodelmethod
def get_potentialsunshineduration(self) -> float:
"""Get the potential sunshine duration in h."""
@modeltools.abstractmodelmethod
def get_sunshineduration(self) -> float:
"""Get the sunshine duration in h."""
@modeltools.abstractmodelmethod
def get_clearskysolarradiation(self) -> float:
"""Get the clear sky solar radiation in W/m²."""
@modeltools.abstractmodelmethod
def get_globalradiation(self) -> float:
"""Get the global radiation in W/m².""" I think it should be only a little effort to let all submodels support this interface. @sivogel: The get methods would cover all currently relevant cases, wouldn't they? |
Here I try to list all models that require such data as input and hence should be able to use the new interface:
|
I agree with you. These are all the use cases that I can think of. |
The list above reveals we currently must serve three data requirement combinations:
How do we supply measured or preprocessed data? It does not seem like a straightforward idea to define individual IO interfaces and submodels for each property ( The obvious solution seems to define three interfaces and submodels ( My first impression is that the second solution causes less work and hopefully fewer ambiguities. |
All radiation-related Meteo models are now "true" submodels and can be used by all main models listed above. For this purpuse, I had to make meteo_v003 and meteo_v004 also calculate ClearSkySolarRadiation. The found solution leads to reasonable results in all currently available integration tests. However, evaluations based on practical applications are still outstanding. So, it is time to focus on the mentioned problem of the need (or, at least, the strong desire) to use the same Meteo submodel instance twice. It does not seem to make any sense to support the from hydpy.models.lland_v3 import *
...
with model.add_radiationmodel_v1("meteo_v003") as meteo_v003:
...
with model.add_aetmodel_v1("evap_morsim"):
...
model.add_radiationmodel_v1(meteo_v003) Second, I suggest adding the class Not all submodels are sharable, and model users might find it hard to see which one is. Hence, my third suggestion is to introduce I first favoured the name The pure-Python prototype is already working, except for the automatic writing of control files. If there are no alternative ideas, I will start working on this and the required Cython functionalities soon. |
Cythonized models now work, too. I also added the Hence, I consider this issue complete and merge all new features into the master branch. |
This is a follow-up to #81, which dealt with extracting the calculation of global radiation and sunshine duration from larger models. Unfortunately, we did so before introducing the submodel concept. So, our HydPy-Meteo submodels currently only work as stand-alone models, not as submodels in the sense of #90. This is the reason for the unfavourable situation that, for example, HydPy-L uses HydPy-MORSIM as a "real" submodel, but HydPy-MORSIM needs to be connected to HydPy-Meteo_V1 via the old node-based mechanism.
I hope we will not require many discussions because the main functionalities of all Meteo models are already available. The only problematic point I see coming is that one might wish to use the same Meteo submodel instance twice, for example, for calculating global radiation for the snow routines of HydPy-L and the evaporation submodel used by HydPy-L, which is currently only possible when using the old node-based mechanism.
The text was updated successfully, but these errors were encountered: