@@ -49,44 +49,12 @@ def test_init_gwf_explicit_dims():
4949 )
5050
5151 assert isinstance (gwf .data , DataTree )
52- assert gwf .dis is dis
52+ assert gwf .dis is not dis # dimension order switched.. is this ok?
5353 assert gwf .ic is ic
5454 assert gwf .oc is oc
5555 assert gwf .npf is npf
5656 assert gwf .chd [0 ] is chd
57- assert gwf .data .dis is dis .data
58- assert gwf .data .ic is ic .data
59- assert gwf .data .oc is oc .data
60- assert gwf .data .npf is npf .data
61- assert np .array_equal (npf .k , np .ones (4 ))
62- assert np .array_equal (npf .data .k , np .ones (4 ))
63-
64-
65- @pytest .mark .skip (reason = "TODO" )
66- def test_init_gwf_from_grid ():
67- time = ModelTime (perlen = [1.0 ], nstp = [1 ], tsmult = [1.0 ])
68- grid = StructuredGrid (nlay = 1 , nrow = 2 , ncol = 2 )
69- dis = Dis (grid = grid )
70- ic = Ic (grid = grid )
71- oc = Oc (grid = grid )
72- npf = Npf (grid = grid )
73- chd = Chd (grid = grid )
74- gwf = Gwf (
75- dis = dis ,
76- ic = ic ,
77- oc = oc ,
78- npf = npf ,
79- chd = [chd ],
80- grid = grid ,
81- )
82-
83- assert isinstance (gwf .data , DataTree )
84- assert gwf .dis is dis
85- assert gwf .ic is ic
86- assert gwf .oc is oc
87- assert gwf .npf is npf
88- assert gwf .chd [0 ] is chd
89- assert gwf .data .dis is dis .data
57+ assert gwf .data .dis is not dis .data
9058 assert gwf .data .ic is ic .data
9159 assert gwf .data .oc is oc .data
9260 assert gwf .data .npf is npf .data
@@ -138,7 +106,7 @@ def test_init_gwf_dis_first():
138106 chd = Chd (parent = gwf , strict = False )
139107
140108 assert isinstance (gwf .data , DataTree )
141- assert gwf .dis is dis
109+ assert gwf .dis is not dis
142110 assert gwf .ic is ic
143111 assert gwf .oc is oc
144112 assert gwf .npf is npf
@@ -147,6 +115,25 @@ def test_init_gwf_dis_first():
147115 assert np .array_equal (npf .data .k , np .ones (4 ))
148116
149117
118+ def test_init_gwf_dis_first_with_grid ():
119+ grid = StructuredGrid (nlay = 1 , nrow = 10 , ncol = 10 )
120+ gwf = Gwf (dis = grid )
121+ dis = gwf .dis
122+ ic = Ic (parent = gwf )
123+ oc = Oc (parent = gwf , strict = False )
124+ npf = Npf (parent = gwf )
125+ chd = Chd (parent = gwf , strict = False )
126+
127+ assert isinstance (gwf .data , DataTree )
128+ assert gwf .dis is dis
129+ assert gwf .ic is ic
130+ assert gwf .oc is oc
131+ assert gwf .npf is npf
132+ assert gwf .chd [0 ] is chd
133+ assert np .array_equal (npf .k , np .ones (100 ))
134+ assert np .array_equal (npf .data .k , np .ones (100 ))
135+
136+
150137def test_init_gwf_top_down_misaligned ():
151138 grid = StructuredGrid (nlay = 1 , nrow = 10 , ncol = 10 )
152139 dims = {
@@ -198,7 +185,7 @@ def test_init_sim_explicit_dims():
198185 assert isinstance (sim .data , DataTree )
199186 assert sim .data .tdis is tdis .data
200187 assert sim .data .gwf is gwf .data
201- assert gwf .dis is dis
188+ assert gwf .dis is not dis # gwf.dis has inherited dim nper
202189 assert gwf .ic is ic
203190 assert gwf .oc is oc
204191 assert gwf .npf is npf
@@ -219,35 +206,16 @@ def test_init_big_sim():
219206 # if size over threshold, arrays should be sparse
220207 time = ModelTime (perlen = [1.0 ], nstp = [1 ], tsmult = [1.0 ])
221208 grid = StructuredGrid (nlay = 1 , nrow = 100 , ncol = 100 )
222- dims = {
223- "nlay" : grid .nlay ,
224- "nrow" : grid .nrow ,
225- "ncol" : grid .ncol ,
226- }
227- dis = Dis (** dims )
228- dims ["nper" ] = time .nper
229- dims ["nnodes" ] = grid .nnodes
230- ic = Ic (dims = dims )
231- oc = Oc (dims = dims )
232- npf = Npf (dims = dims )
233- chd = Chd (dims = dims , head = {"*" : {(0 , 0 , 0 ): 1.0 , (0 , 99 , 99 ): 0.0 }})
234- gwf = Gwf (
235- dis = dis ,
236- ic = ic ,
237- oc = oc ,
238- npf = npf ,
239- chd = [chd ],
240- dims = dims ,
241- )
242- tdis = Tdis (dims = dims )
243- sim = Simulation (tdis = tdis , models = {"gwf" : gwf })
209+ sim = Simulation (tdis = time )
210+ gwf = Gwf (parent = sim , dis = grid )
211+ ic = Ic (parent = gwf )
212+ oc = Oc (parent = gwf )
213+ npf = Npf (parent = gwf )
214+ chd = Chd (parent = gwf , head = {"*" : {(0 , 0 , 0 ): 1.0 , (0 , 99 , 99 ): 0.0 }})
244215
245- assert sim .tdis is tdis
246216 assert sim .models ["gwf" ] is gwf
247217 assert isinstance (sim .data , DataTree )
248- assert sim .data .tdis is tdis .data
249218 assert sim .data .gwf is gwf .data
250- assert gwf .dis is dis
251219 assert gwf .ic is ic
252220 assert gwf .oc is oc
253221 assert gwf .npf is npf
0 commit comments