跳转到主要内容

支持多种几何约定扩展的xarray

项目描述

emsarray

Binder Documentation Status Conda Version

emsarray 包提供了一种通用的接口来处理CSIRO使用的多种模型几何约定。它增强了 xarray 数据集,并提供了一系列用于操作数据集的常见操作。

要使用,请使用 emsarray.open_dataset() 函数打开数据集,并使用 dataset.ems 属性

import emsarray
from shapely.geometry import Point

dataset = emsarray.tutorial.open_dataset('gbr4')
capricorn_group = Point(151.869, -23.386)
point_data = dataset.ems.select_point(capricorn_group)

一些方法接受DataArray作为参数

# Plot the sea surface temperature for time = 0
temp = dataset['temp'].isel(time=0, k=-1)
dataset.ems.plot(temp)

Plot of sea surface temperature from the GBR4 example file

许多操作提供了进一步的功能来操作数据集,导出几何形状和选择数据子集

from emsarray.operations import geometry
geometry.write_geojson(dataset, './gbr4.geojson')
geometry.write_shapefile(dataset, './gbr4.shp')

链接

示例

emsarray-notebooks 存储库中提供了使用 emsarray 的示例。您可以使用Binder在线探索这些笔记本

开发

为了设置开发环境,请创建一个虚拟环境并安装依赖项

$ python3 -m venv
$ source venv/bin/activate
$ pip install --upgrade pip>=21.3
$ pip install -e .[testing]

测试

要运行测试,请安装并运行 tox

$ python3 -m venv
$ source venv/bin/activate
$ pip install --upgrade pip>=21.3 tox
$ tox

文档

emsarray当前稳定版本的文档可在Read The Docs上找到.

要构建文档,请安装上述开发要求并调用 Sphinx

$ make -C docs/ html

在更新或添加文档时,运行 live 目标以自动重新构建文档,每当有更改时都会这样做。这将通过 livereload 服务器提供文档。

$ make -C docs/ live

您可以在 http://localhost:5500 查看文档

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源代码分发

emsarray-0.7.0.tar.gz (97.0 kB 查看哈希值)

上传时间 源代码

构建分发

emsarray-0.7.0-py3-none-any.whl (101.2 kB 查看哈希值)

上传时间 Python 3

支持者: