1

我正在寻找一种从 MODFLOW-USG 二进制头部保存文件中提取模拟头部的方法。Flopy 似乎支持使用 flopy.utils.binaryfile 模块的操作,但我无法进行简单的测试。下面的代码应该返回包含在 hds 文件中的所有时间输出的列表,但只返回第一个时间步的单个值。flopy 是否支持从非结构化网格头保存文件中提取数据?

modelname = 'Torr_TRu'

import flopy.utils.binaryfile as bf

# Create the headfile object
headobj = bf.HeadFile(modelname+'.hds')
times = headobj.get_times()
print times
4

1 回答 1

2

flopy 有一个方法 ( .HeadUFile()) 用于从使用 DISU 包的 MODFLOW-USG 模型读取结果。来自01A_nestedgrid_nogncMODFLOW-USG 提供的示例。

>>> import flopy
>>> hobj = flopy.utils.HeadUFile('flow.hds')
>>> hobj.get_times()
[1.0]
>>> hobj.get_kstpkper()
[(0, 0)]
>>> hobj.get_data()
[array([1.        , 0.83240567, 0.66561982, 0.5       , 0.33438018,
       0.16759433, 0.        , 1.        , 0.83159718, 0.66445378,
       0.5       , 0.33554622, 0.16840282, 0.        , 1.        ,
       0.82952927, 0.17047073, 0.        , 1.        , 0.83057937,
       0.16942063, 0.        , 1.        , 0.82952927, 0.17047073,
       0.        , 1.        , 0.83159718, 0.66445378, 0.5       ,
       0.33554622, 0.16840282, 0.        , 1.        , 0.83240567,
       0.66561982, 0.5       , 0.33438018, 0.16759433, 0.        ,
       0.70823018, 0.66237196, 0.61504791, 0.54803289, 0.5       ,
       0.45196711, 0.38495209, 0.33762804, 0.29176982, 0.71532698,
       0.66279689, 0.61003588, 0.55306726, 0.5       , 0.44693274,
       0.38996412, 0.33720311, 0.28467302, 0.71785265, 0.66345274,
       0.60923147, 0.55420027, 0.5       , 0.44579973, 0.39076853,
       0.33654726, 0.28214735, 0.71893984, 0.66392996, 0.60923697,
       0.55450236, 0.5       , 0.44549764, 0.39076303, 0.33607004,
       0.28106016, 0.71921706, 0.66409027, 0.60928411, 0.55457221,
       0.5       , 0.44542779, 0.39071589, 0.33590973, 0.28078294,
       0.71893984, 0.66392996, 0.60923697, 0.55450236, 0.5       ,
       0.44549764, 0.39076303, 0.33607004, 0.28106016, 0.71785265,
       0.66345274, 0.60923147, 0.55420027, 0.5       , 0.44579973,
       0.39076853, 0.33654726, 0.28214735, 0.71532698, 0.66279689,
       0.61003588, 0.55306726, 0.5       , 0.44693274, 0.38996412,
       0.33720311, 0.28467302, 0.70823018, 0.66237196, 0.61504791,
       0.54803289, 0.5       , 0.45196711, 0.38495209, 0.33762804,
       0.29176982])] 
>>> 
于 2018-08-30T15:06:58.853 回答