You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We realised the following limitation when adding the land-use type SEALED to H-Land (see #71).
Our masks are 1-dimensional boolean arrays, thought to indicate which values of another 1-dimensional array (of a Variable object) are relevant. Combining them with parameters defining the spatial extent of the different array entries, one can calculate spatial averages. However, we so far cannot apply masks on 0-dimensional variables. Many scalar variables (for example, UZ) represent only a fraction of a subbasin. Hence, if we want to average UZ over multiple subbasins, we need to take their sizes and the UZ fractions into account. So far, there is no general way to query the fractions (the same holds for the total subbasin size, but we discuss this in #66 separately).
My suggestion is to allow assigning 1-dimensional masks to 0-dimensional variables and to define a sum_values method that works similar to the average_values method. The sum_values method uses the mask to select the relevant sub-extents (in our example, the size of all zones that lie above the upper zone layer) and sums them to gain the appropriate UZ fraction.
Besides that: we will soon introduce snow classes to H-Land (see #70), which will require making sequences like SP 2-dimensional. All snow classes of the same zone will have the same size so that 1-dimensional masks can provide all relevant information. But we need to tell average_values (and sum_values) how to handle such cases.
Besides that: we will soon introduce snow classes to H-Land (see #70), which will require making sequences like SP 2-dimensional. All snow classes of the same zone will have the same size so that 1-dimensional masks can provide all relevant information. But we need to tell average_values (and sum_values) how to handle such cases.
While working on #188, I realised that the current functionalities for averaging the values of some parameter and all sequence values of submodels were very limited. I improved this by adjusting IndexMask and SubmodelIndexMask in (fe0d64d) and additionally by making the masks of HydPy-Evap directly available to all its application models (0bce3d6). This should be sufficient for most use cases. However, I think it would be way cooler if one could also apply the masks of the respective main model. This would be consistent with the general "configuration sharing" mechanisms between main models and submodels. And it would simplify comparing related states or fluxes of the same subareas of a subbasin.
I think implementing this would be possible but not trivial, because different masks of one model can be connected with different index parameters (land use type vs soil type). No priority right now, but I leave this note as a reminder or for further discussion.
Activity
tyralla commentedon Aug 9, 2026
We solved this in commit 64b4ca4 by introducing the property Variable.valuevector.
tyralla commentedon Aug 9, 2026
While working on #188, I realised that the current functionalities for averaging the values of some parameter and all sequence values of submodels were very limited. I improved this by adjusting IndexMask and SubmodelIndexMask in (fe0d64d) and additionally by making the masks of HydPy-Evap directly available to all its application models (0bce3d6). This should be sufficient for most use cases. However, I think it would be way cooler if one could also apply the masks of the respective main model. This would be consistent with the general "configuration sharing" mechanisms between main models and submodels. And it would simplify comparing related states or fluxes of the same subareas of a subbasin.
I think implementing this would be possible but not trivial, because different masks of one model can be connected with different index parameters (land use type vs soil type). No priority right now, but I leave this note as a reminder or for further discussion.