Coverage for C:\src\imod-python\imod\wq\ghb.py: 29%

1 from imod.wq.pkgbase import BoundaryCondition

2

3# class GeneralHeadBoundaryGroup(object):

4# Does a groupby over packages of the same kind when writing

5# Collects total data of all same kind packages

6# adds a system number

7# This one is actually in charge of generating the output from

8# the dictionaries provided by the ._compose_values methods

9# Every system is treated independently

10

11

12 class GeneralHeadBoundary(BoundaryCondition):

13 """

14 The General-Head Boundary package is used to simulate head-dependent flux

15 boundaries. In the General-Head Boundary package the flux is always

16 proportional to the difference in head.

17

18 Parameters

19 ----------

20 head: float or xr.DataArray of floats

21 head value for the GHB (BHEAD).

22 conductance: float or xr.DataArray of floats

23 the conductance of the GHB (COND).

24 density: float or xr.DataArray of floats

25 is the density used to convert the point head to the freshwater head

26 (GHBSSMDENS).

27 concentration: "None" or xr.DataArray of floats, optional

28 concentration of the GHB (CGHB), get automatically inserted into the SSM

29 package.

30 Default is "None".

31 save_budget: bool, optional

32 is a flag indicating if the budget should be saved (IGHBCB).

33 Default is False.

34 """

35

36 _pkg_id = "ghb"

37 _mapping = (("bhead", "head"), ("cond", "conductance"), ("ghbssmdens", "density"))

38

39 def __init__(

40 self, head, conductance, density, concentration=None, save_budget=False

41 ):

42 super().__init__()

43 self["head"] = head

44 self["conductance"] = conductance

45 self["density"] = density

46 if concentration is not None:

47 self["concentration"] = concentration

48 self["save_budget"] = save_budget

49

50 def _pkgcheck(self, ibound=None):

51 to_check = ["conductance", "density"]

52 if "concentration" in self.dataset.data_vars:

53 to_check.append("concentration")

54 self._check_positive(to_check)

55

56 to_check.append("head")

57 self._check_location_consistent(to_check)

58

59 def repeat_stress(

60 self,

61 head=None,

62 conductance=None,

63 density=None,

64 concentration=None,

65 use_cftime=False,

66 ):

67 varnames = ["head", "conductance", "density", "concentration"]

68 values = [head, conductance, density, concentration]

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

70 self._repeat_stress(varname, value, use_cftime)