扩展xarray.open_dataset以接受pystac对象
项目描述
xpystac
xpystac提供将xarray.open_dataset
扩展以接受pystac对象的粘合剂。
目标是只要这个库在你的环境中,你就不必担心它。
示例
搜索COGs集合
import pystac_client
import xarray as xr
catalog = pystac_client.Client.open(
"https://earth-search.aws.element84.com/v1",
)
search = catalog.search(
intersects=dict(type="Point", coordinates=[-105.78, 35.79]),
collections=['sentinel-2-l2a'],
datetime="2022-04-01/2022-05-01",
)
xr.open_dataset(search, engine="stac")
以下是一些来自行星计算机文档的示例
import planetary_computer
import pystac_client
import xarray as xr
catalog = pystac_client.Client.open(
"https://planetarycomputer.microsoft.com/api/stac/v1",
modifier=planetary_computer.sign_inplace,
)
从参考文件读取
collection = catalog.get_collection("nasa-nex-gddp-cmip6")
asset = collection.assets["ACCESS-CM2.historical"]
xr.open_dataset(asset)
参考: https://planetarycomputer.microsoft.com/dataset/nasa-nex-gddp-cmip6#Example-Notebook
从zarr文件读取
collection = catalog.get_collection("daymet-daily-hi")
asset = collection.assets["zarr-abfs"]
xr.open_dataset(asset)
参考: https://planetarycomputer.microsoft.com/docs/quickstarts/reading-zarr-data/
安装
pip install git+https://github.com/stac-utils/xpystac
工作原理
当你调用xarray.open_dataset(object, engine="stac")
时,这个库将该open
调用映射到正确的库。根据object
的类型,这可能是一个堆叠库(要么是odc-stac或stackstac)或者返回到xarray.open_dataset
本身,但是使用从pystac对象拉取的引擎和其他选项。
现有技术
这项工作受到了https://github.com/TomAugspurger/staccontainers以及https://github.com/stac-utils/pystac/issues/846中的讨论的启发
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定要选择哪个,请了解更多关于安装软件包的信息。
源代码分发
xpystac-0.1.3.tar.gz (22.3 kB 查看哈希值)
构建分发
xpystac-0.1.3-py3-none-any.whl (6.6 kB 查看哈希值)
关闭
xpystac-0.1.3.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 0fc56bce5280ae455f6b4fa9537062c5dc1f27773b26ebda1aa9063eff7f9416 |
|
MD5 | fdcd9430a09bb51f7323055d4c57f0e0 |
|
BLAKE2b-256 | d8d86909467f0af4c8b701447e717f3f9a402b8ba40a1875e8423663751fe8b9 |
关闭
xpystac-0.1.3-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 16ef94911a9109f9c77d622acb6a7f7ae9516dc6e4f0489ac2150a696e754785 |
|
MD5 | f64e7a1fee620a55034915409f60ac3e |
|
BLAKE2b-256 | 520646d4236728b9327604d58e9f6ea7a10aad162567562538fbd58bfd96146e |