Coverage for C:\src\imod-python\imod\msw\infiltration.py: 59%

1 import xarray as xr

2

3 from imod.msw.fixed_format import VariableMetaData

4 from imod.msw.pkgbase import MetaSwapPackage

5

6

7 class Infiltration(MetaSwapPackage):

8 """

9 This contains the infiltration data.

10

11 This class is responsible for the file `infi_svat.inp`

12

13 Parameters

14 ----------

15 infiltration_capacity: array of floats (xr.DataArray)

16 Describes the infiltration capacity of SVAT units. This array must have

17 a subunit coordinate to describe different land uses.

18 downward_resistance: array of floats (xr.DataArray)

19 Describes the downward resisitance of SVAT units. Set to -9999.0 to make

20 MetaSWAP ignore this resistance. This array must not have a subunit

21 coordinate.

22 upward_resistance: array of floats (xr.DataArray)

23 Describes the upward resistance of SVAT units. Set to -9999.0 to make

24 MetaSWAP ignore this resistance. This array must not have a subunit

25 coordinate.

26 bottom_resistance: array of floats (xr.DataArray)

27 Describes the infiltration capacity of SVAT units. Set to -9999.0 to

28 make MetaSWAP ignore this resistance. This array must not have a subunit

29 coordinate.

30 extra_storage_coefficient: array of floats (xr.DataArray)

31 Extra storage coefficient of phreatic layer. This array must not have a

32 subunit coordinate.

33 active: array of bools (xr.DataArray)

34 Describes whether SVAT units are active or not. This array must not have

35 a subunit coordinate.

36 """

37

38 _file_name = "infi_svat.inp"

39 _metadata_dict = {

40 "svat": VariableMetaData(10, 1, 99999999, int),

41 "infiltration_capacity": VariableMetaData(8, 0.0, 1000.0, float),

42 "downward_resistance": VariableMetaData(8, -9999.0, 999999.0, float),

43 "upward_resistance": VariableMetaData(8, -9999.0, 999999.0, float),

44 "bottom_resistance": VariableMetaData(8, -9999.0, 999999.0, float),

45 "extra_storage_coefficient": VariableMetaData(8, 0.01, 1.0, float),

46 }

47

48 _with_subunit = ("infiltration_capacity",)

49 _without_subunit = (

50 "downward_resistance",

51 "upward_resistance",

52 "bottom_resistance",

53 "extra_storage_coefficient",

54 )

55 _to_fill = ()

56

57 def __init__(

58 self,

59 infiltration_capacity: xr.DataArray,

60 downward_resistance: xr.DataArray,

61 upward_resistance: xr.DataArray,

62 bottom_resistance: xr.DataArray,

63 extra_storage_coefficient: xr.DataArray,

64 ):

65 super().__init__()

66 self.dataset["infiltration_capacity"] = infiltration_capacity

67 self.dataset["downward_resistance"] = downward_resistance

68 self.dataset["upward_resistance"] = upward_resistance

69 self.dataset["bottom_resistance"] = bottom_resistance

70 self.dataset["extra_storage_coefficient"] = extra_storage_coefficient

71

72 self._pkgcheck()