Skip to main content

Publish Xarray Datasets via a REST API.

Project description

Publish Xarray Datasets via a REST API.

GitHub Workflow Status Documentation Status Binder https://codecov.io/gh/xarray-contrib/xpublish/branch/master/graph/badge.svg

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 dataset can be accessed from various kinds of client applications. Here is an example of directly accessing the data from within Python:

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')

# 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)

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.

We are exploring applications of Xpublish that include:

  • 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:

  • .zmetadata: returns Zarr-formatted metadata keys as json strings.

  • var/0.0.0: returns a variable data chunk as a binary string.

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

xpublish-0.1.0.tar.gz (35.7 kB view details)

Uploaded Source

Built Distribution

xpublish-0.1.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file xpublish-0.1.0.tar.gz.

File metadata

  • Download URL: xpublish-0.1.0.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for xpublish-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fb31b2937a80f607dd7d1e5739a5137ca7ed6de5211fe3ec9c1ded0d89b3486a
MD5 f403f797045161f98226adb486e5bd28
BLAKE2b-256 ce975a1f5626a1df7de21266404e9257e98afa384e3aa9fe68407d426591c87a

See more details on using hashes here.

File details

Details for the file xpublish-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xpublish-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for xpublish-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df83630a660cca93871ef530afba1aecde542ea4a7a0ff17233700280cbd09b4
MD5 ce787da8ba675d8ab351489176470dae
BLAKE2b-256 112a9ed699d407d1ab081290618e99eb506db885116998f5cf73f346f7a3602e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page