0

我正在尝试使用 FloPy(Windows 环境)加载现有的 MODFLOW-USG 模型。该模型有一个Voronoi网格,这似乎会触发“加载”功能:

m1=flopy.modflow.Modflow.load(model_name+".nam",model_ws=model_dir,verbose=True,check=False,exe_name="mfusg.exe",version='mfusg')

我收到以下错误,这似乎与 FloPy 期望具有行和列的结构化网格有关:

TypeError                                 Traceback (most recent call last)
<ipython-input-33-62420c415719> in <module>
      6 head_file = os.path.join(model_dir,model_name+'.hds')
      7 print(head_file)
----> 8 m1=flopy.modflow.Modflow.load(model_name+".nam",model_ws=model_dir,verbose=True,check=False,exe_name="mfusg.exe",version='mfusg')
      9 headobj = bf.HeadUFile(head_file,verbose=True,text='HEADU')
     10 headobj.list_records()

~\Anaconda3\lib\site-packages\flopy\modflow\mf.py in load(f, version, exe_name, verbose, model_ws, load_only, forgive, check)
    797                             item.package.load(item.filehandle, ml,
    798                                               ext_unit_dict=ext_unit_dict,
--> 799                                               check=False)
    800                         else:
    801                             item.package.load(item.filehandle, ml,

~\Anaconda3\lib\site-packages\flopy\modflow\mfrch.py in load(f, model, nper, ext_unit_dict, check)
    408                         print(txt)
    409                     t = Util2d.load(f, model, (nrow, ncol), np.float32, 'rech',
--> 410                                     ext_unit_dict)
    411                 else:
    412                     parm_dict = {}

~\Anaconda3\lib\site-packages\flopy\utils\util_array.py in load(f_handle, model, shape, dtype, name, ext_unit_dict, array_free_format, array_format)
   2699 
   2700         elif cr_dict['type'] == 'internal':
-> 2701             data = Util2d.load_txt(shape, f_handle, dtype, cr_dict['fmtin'])
   2702             u2d = Util2d(model, shape, dtype, data, name=name,
   2703                          iprn=cr_dict['iprn'], fmtin="(FREE)",

~\Anaconda3\lib\site-packages\flopy\utils\util_array.py in load_txt(shape, file_in, dtype, fmtin)
   2376         elif len(shape) == 2:
   2377             nrow, ncol = shape
-> 2378             num_items = nrow * ncol
   2379         else:
   2380             raise ValueError(

TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

我找不到任何文档或 Jupyter 笔记本,其中包含使用 Voronoi 网格加载现有模型的示例,仅创建新的三角形网格或结构化/局部网格细化网格。

4

1 回答 1

0

尝试使用原谅 = True 的代码。

m1=flopy.modflow.Modflow.load(model_name+".nam",model_ws=model_dir,verbose=True,check=False,exe_name="mfusg.exe",version='mfusg', forgive = True)
于 2020-10-12T06:24:30.223 回答