我无法使用node_data和stress_period_data recarrays(losstype='general')从头开始加载我用 FloPy 创建的 MNW2 包。
我回到 Jupyter Notebook flopy3_mnw2package_example:我坚持这个例子,只改变了node_data的定义,通过替换笔记本的 In[3] :
node_data = pd.DataFrame([[1, 1, 9.5, 7.1, 'well1', 'skin', -1, 0, 0, 0, 1., 2., 5., 6.2],
[1, 1, 7.1, 5.1, 'well1', 'skin', -1, 0, 0, 0, 0.5, 2., 5., 6.2],
[3, 3, 9.1, 3.7, 'well2', 'skin', -1, 0, 0, 0, 1., 2., 5., 4.1]],
columns=['i', 'j', 'ztop', 'zbotm', 'wellid', 'losstype', 'pumploc', 'qlimit', 'ppflag', 'pumpcap',
'rw', 'rskin', 'kskin', 'zpump'])
使用 losstype='general' 版本:
node_data = pd.DataFrame([[1, 1, 9.5, 7.1, 'well1', 'general', 1., 0., 0., 2.0],
[1, 1, 7.1, 5.1, 'well1', 'general', 0.5, 0., 0., 2.0],
[3, 3, 9.1, 3.7, 'well2', 'general', 1., 0., 0., 2.0]],
columns=['i', 'j', 'ztop', 'zbotm', 'wellid', 'losstype', 'rw', 'B', 'C', 'P'])
在制作了mnw对象(In[7])之后,我编写了输入文件并尝试使用以下命令加载 MNW2 包:
m.write_input()
flopy.modflow.Modflow.load('data/mnw2example.nam', load_only = 'mnw2', verbose=True)
但我收到以下错误:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-122-fb0de1b45d14> in <module>
----> 1 flopy.modflow.Modflow.load('data/mnw2example.nam', load_only = 'mnw2', verbose=True)
C:\tools\Anaconda3\lib\site-packages\flopy\modflow\mf.py in load(f, version, exe_name, verbose, model_ws, load_only, forgive, check)
800 else:
801 item.package.load(item.filehandle, ml,
--> 802 ext_unit_dict=ext_unit_dict)
803 files_successfully_loaded.append(item.filename)
804 if ml.verbose:
C:\tools\Anaconda3\lib\site-packages\flopy\modflow\mfmnw2.py in load(f, model, nper, gwt, nsol, ext_unit_dict)
1230 for i in range(mnwmax):
1231 # create a Mnw object by parsing dataset 2
-> 1232 mnwobj = _parse_2(f)
1233 # populate stress period data table for each well object
1234 # this is filled below under dataset 4
C:\tools\Anaconda3\lib\site-packages\flopy\modflow\mfmnw2.py in _parse_2(f)
1824 hlim=hlim, qcut=qcut, qfrcmn=qfrcmn, qfrcmx=qfrcmx,
1825 hlift=hlift, liftq0=liftq0, liftqmax=liftqmax, hwtol=hwtol,
-> 1826 liftn=liftn, qn=qn)
1827
1828
C:\tools\Anaconda3\lib\site-packages\flopy\modflow\mfmnw2.py in __init__(self, wellid, nnodes, nper, losstype, pumploc, qlimit, ppflag, pumpcap, rw, rskin, kskin, B, C, P, cwc, pp, k, i, j, ztop, zbotm, node_data, stress_period_data, pumplay, pumprow, pumpcol, zpump, hlim, qcut, qfrcmn, qfrcmx, hlift, liftq0, liftqmax, hwtol, liftn, qn, mnwpackage)
426 # build recarray of node data from MNW2 input file
427 if node_data is None:
--> 428 self.make_node_data()
429 else:
430 self._set_attributes_from_node_data()
C:\tools\Anaconda3\lib\site-packages\flopy\modflow\mfmnw2.py in make_node_data(self)
450 names = Mnw.get_item2_names(self)
451 for n in names:
--> 452 node_data[n] = self.__dict__[n]
453 self.node_data = node_data
454
ValueError: cannot copy sequence with size 0 to array axis with dimension 2
保持 losstype='skin' 版本时加载 MNW2 包没有问题,所以我不知道这是否是我的node_data的问题?但我想我定义了 losstype='general' 所需的所有参数......
谢谢您的帮助!