@@ -140,6 +140,62 @@ def test_init_sim_explicit_dims():
140140 assert np .array_equal (sim .models ["gwf" ].npf .data .k , np .ones (100 ))
141141 assert chd .head [0 , 0 ] == 1.0
142142 assert chd .head [0 , 99 ] == 0.0
143- assert np .array_equal (chd .head [0 , 1 :99 ], np .full ((98 ,), FILL_DNODATA ))
144- assert np .array_equal (chd .head , chd .data .head )
145- assert np .array_equal (chd .head , sim .models ["gwf" ].chd [0 ].data .head )
143+ assert np .array_equal (chd .head [0 , 1 :99 ].data , np .full ((98 ,), FILL_DNODATA ))
144+ assert np .array_equal (chd .head .data , chd .data .head .data )
145+ assert np .array_equal (
146+ chd .head .data ,
147+ sim .models ["gwf" ].chd [0 ].data .head .data ,
148+ )
149+
150+
151+ def test_init_big_sim ():
152+ # if size over threshold, arrays should be sparse
153+ time = ModelTime (perlen = [1.0 ], nstp = [1 ], tsmult = [1.0 ])
154+ grid = StructuredGrid (nlay = 1 , nrow = 100 , ncol = 100 )
155+ dims = {
156+ "nlay" : grid .nlay ,
157+ "nrow" : grid .nrow ,
158+ "ncol" : grid .ncol ,
159+ }
160+ dis = Dis (** dims )
161+ dims ["nper" ] = time .nper
162+ dims ["nnodes" ] = grid .nnodes
163+ ic = Ic (dims = dims )
164+ oc = Oc (dims = dims )
165+ npf = Npf (dims = dims )
166+ chd = Chd (dims = dims , head = {"*" : {(0 , 0 , 0 ): 1.0 , (0 , 99 , 99 ): 0.0 }})
167+ gwf = Gwf (
168+ dis = dis ,
169+ ic = ic ,
170+ oc = oc ,
171+ npf = npf ,
172+ chd = [chd ],
173+ dims = dims ,
174+ )
175+ tdis = Tdis (dims = dims )
176+ sim = Simulation (tdis = tdis , models = {"gwf" : gwf })
177+
178+ assert sim .tdis is tdis
179+ assert sim .models ["gwf" ] is gwf
180+ assert isinstance (sim .data , DataTree )
181+ assert sim .data .tdis is tdis .data
182+ assert sim .data .gwf is gwf .data
183+ assert gwf .dis is dis
184+ assert gwf .ic is ic
185+ assert gwf .oc is oc
186+ assert gwf .npf is npf
187+ assert gwf .chd [0 ] is chd
188+ assert np .array_equal (sim .models ["gwf" ].npf .k , np .ones (10000 ))
189+ assert np .array_equal (sim .models ["gwf" ].npf .data .k , np .ones (10000 ))
190+ assert chd .head [0 , 0 ] == 1.0
191+ assert chd .head [0 , 9999 ] == 0.0
192+ assert np .array_equal (
193+ chd .head [0 , 1 :9999 ].data .todense (), np .full ((9998 ,), FILL_DNODATA )
194+ )
195+ assert np .array_equal (
196+ chd .head .data .todense (), chd .data .head .data .todense ()
197+ )
198+ assert np .array_equal (
199+ chd .head .data .todense (),
200+ sim .models ["gwf" ].chd [0 ].data .head .data .todense (),
201+ )
0 commit comments