<commit_before># Test multi-species options in mt3d
import os
import flopy

testpth = os.path.join('.', 'temp')

def test_mt3d_multispecies():
    # modflow model
    modelname = 'multispecies'
    nlay = 1
    nrow = 20
    ncol = 20
    nper = 10
    mf = flopy.modflow.Modflow(modelname=modelname, model_ws=testpth)
    dis = flopy.modflow.ModflowDis(mf, nlay=nlay, nrow=nrow, ncol=ncol,
                                   nper=nper)
    lpf = flopy.modflow.ModflowLpf(mf)
    rch = flopy.modflow.ModflowRch(mf)
    evt = flopy.modflow.ModflowEvt(mf)
    mf.write_input()

    # mt3d model
    ncomp = 5
    mt = flopy.mt3d.Mt3dms(modelname=modelname, modflowmodel=mf,
                           model_ws=testpth)
    btn = flopy.mt3d.Mt3dBtn(mt, ncomp=ncomp, sconc=1., sconc2=2., sconc3=3.,
                             sconc5=5.)
    ssm = flopy.mt3d.Mt3dSsm(mt, crch=1., crch2=2., crch3={2:3.}, crch5=5.,
                             cevt=1., cevt2=2., cevt3={2:3.}, cevt5=5.)

    crch2 = ssm.crch[1].array
    assert(crch2.max() == 2.)
    cevt2 = ssm.cevt[1].array
    assert(cevt2.max() == 2.)

    mt.write_input()

    # Try to load ssm
    modelname2 = 'multispecies2'
    mf2 = flopy.modflow.Modflow(modelname=modelname2, model_ws=testpth)
    dis2 = flopy.modflow.ModflowDis(mf2, nlay=nlay, nrow=nrow, ncol=ncol,
                                    nper=nper)

    mt2 = flopy.mt3d.Mt3dms(modelname=modelname2, modflowmodel=mf2,
                            model_ws=testpth)
    mt2.verbose = True
    fname = os.path.join(testpth, modelname + '.btn')
    btn2 = flopy.mt3d.Mt3dBtn.load(fname, mt2)
    fname = os.path.join(testpth, modelname + '.ssm')
    ssm2 = flopy.mt3d.Mt3dSsm.load(fname, mt2)
    mt2.write_input()

    return


if __name__ == '__main__':
    test_mt3d_multispecies()
<commit_msg>Making t023_test a little tougher.<commit_after># Test multi-species options in mt3d
import os
import numpy as np
import flopy

testpth = os.path.join('.', 'temp')

def test_mt3d_multispecies():
    # modflow model
    modelname = 'multispecies'
    nlay = 1
    nrow = 20
    ncol = 20
    nper = 10
    mf = flopy.modflow.Modflow(modelname=modelname, model_ws=testpth)
    dis = flopy.modflow.ModflowDis(mf, nlay=nlay, nrow=nrow, ncol=ncol,
                                   nper=nper)
    lpf = flopy.modflow.ModflowLpf(mf)
    rch = flopy.modflow.ModflowRch(mf)
    evt = flopy.modflow.ModflowEvt(mf)
    mf.write_input()

    # Create a 5-component mt3d model and write the files
    ncomp = 5
    mt = flopy.mt3d.Mt3dms(modelname=modelname, modflowmodel=mf,
                           model_ws=testpth, verbose=True)
    sconc3 = np.random.random((nrow, ncol))
    btn = flopy.mt3d.Mt3dBtn(mt, ncomp=ncomp, sconc=1., sconc2=2.,
                             sconc3=sconc3, sconc5=5.)
    crch32 = np.random.random((nrow, ncol))
    cevt33 = np.random.random((nrow, ncol))
    ssm = flopy.mt3d.Mt3dSsm(mt, crch=1., crch2=2., crch3={2:crch32}, crch5=5.,
                             cevt=1., cevt2=2., cevt3={3:cevt33}, cevt5=5.)
    crch2 = ssm.crch[1].array
    assert(crch2.max() == 2.)
    cevt2 = ssm.cevt[1].array
    assert(cevt2.max() == 2.)
    mt.write_input()

    # Create a second MODFLOW model
    modelname2 = 'multispecies2'
    mf2 = flopy.modflow.Modflow(modelname=modelname2, model_ws=testpth)
    dis2 = flopy.modflow.ModflowDis(mf2, nlay=nlay, nrow=nrow, ncol=ncol,
                                    nper=nper)

    # Load the MT3D model into mt2 and then write it out
    fname = modelname + '.nam'
    mt2 = flopy.mt3d.Mt3dms.load(fname, model_ws=testpth, verbose=True)
    mt2.name = modelname2
    mt2.write_input()

    return


if __name__ == '__main__':
    test_mt3d_multispecies()

{'fraction_non_alphanumeric': 0.1287473233404711, 'fraction_numerical': 0.03854389721627409, 'mean_word_length': 2.422161172161172, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3909238', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1522, 'n_words': 262}