我正在寻找一种从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

最佳答案

flopy有一种方法(.HeadUFile())从使用DISU包的MODFLOW-USG模型读取结果。来自MODFLOW-USG随附的01A_nestedgrid_nognc示例。

>>> 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])]
>>>

关于python - 使用flopy从MODFLOW-USG二进制输出中提取磁头,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51734703/

10-08 22:00