Skip to main content

Xarray plugin for TiTiler.

Project description

titiler.xarray

Adds support for Xarray Dataset (NetCDF/Zarr) in Titiler.

Installation

python -m pip install -U pip

# From Pypi
python -m pip install "titiler.xarray[full]"

# Or from sources
git clone https://github.com/developmentseed/titiler.git
cd titiler && python -m pip install -e src/titiler/core -e "src/titiler/xarray"

Installation options

Default installation for titiler.xarray DOES NOT include fsspec or any storage's specific dependencies (e.g s3fs) nor engine dependencies (zarr, h5netcdf). This is to ease the customization and deployment of user's applications. If you want to use the default's dataset reader you will need to at least use the [minimal] dependencies (e.g python -m pip install "titiler.xarray[minimal]").

Here is the list of available options:

  • fs: h5netcdf, fsspec, s3fs, aiohttp, gcsfs

Dependencies

Titiler.xarray follows SPEC 0, similar to xarray.

How To

from fastapi import FastAPI

from titiler.xarray.extensions import VariablesExtension
from titiler.xarray.factory import TilerFactory

app = FastAPI(
    openapi_url="/api",
    docs_url="/api.html",
    description="""Xarray based tiles server for MultiDimensional dataset (Zarr/NetCDF).

---

**Documentation**: <a href="https://developmentseed.org/titiler/" target="_blank">https://developmentseed.org/titiler/</a>

**Source Code**: <a href="https://github.com/developmentseed/titiler" target="_blank">https://github.com/developmentseed/titiler</a>

---
    """,
)

md = TilerFactory(
    router_prefix="/md",
    extensions=[
        VariablesExtension(),
    ],
)
app.include_router(md.router, prefix="/md", tags=["Multi Dimensional"])

Package structure

titiler/
 └── xarray/
    ├── tests/                   - Tests suite
    └── titiler/xarray/          - `xarray` namespace package
        ├── dependencies.py      - titiler-xarray dependencies
        ├── extensions.py        - titiler-xarray extensions
        ├── main.py              - main fastapi application
        ├── io.py                - titiler-xarray Readers
        └── factory.py           - endpoints factory

Custom Dataset Opener

A default Dataset IO is provided within titiler.xarray.io.Reader class with only support for Zarr dataset (via xarray+zarr-python).

For other dataset (e.g NetCDF), you can use titiler.xarray.io.FsReader which use the optional dependencies (fsspec, netcdf5).

python -m pip install "titiler.xarray[fs]"

Example of application with fsspec reader:

from fastapi import FastAPI
from titiler.xarray.extensions import VariablesExtension
from titiler.xarray.factory import TilerFactory
from titiler.xarray.io import FsReader

# Create FastAPI application
app = FastAPI(openapi_url="/api", docs_url="/api.html")

# Create custom endpoints with the FsReader
md = TilerFactory(
    reader=FsReader,
    router_prefix="/md",
    extensions=[
        # we also want to use the simple opener for the Extension
        VariablesExtension(dataset_opener=xarray.open_dataset),
    ],
)

app.include_router(md.router, prefix="/md", tags=["Multi Dimensional"])

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

titiler_xarray-2.0.0a1.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

titiler_xarray-2.0.0a1-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file titiler_xarray-2.0.0a1.tar.gz.

File metadata

  • Download URL: titiler_xarray-2.0.0a1.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for titiler_xarray-2.0.0a1.tar.gz
Algorithm Hash digest
SHA256 5b834447c84c774fcaef353fa0f9fd81ec314946826f8c4e6c1d55c173018733
MD5 71fa9a2ac284bc755acc79cea7a32d6e
BLAKE2b-256 c8d53441aabedba40ae5c29900b2a4d8669998482d301647be2dc7d8b4aab4fa

See more details on using hashes here.

File details

Details for the file titiler_xarray-2.0.0a1-py3-none-any.whl.

File metadata

  • Download URL: titiler_xarray-2.0.0a1-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for titiler_xarray-2.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 0b99bdb7ff226c4a1c323f8ddf84b7d7dc81ee89d2683444ce0b5ca1d7be5ade
MD5 32302cacd8f0814bda9a42cb5a3b26d5
BLAKE2b-256 4c8e0a7a283d351c3512827890e2f02ed0b03fd19b4caac45fd038a589453e8f

See more details on using hashes here.

Supported by

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