titiler.xarray


Nametitiler.xarray JSON
Version 0.19.0 PyPI version JSON
download
home_pageNone
SummaryXarray plugin for TiTiler.
upload_time2024-11-07 17:21:16
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords titiler xarray zarr netcdf hdf
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## titiler.xarray

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

## Installation

```bash
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[full]"
```

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

- **full**: `zarr`, `h5netcdf`,  `fsspec`, `s3fs`, `aiohttp`, `gcsfs`
- **minimal**: `zarr`, `h5netcdf`,  `fsspec`
- **gcs**: `gcsfs`
- **s3**: `s3fs`
- **http**: `aiohttp`

## How To

```python
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
        ├── extentions.py        - titiler-xarray extensions
        ├── io.py                - titiler-xarray Readers
        └── factory.py           - endpoints factory
```

## Custom Dataset Opener

A default Dataset IO is provided within `titiler.xarray.Reader` class but will require optional dependencies (`fsspec`, `zarr`, `h5netcdf`, ...) to be installed with `python -m pip install "titiler.xarray[full]"`.
Dependencies are optional so the entire package size can be optimized to only include dependencies required by a given application.

Example:

**requirements**:
- `titiler.xarray` (base)
- `h5netcdf`


```python
from typing import Callable
import attr
from fastapi import FastAPI
from titiler.xarray.io import Reader
from titiler.xarray.extensions import VariablesExtension
from titiler.xarray.factory import TilerFactory

import xarray
import h5netcdf  # noqa

# Create a simple Custom reader, using `xarray.open_dataset` opener
@attr.s
class CustomReader(Reader):
    """Custom io.Reader using xarray.open_dataset opener."""
    # xarray.Dataset options
    opener: Callable[..., xarray.Dataset] = attr.ib(default=xarray.open_dataset)


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

# Create custom endpoints with the CustomReader
md = TilerFactory(
    reader=CustomReader,
    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"])
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "titiler.xarray",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "TiTiler, Xarray, Zarr, NetCDF, HDF",
    "author": null,
    "author_email": "Vincent Sarago <vincent@developmentseed.com>,Aimee Barciauskas <aimee@developmentseed.com>",
    "download_url": "https://files.pythonhosted.org/packages/67/0f/5c715bb36204da62d66a773fa790b69454ceac31df930f95fdefeb9f102d/titiler.xarray-0.19.0.tar.gz",
    "platform": null,
    "description": "## titiler.xarray\n\nAdds support for Xarray Dataset (NetCDF/Zarr) in Titiler.\n\n## Installation\n\n```bash\npython -m pip install -U pip\n\n# From Pypi\npython -m pip install \"titiler.xarray[full]\"\n\n# Or from sources\ngit clone https://github.com/developmentseed/titiler.git\ncd titiler && python -m pip install -e src/titiler/core -e \"src/titiler/xarray[full]\"\n```\n\n#### Installation options\n\nDefault 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]\"`).\n\nHere is the list of available options:\n\n- **full**: `zarr`, `h5netcdf`,  `fsspec`, `s3fs`, `aiohttp`, `gcsfs`\n- **minimal**: `zarr`, `h5netcdf`,  `fsspec`\n- **gcs**: `gcsfs`\n- **s3**: `s3fs`\n- **http**: `aiohttp`\n\n## How To\n\n```python\nfrom fastapi import FastAPI\n\nfrom titiler.xarray.extensions import VariablesExtension\nfrom titiler.xarray.factory import TilerFactory\n\napp = FastAPI(\n    openapi_url=\"/api\",\n    docs_url=\"/api.html\",\n    description=\"\"\"Xarray based tiles server for MultiDimensional dataset (Zarr/NetCDF).\n\n---\n\n**Documentation**: <a href=\"https://developmentseed.org/titiler/\" target=\"_blank\">https://developmentseed.org/titiler/</a>\n\n**Source Code**: <a href=\"https://github.com/developmentseed/titiler\" target=\"_blank\">https://github.com/developmentseed/titiler</a>\n\n---\n    \"\"\",\n)\n\nmd = TilerFactory(\n    router_prefix=\"/md\",\n    extensions=[\n        VariablesExtension(),\n    ],\n)\napp.include_router(md.router, prefix=\"/md\", tags=[\"Multi Dimensional\"])\n```\n\n## Package structure\n\n```\ntitiler/\n \u2514\u2500\u2500 xarray/\n    \u251c\u2500\u2500 tests/                   - Tests suite\n    \u2514\u2500\u2500 titiler/xarray/          - `xarray` namespace package\n        \u251c\u2500\u2500 dependencies.py      - titiler-xarray dependencies\n        \u251c\u2500\u2500 extentions.py        - titiler-xarray extensions\n        \u251c\u2500\u2500 io.py                - titiler-xarray Readers\n        \u2514\u2500\u2500 factory.py           - endpoints factory\n```\n\n## Custom Dataset Opener\n\nA default Dataset IO is provided within `titiler.xarray.Reader` class but will require optional dependencies (`fsspec`, `zarr`, `h5netcdf`, ...) to be installed with `python -m pip install \"titiler.xarray[full]\"`.\nDependencies are optional so the entire package size can be optimized to only include dependencies required by a given application.\n\nExample:\n\n**requirements**:\n- `titiler.xarray` (base)\n- `h5netcdf`\n\n\n```python\nfrom typing import Callable\nimport attr\nfrom fastapi import FastAPI\nfrom titiler.xarray.io import Reader\nfrom titiler.xarray.extensions import VariablesExtension\nfrom titiler.xarray.factory import TilerFactory\n\nimport xarray\nimport h5netcdf  # noqa\n\n# Create a simple Custom reader, using `xarray.open_dataset` opener\n@attr.s\nclass CustomReader(Reader):\n    \"\"\"Custom io.Reader using xarray.open_dataset opener.\"\"\"\n    # xarray.Dataset options\n    opener: Callable[..., xarray.Dataset] = attr.ib(default=xarray.open_dataset)\n\n\n# Create FastAPI application\napp = FastAPI(openapi_url=\"/api\", docs_url=\"/api.html\")\n\n# Create custom endpoints with the CustomReader\nmd = TilerFactory(\n    reader=CustomReader,\n    router_prefix=\"/md\",\n    extensions=[\n        # we also want to use the simple opener for the Extension\n        VariablesExtension(dataset_opener==xarray.open_dataset),\n    ],\n)\n\napp.include_router(md.router, prefix=\"/md\", tags=[\"Multi Dimensional\"])\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Xarray plugin for TiTiler.",
    "version": "0.19.0",
    "project_urls": {
        "Changelog": "https://developmentseed.org/titiler/release-notes/",
        "Documentation": "https://developmentseed.org/titiler/",
        "Homepage": "https://developmentseed.org/titiler/",
        "Issues": "https://github.com/developmentseed/titiler/issues",
        "Source": "https://github.com/developmentseed/titiler"
    },
    "split_keywords": [
        "titiler",
        " xarray",
        " zarr",
        " netcdf",
        " hdf"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f9ff06cbad48276ff9a9bb823baf8036ff07c73caa79eb0ba3330cf56e10965c",
                "md5": "9f594f5e37bf1de6a7272874f174f47d",
                "sha256": "7d4056ec6320fe05fa380adaf99d8747a681c77489f5b499214026fe49c5d0a6"
            },
            "downloads": -1,
            "filename": "titiler.xarray-0.19.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9f594f5e37bf1de6a7272874f174f47d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9930,
            "upload_time": "2024-11-07T17:21:14",
            "upload_time_iso_8601": "2024-11-07T17:21:14.922202Z",
            "url": "https://files.pythonhosted.org/packages/f9/ff/06cbad48276ff9a9bb823baf8036ff07c73caa79eb0ba3330cf56e10965c/titiler.xarray-0.19.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "670f5c715bb36204da62d66a773fa790b69454ceac31df930f95fdefeb9f102d",
                "md5": "0577ce01afcca08820244f72f9c300a0",
                "sha256": "9a749d4953e60c35ae598fad494a590041715260cec435f362b4cccbcc986521"
            },
            "downloads": -1,
            "filename": "titiler.xarray-0.19.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0577ce01afcca08820244f72f9c300a0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9402,
            "upload_time": "2024-11-07T17:21:16",
            "upload_time_iso_8601": "2024-11-07T17:21:16.954370Z",
            "url": "https://files.pythonhosted.org/packages/67/0f/5c715bb36204da62d66a773fa790b69454ceac31df930f95fdefeb9f102d/titiler.xarray-0.19.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-07 17:21:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "developmentseed",
    "github_project": "titiler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "titiler.xarray"
}
        
Elapsed time: 0.46230s