Skip to content

Additional mask-related functionalities #72

@tyralla

Description

@tyralla

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions