Coverage for C:\src\imod-python\imod\wq\chd.py: 39%

18 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-08 10:26 +0200

1from imod.wq.pkgbase import BoundaryCondition 

2 

3 

4class ConstantHead(BoundaryCondition): 

5 """ 

6 The Constant Head package. The Time-Variant Specified-Head package is used 

7 to simulate specified head boundaries that can change within or between 

8 stress periods. 

9 

10 Parameters 

11 ---------- 

12 head_start: xr.DataArray of floats 

13 is the head at the boundary at the start of the stress period. 

14 head_end: xr.DataArray of floats 

15 is the head at the boundary at the end of the stress period. 

16 concentration: xr.DataArray of floats 

17 concentrations for the constant heads. It gets automatically written to 

18 the SSM package. 

19 save_budget: bool, optional 

20 is a flag indicating if the budget should be saved (ICHDCB). 

21 Default is False. 

22 """ 

23 

24 _pkg_id = "chd" 

25 _mapping = (("shead", "head_start"), ("ehead", "head_end")) 

26 

27 def __init__(self, head_start, head_end, concentration, save_budget=False): 

28 super().__init__() 

29 self["head_start"] = head_start 

30 self["head_end"] = head_end 

31 self["concentration"] = concentration 

32 self["save_budget"] = save_budget 

33 

34 def _pkgcheck(self, ibound=None): 

35 self._check_positive(["concentration"]) 

36 self._check_location_consistent(["head_start", "head_end", "concentration"]) 

37 

38 def repeat_stress(self, head_start=None, head_end=None, use_cftime=False): 

39 varnames = ["head_start", "head_end"] 

40 values = [head_start, head_end] 

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

42 self._repeat_stress(varname, value, use_cftime)