Coverage for C:\src\imod-python\imod\wq\drn.py: 88%

17 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-08 14:15 +0200

1from imod.wq.pkgbase import BoundaryCondition 

2 

3 

4class Drainage(BoundaryCondition): 

5 """ 

6 The Drain package is used to simulate head-dependent flux boundaries. In the 

7 Drain package if the head in the cell falls below a certain threshold, the 

8 flux from the drain to the model cell drops to zero. 

9 

10 Parameters 

11 ---------- 

12 elevation: float or xr.DataArray of floats 

13 elevation of the drain. 

14 conductance: float or xr.DataArray of floats 

15 is the conductance of the drain. 

16 save_budget: bool, optional 

17 A flag that is used to determine if cell-by-cell budget data should be 

18 saved. If save_budget is True cell-by-cell budget data will be saved. 

19 Default is False. 

20 """ 

21 

22 _pkg_id = "drn" 

23 

24 _mapping = (("elevation", "elevation"), ("cond", "conductance")) 

25 

26 def __init__(self, elevation, conductance, save_budget=False): 

27 super().__init__() 

28 self["elevation"] = elevation 

29 self["conductance"] = conductance 

30 self["save_budget"] = save_budget 

31 

32 def _pkgcheck(self, ibound=None): 

33 self._check_positive(["conductance"]) 

34 self._check_location_consistent(["elevation", "conductance"]) 

35 

36 def repeat_stress(self, elevation=None, conductance=None, use_cftime=False): 

37 varnames = ["elevation", "conductance"] 

38 values = [elevation, conductance] 

39 for varname, value in zip(varnames, values): 

40 self._repeat_stress(varname, value, use_cftime)