xpublish.dependencies.get_datatree#

xpublish.dependencies.get_datatree(dataset_id)[source]#

FastAPI dependency for accessing the published xarray DataTree object.

Use this callable as dependency in any FastAPI path operation function where you need access to the xarray DataTree being served.

When the route includes a {group_path:path} path parameter, the DataTree returned is rooted at that group. Otherwise the full tree associated with the dataset_id is returned.

This dummy dependency will be overridden when creating the FastAPI application.

Parameters:

dataset_id (str) – Unique path-safe key identifying dataset

Return type:

DataTree

Returns:

Requested Xarray DataTree