bmi库的python包装器
bmi-python的Python项目详细描述
BMI模型的Python包装器
=====
这是BMI模型的cTypes包装器。
BMI描述了数值模型的低级接口。
图片::https://travis-ci.org/openearth/bmi-python.svg?branch=master
:目标:https://travis ci.org/openearth/bmi python
origin
----
此模块基于以下代码:https://csdms.colorado.edu/svn/bmi/trunk/python/bmi/bmi.py
-openearth:http://svn.oss.deltares.nl/repos/openearthtools/trunk/python/openearthtools
-3di:https://github.com/nens/python subgrid
https://repos.deltares.nl/repos/ds/trunk/additional/unsuc/python/dflowfm
先决条件
----
我们需要编译的BMI库(dll,so,dylib)。有两个常见的
位置供我们查找。:
.
~/local/lib
~/.local/lib
/opt/modelname/lib
/usr/local/lib
/usr/lib
linux上的一个约定是将库安装到`/opt/modelname/````.
如果您使用上面的一个模型,那么模型名将是3di,dflowfm,xBeach或swan
如果您有其他位置,可以设置``ld_library_path``,(`dyld_library_path`,在OSX中,``path`,在Windows中)
环境变量,例如3di::
$export-ld-culibraru-libraru-path=/home/user/svn/3di/trunk/subgridf90/src/.libs
(在windows上,命令是“set”而不是“export```````````````````set```)
setup
-
>workwork main
35;拿到来自pypi的版本
pip install bmi
从http://www.lfd.uci.edu/~gohlke/pythonlibs/~faulthandler
-下载并安装:netcdf4:package,从http://www.lfd.uci.edu/~gohlke/pythonlibs/~netcdf4
-打开(anaconda)python终端(按:[ctrl]:+:[a lt]+:a:)。
-pip.bat install-e``<;指向bmi python git工作副本的路径>;``
用法
----
使用包装有两种方法。一种简便的方法是作为上下文
manager,因此使用“with”语句:
bmiwrapper(engine=“model”,configfile='/full/path/model.ini')作为模型:
model是实际的库。
model.something()
configfile='/full/path/model.mdu')
wrapper.start()
wrapper.library.something()
…
wrapper.stop()
注意:没有“mdu”参数,未加载任何模型,您可以自由地
使用库。
方便脚本
----
python bmi库包含一个脚本,可以用作模型的命令行运行程序:
链接
-
。_ bmi:http://csdms.colorado.edu/wiki/bmi_描述
信用
==
-Fedor Baart
-Gena Donchyts
-Jack Ha
-Stef Hummel
-Scott Peckham
-重新定义van Rees
-Sander Smits
bmi python
=====================
2014-02-07
----
-允许配置文件的相对路径
-修复Unicode用作变量时的异常可用名称
0.1(2014-04-01)
----
-将代码从python子网格和openearthtools中拆分为通用bmi包装器。
=====
这是BMI模型的cTypes包装器。
BMI描述了数值模型的低级接口。
图片::https://travis-ci.org/openearth/bmi-python.svg?branch=master
:目标:https://travis ci.org/openearth/bmi python
origin
----
此模块基于以下代码:https://csdms.colorado.edu/svn/bmi/trunk/python/bmi/bmi.py
-openearth:http://svn.oss.deltares.nl/repos/openearthtools/trunk/python/openearthtools
-3di:https://github.com/nens/python subgrid
https://repos.deltares.nl/repos/ds/trunk/additional/unsuc/python/dflowfm
先决条件
----
我们需要编译的BMI库(dll,so,dylib)。有两个常见的
位置供我们查找。:
.
~/local/lib
~/.local/lib
/opt/modelname/lib
/usr/local/lib
/usr/lib
linux上的一个约定是将库安装到`/opt/modelname/````.
如果您使用上面的一个模型,那么模型名将是3di,dflowfm,xBeach或swan
如果您有其他位置,可以设置``ld_library_path``,(`dyld_library_path`,在OSX中,``path`,在Windows中)
环境变量,例如3di::
$export-ld-culibraru-libraru-path=/home/user/svn/3di/trunk/subgridf90/src/.libs
(在windows上,命令是“set”而不是“export```````````````````set```)
setup
-
35;拿到来自pypi的版本
pip install bmi
从http://www.lfd.uci.edu/~gohlke/pythonlibs/~faulthandler
-下载并安装:netcdf4:package,从http://www.lfd.uci.edu/~gohlke/pythonlibs/~netcdf4
-打开(anaconda)python终端(按:[ctrl]:+:[a lt]+:a:)。
-pip.bat install-e``<;指向bmi python git工作副本的路径>;``
用法
----
使用包装有两种方法。一种简便的方法是作为上下文
manager,因此使用“with”语句:
bmiwrapper(engine=“model”,configfile='/full/path/model.ini')作为模型:
model是实际的库。
model.something()
configfile='/full/path/model.mdu')
wrapper.start()
wrapper.library.something()
…
wrapper.stop()
注意:没有“mdu”参数,未加载任何模型,您可以自由地
使用库。
方便脚本
----
python bmi库包含一个脚本,可以用作模型的命令行运行程序:
链接
-
。_ bmi:http://csdms.colorado.edu/wiki/bmi_描述
信用
==
-Fedor Baart
-Gena Donchyts
-Jack Ha
-Stef Hummel
-Scott Peckham
-重新定义van Rees
-Sander Smits
bmi python
=====================
2014-02-07
----
-允许配置文件的相对路径
-修复Unicode用作变量时的异常可用名称
0.1(2014-04-01)
----
-将代码从python子网格和openearthtools中拆分为通用bmi包装器。