hector简单气候模型的python包装器

pyhector的Python项目详细描述


PyPI VersionPyPI Python Versions
DocsLaunch Binder
JOSSZenodo

pyhector是用于简单全局气候的python接口 碳循环模型Hector

pyhector使简单的气候模型hector易于安装 可从python中使用,例如可用于 综合评估模型中的缓解情景,复杂气候 模型仿真和不确定性分析。

{ { } }是用C++编写的,并且 在Pacific Northwest National Laboratory开发。型号说明发布在

Hartin, C. A., Patel, P., Schwarber, A., Link, R. P., and Bond-Lamberty, B. P.: A simple object-oriented and open-source model for scientific and policy analyses of the global climate system – Hector v1.0, Geosci. Model Dev., 8, 939-955, doi:10.5194/gmd-8-939-2015, 2015.

见赫克托耳repositorywiki继续 信息。

python接口pyhectorSven WillnerPotsdam Institute for Climate Impact Research处的Robert Gieseke开发。

pyhector使用pybind11来包装 赫克托的API。使用的hector版本可以使用pyhector的 __hector_version__字段。

安装

先决条件

Hector需要Boost,因此要安装并使用pyhector 拥有boost版本的文件系统和系统模块 安装1.52或更高版本(另请参见Hector build instructions)。

在ubuntu/debian上,可以通过调用

sudo apt-get install libboost-filesystem-dev libboost-system-dev

在macos上,boost可通过自制包管理器获得,它 建议使用自制安装的python进行安装 pyhector

brew install boost

原则上支持Windows,但尚未测试 pyhector。带有Windows安装说明的请求是 欢迎。

使用pip

安装

您只需从安装pyhector PyPI通过调用

pip install pyhector

用法

此存储库还包含一个Jupyter Notebook您可以run live和 实验,由Binder提供 项目。笔记本可以看作是static version 使用nbviewer。

基本示例

importpyhectoroutput=pyhector.run(pyhector.rcp26)

高级示例

importpyhectorfrompyhectorimportrcp26,rcp45,rcp60,rcp85importmatplotlib.pyplotaspltforrcpin[rcp26,rcp45,rcp60,rcp85]:output=pyhector.run(rcp,{"core":{"endDate":2100}})temp=output["temperature.Tgav"]# Adjust to 1850 - 1900 reference periodtemp=temp.loc[1850:]-temp.loc[1850:1900].mean()temp.plot(label=rcp.name.split("_")[0])plt.title("Global mean temperature")plt.ylabel("°C over pre-industrial (1850-1900 mean)")plt.legend(loc="best")plt.show()
Temperature Plot of RCP scenarios

开发

对于本地开发,您可以克隆存储库,更新 依赖项并安装在具有pip的虚拟环境中。

git clone https://github.com/openclimatedata/pyhector.git --recursive
cd pyhector
python3 -m venv venv
./venv/bin/pip install --editable .

要更新pyhector和所有可以运行的子模块

git pull --recurse-submodules
git submodule update --init --recursive
./venv/bin/pip install --editable .

可以使用

在本地运行测试
python setup.py test

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
安卓 xslt可与xalan cli一起使用,但不能从java代码中使用   java在spring应用程序中使用jackson进行序列化时面临的问题   Java检查Linux问题上的internet连接   当用户单击JavaSwing中的按钮时,从另一个类创建新对象   java为什么小于9,算上9?   使用Websphere 6.1生成WSDL的java未正确生成序列参数   javaq:ViewPager和OnClickListener   获取错误的java无法为child()中的参数“pathString”传递null   java组织。springframework。安全果心用户详细信息。用户详细信息创建用户   性能:单变量赋值与Objectgraph导航(Java)   java为什么资源中的CSS在spring jsp页面中不起作用?   较小的有限值双Java   java REST API如何处理post和函数错误   列出Java流API如何改进表达式