Publish Xarray Datasets via a REST API.
Project description
Xpublish
Publish Xarray Datasets to the web
A quick example
Serverside: Publish a Xarray Dataset through a rest API
ds.rest.serve(host="0.0.0.0", port=9000)
Client-side: Connect to a published dataset
The published datasets can be accessed from various kinds of client applications, e.g., from within Python using Zarr and fsspec.
import xarray as xr
import zarr
from fsspec.implementations.http import HTTPFileSystem
fs = HTTPFileSystem()
http_map = fs.get_mapper("http://0.0.0.0:9000/zarr/")
# open as a zarr group
zg = zarr.open_consolidated(http_map, mode="r")
# or open as another Xarray Dataset
ds = xr.open_zarr(http_map, consolidated=True)
Or to explore other access methods, open http://0.0.0.0:9000/docs in a browser.
Why?
Xpublish lets you serve/share/publish Xarray Datasets via a web application.
The data and/or metadata in the Xarray Datasets can be exposed in various forms through pluggable REST API endpoints. Efficient, on-demand delivery of large datasets may be enabled with Dask on the server-side.
Xpublish's plugin ecosystem has capabilities including:
- publish on-demand or derived data products
- turning xarray objects into streaming services (e.g. OPeNDAP)
How?
Under the hood, Xpublish is using a web app (FastAPI) that is exposing a REST-like API with builtin and/or user-defined endpoints.
For example, Xpublish provides by default a minimal Zarr compatible REST-like API with the following endpoints:
zarr/.zmetadata
: returns Zarr-formatted metadata keys as json strings.zarr/var/0.0.0
: returns a variable data chunk as a binary string.
Futher endpoints can be added by installing or writing plugins.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file xpublish-0.3.3.tar.gz
.
File metadata
- Download URL: xpublish-0.3.3.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c11c8e42847670fdfab2fc35b37ff86ed5849974f40af7abf9f4578f00e9110 |
|
MD5 | a59c1c154d93a4c51c45233f9b323f13 |
|
BLAKE2b-256 | 8d762032a6d36ab3428ff598b3c1f4050f39deb3bdc13c4e843f8fe1a0b000fd |
File details
Details for the file xpublish-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: xpublish-0.3.3-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24e3aa6eae9e2dc67dcf66407d215516248ca3d577a9d9384a1be85001909203 |
|
MD5 | 6bd06ddcbae33b482ab9fdedfcf6b197 |
|
BLAKE2b-256 | 535d99c0dfb9376db3983cb94f20edcb0c81afea5a1c56329dce7bf22187655e |