@@ -2334,7 +2334,7 @@ def test_remove_model(function_tmpdir, example_data_path):
2334
2334
2335
2335
@requires_pkg ("shapely" )
2336
2336
@requires_exe ("triangle" )
2337
- def test_flopy_2283 (function_tmpdir ):
2337
+ def test_issue_2283 (function_tmpdir ):
2338
2338
# create triangular grid
2339
2339
triangle_ws = function_tmpdir / "triangle"
2340
2340
triangle_ws .mkdir ()
@@ -2384,3 +2384,82 @@ def test_flopy_2283(function_tmpdir):
2384
2384
assert gwf .modelgrid .xoffset == disv .xorigin .get_data ()
2385
2385
assert gwf .modelgrid .yoffset == disv .yorigin .get_data ()
2386
2386
assert gwf .modelgrid .angrot == disv .angrot .get_data ()
2387
+
2388
+
2389
+ @pytest .mark .parametrize ("form" , ["flat" , "list" , "tuple" ])
2390
+ @pytest .mark .parametrize ("mode" , ["internal" , "external" ])
2391
+ @pytest .mark .parametrize ("list_" , ["legacy" , "pandas" ])
2392
+ def test_issue_2583 (function_tmpdir , form , mode , list_ ):
2393
+ name = "2583"
2394
+ sim = flopy .mf6 .MFSimulation (
2395
+ sim_name = name ,
2396
+ sim_ws = function_tmpdir ,
2397
+ exe_name = "mf6" ,
2398
+ use_pandas = list_ == "pandas" ,
2399
+ )
2400
+ tdis = flopy .mf6 .ModflowTdis (sim )
2401
+ ims = flopy .mf6 .ModflowIms (sim )
2402
+ gwf = flopy .mf6 .ModflowGwf (sim , modelname = name , save_flows = True )
2403
+ dis = flopy .mf6 .ModflowGwfdis (gwf , nrow = 10 , ncol = 10 )
2404
+ ic = flopy .mf6 .ModflowGwfic (gwf )
2405
+ npf = flopy .mf6 .ModflowGwfnpf (
2406
+ gwf , save_specific_discharge = True , save_saturation = True
2407
+ )
2408
+ if form == "flat" :
2409
+ chd_spd = {
2410
+ 0 : [[0 , 0 , 0 , 1.0 , 1.0 ], [0 , 9 , 9 , 0.0 , 0.0 ]],
2411
+ 1 : [[0 , 0 , 0 , 0.0 , 0.0 ], [0 , 9 , 9 , 1.0 , 2.0 ]],
2412
+ }
2413
+ elif form == "list" :
2414
+ chd_spd = {
2415
+ 0 : [[[0 , 0 , 0 ], 1.0 , 1.0 ], [[0 , 9 , 9 ], 0.0 , 0.0 ]],
2416
+ 1 : [[[0 , 0 , 0 ], 0.0 , 0.0 ], [[0 , 9 , 9 ], 1.0 , 2.0 ]],
2417
+ }
2418
+ elif form == "tuple" :
2419
+ chd_spd = {
2420
+ 0 : [[(0 , 0 , 0 ), 1.0 , 1.0 ], [(0 , 9 , 9 ), 0.0 , 0.0 ]],
2421
+ 1 : [[(0 , 0 , 0 ), 0.0 , 0.0 ], [(0 , 9 , 9 ), 1.0 , 2.0 ]],
2422
+ }
2423
+ chd = flopy .mf6 .ModflowGwfchd (
2424
+ gwf , pname = "CHD-1" , stress_period_data = chd_spd , auxiliary = ["concentration" ]
2425
+ )
2426
+ if mode == "external" :
2427
+ chd .set_all_data_external ()
2428
+
2429
+ sim .write_simulation ()
2430
+
2431
+ chd_file_path = function_tmpdir / f"{ name } .chd"
2432
+ data_lines = []
2433
+
2434
+ if mode == "internal" :
2435
+ chd_lines = chd_file_path .open ().readlines ()
2436
+ read = False
2437
+ for line in chd_lines :
2438
+ if line .startswith ("#" ):
2439
+ continue
2440
+ if line .startswith ("BEGIN period 1" ):
2441
+ read = True
2442
+ continue
2443
+ if line .startswith ("END" ):
2444
+ read = False
2445
+ if read :
2446
+ data_lines .append (line .strip ().split ())
2447
+ else :
2448
+ data_file_path = function_tmpdir / "2583.chd_stress_period_data_1.txt"
2449
+ data_lines = [l .strip ().split () for l in data_file_path .open ().readlines ()]
2450
+
2451
+ assert len (data_lines ) == 2
2452
+
2453
+ first = data_lines [0 ]
2454
+ assert first [0 ] == "1"
2455
+ assert first [1 ] == "1"
2456
+ assert first [2 ] == "1"
2457
+ assert float (first [3 ]) == 1.0
2458
+ assert float (first [4 ]) == 1.0
2459
+
2460
+ second = data_lines [1 ]
2461
+ assert second [0 ] == "1"
2462
+ assert second [1 ] == "10"
2463
+ assert second [2 ] == "10"
2464
+ assert float (second [3 ]) == 0.0
2465
+ assert float (second [4 ]) == 0.0
0 commit comments