hydpy-dev / hydpy

A framework for the development and application of hydrological models based on Python
GNU Lesser General Public License v3.0
35 stars 17 forks source link

Allow coupling HydPy-PET-AMBAV-1.0 to HydPy-W #123

Closed tyralla closed 8 months ago

tyralla commented 9 months ago

HydPy-W currently only supports using evaporation submodels that comply with the PETModel_V1 interface, not the newer PETModel_V2 interface introduced for HydPy-PET-AMBAV-1.0. We have agreed to remedy this deficit.

Conceptionally, everything is clear (hopefully). Still, we have the situation that HydPy-W uses two submodels, one for potential evapotranspiration from the different HRUs and one for potential evaporation from the single surface water storage. Maybe this separation does not fit with an interface like PETModel_V2 that already calculates different evaporation values for water and land areas. So, the first step will be to check if we can merge both submodel usages into one without too much trouble. (We would lose some flexibility, of course, but increase consistency with other models and simplify using HydPy-W).

tyralla commented 9 months ago

I did some experiments and came to the preliminary impression that merging both submodel usages is the right choice but becomes complicated without adjusting the structure of HydPy-W.

My first idea was to make all 1-dimensional Evap parameters and sequences one entry longer than the corresponding W parameters and sequences, which seems technically possible with moderate effort but would be burdensome for users.

Hence, I now even tend to increase the length of all 1-dimensional W parameters and sequences by one. Then, the first or the last entry would always be reserved for the surface water storage. As far as I can see now, the only unusual thing would be that one would always have to define this "land type" precisely for one subarea, while models like HydPy-H and HydPy-L allow for an arbitrary number of water areas. But this is due to a conventional difference between these models and thus seems justified.

tyralla commented 9 months ago

I merged both submodel usages accompanied by changing the structure of W in a quick-and-dirty fashion, and no integration test result seems to be violated. Nevertheless, some work is still required to finalise the code changes and update the documentation. Here, I collect the relevant to-dos:

tyralla commented 9 months ago

To enable HydPy-W using submodels that comply with the PETModel_V2 interface requires replacing the general potential evapotranspiration sequence PET with two or three more specific sequences that deal with the potential values of interception evaporation, evapotranspiration from the vadose zone, and evaporation from water areas.

My first idea was to introduce PEI, PETV, and PES for these three components. PEI and PETV would have to be 1-dimensional to store one value per hydrological response unit and PES 0-dimensional to store the single value for the surface water storage. But then, PEI and PETV would have to be shorter than all other 1-dimensional sequences or always have zero values in their last field.

Now, I prefer a two-sequence solution. PE would handle values for potential interception and water area evaporation, while PET would only deal with potential evapotranspiration from the vadose zone. Then, the fields of PE were relevant for all land types, and those of PET were generally zero for sealed areas and water areas.

Unless someone objects, I go for the second approach.

tyralla commented 9 months ago

We need to extend method Calc_ETV_V1 so that it can handle different values for potential interception evaporation and potential evapotranspiration from the vadose zone. This is a problem we already encountered when coupling Evap-AMBAV to Evap-Minhas. Hence, we can reuse the logic discussed here:

$$ ETV = \sum_{i=1}^{NUL} \left( \frac{AUR_i}{AGR} \cdot \frac{PE_i - EI_i}{PE_i} \cdot PET_i \cdot \begin{cases} 0 &|\ LT_i = SEALED \ Beta &|\ LT_i \neq SEALED \end{cases} \right) $$

tyralla commented 8 months ago

Implemented, all tests passed, already in master!