Coverage for fixtures\mf6_welltest_fixture.py: 100%

1 import numpy as np

2 import pandas as pd

3 import pytest

4 import xarray as xr

5

6

7@pytest.fixture(scope="session")

8 def mf6wel_test_data_stationary():

9 cellid_values = np.array(

10 [

11 [1, 1, 9],

12 [1, 2, 9],

13 [1, 1, 8],

14 [1, 2, 8],

15 [2, 3, 7],

16 [2, 4, 7],

17 [2, 3, 6],

18 [2, 4, 6],

19 ],

20 )

21 coords = {"ncellid": np.arange(8) + 1, "nmax_cellid": ["layer", "row", "column"]}

22 cellid = xr.DataArray(cellid_values, coords=coords, dims=("ncellid", "nmax_cellid"))

23 rate = xr.DataArray(

24 [1.0] * 8, coords={"ncellid": np.arange(8) + 1}, dims=("ncellid",)

25 )

26 return cellid, rate

27

28

29@pytest.fixture(scope="session")

30 def mf6wel_test_data_transient():

31 cellid_values = np.array(

32 [

33 [1, 1, 9],

34 [1, 2, 9],

35 [1, 1, 8],

36 [1, 2, 8],

37 [2, 3, 7],

38 [2, 4, 7],

39 [2, 3, 6],

40 [2, 4, 6],

41 ],

42 )

43 coords = {"ncellid": np.arange(8) + 1, "nmax_cellid": ["layer", "row", "column"]}

44 cellid = xr.DataArray(cellid_values, coords=coords, dims=("ncellid", "nmax_cellid"))

45

46 rate = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

47

48 globaltimes = pd.date_range("2000-01-01", "2000-01-06")

49 weltimes = globaltimes[:-1]

50

51 rate_time = xr.DataArray(

52 np.arange(len(weltimes)) + 1, coords={"time": weltimes}, dims=("time",)

53 )

54 rate_cells = xr.DataArray(

55 rate, coords={"ncellid": np.arange(8) + 1}, dims=("ncellid",)

56 )

57 rate_wel = rate_time * rate_cells

58

59 return cellid, rate_wel

60

61

62@pytest.fixture(scope="session")

63 def well_high_lvl_test_data_stationary():

64 screen_top = [0.0, 0.0, 0.0, 0.0, -6.0, -6.0, -6.0, -6.0]

65 screen_bottom = [-2.0, -2.0, -2.0, -2.0, -20.0, -20.0, -20.0, -20.0]

66 # fmt: off

67 y = [83.0, 77.0, 82.0, 71.0, 62.0, 52.0, 66.0, 59.0]

68 x = [81.0, 82.0, 75.0, 77.0, 68.0, 64.0, 52.0, 51.0]

69 # fmt: on

70 rate = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

71 rate_wel = xr.DataArray(rate, dims=("index",))

72

73 da_species = xr.DataArray(

74 [10, 23],

75 coords={"species": ["salinity", "temparature"]},

76 dims=("species",),

77 )

78

79 concentration = da_species * rate_wel

80

81 return x, y, screen_top, screen_bottom, rate_wel, concentration

82

83

84@pytest.fixture(scope="session")

85 def well_high_lvl_test_data_transient():

86 screen_top = [0.0, 0.0, 0.0, 0.0, -6.0, -6.0, -6.0, -6.0]

87 screen_bottom = [-2.0, -2.0, -2.0, -2.0, -20.0, -20.0, -20.0, -20.0]

88 # fmt: off

89 y = [83.0, 77.0, 82.0, 71.0, 62.0, 52.0, 66.0, 59.0]

90 x = [81.0, 82.0, 75.0, 77.0, 68.0, 64.0, 52.0, 51.0]

91 # fmt: on

92 rate = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

93

94 globaltimes = pd.date_range("2000-01-01", "2000-01-06")

95 weltimes = globaltimes[:-1]

96

97 rate_time = xr.DataArray(

98 np.arange(len(weltimes)) + 1, coords={"time": weltimes}, dims=("time",)

99 )

100 rate_cells = xr.DataArray(rate, dims=("index",))

101 rate_wel = rate_time * rate_cells

102

103 da_species = xr.DataArray(

104 [10, 23],

105 coords={"species": ["salinity", "temparature"]},

106 dims=("species",),

107 )

108

109 concentration = da_species * rate_wel

110

111 return x, y, screen_top, screen_bottom, rate_wel, concentration

112

113

114@pytest.fixture(scope="session")

115 def well_test_data_stationary():

116 layer = np.array([3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])

117 row = np.array([5, 4, 6, 9, 9, 9, 9, 11, 11, 11, 11, 13, 13, 13, 13])

118 column = np.array([11, 6, 12, 8, 10, 12, 14, 8, 10, 12, 14, 8, 10, 12, 14])

119 rate = np.full(15, 5.0)

120 injection_concentration = np.full((15, 2), np.NaN)

121 injection_concentration[:, 0] = 123 # salinity

122 injection_concentration[:, 1] = 456 # temperature

123 return layer, row, column, rate, injection_concentration

124

125

126@pytest.fixture(scope="session")

127 def well_test_data_transient():

128 layer = np.array([3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])

129 row = np.array([5, 4, 6, 9, 9, 9, 9, 11, 11, 11, 11, 13, 13, 13, 13])

130 column = np.array([11, 6, 12, 8, 10, 12, 14, 8, 10, 12, 14, 8, 10, 12, 14])

131 times = np.array(["2000-01-01", "2000-02-01"], dtype="datetime64[ns]")

132 rate = xr.DataArray(

133 np.full((2, 15), 5.0), coords={"time": times}, dims=["time", "index"]

134 )

135 injection_concentration = np.full((2, 15, 2), np.NaN)

136 injection_concentration[0, :, 0] = 123 # salinity, time 0

137 injection_concentration[0, :, 1] = 456 # temperature, time 0

138 injection_concentration[1, :, 0] = 246 # salinity, time 1

139 injection_concentration[1, :, 1] = 135 # temperature, time 1

140 return layer, row, column, times, rate, injection_concentration