From a3b60aba98e54ee71ab4f81e52e574335ca9befe Mon Sep 17 00:00:00 2001 From: maif Date: Thu, 22 Jul 2021 16:20:35 +0100 Subject: [PATCH 01/14] first commit xyz router --- .gitignore | 3 + xpublish/rest.py | 3 +- xpublish/routers/__init__.py | 1 + xpublish/routers/xyz.py | 125 +++++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 xpublish/routers/xyz.py diff --git a/.gitignore b/.gitignore index 4d985df0..a4fc5038 100644 --- a/.gitignore +++ b/.gitignore @@ -115,6 +115,9 @@ venv.bak/ .spyderproject .spyproject +# Pycharm project settings +.idea + # Rope project settings .ropeproject diff --git a/xpublish/rest.py b/xpublish/rest.py index 7981531b..f2e7d4e7 100644 --- a/xpublish/rest.py +++ b/xpublish/rest.py @@ -4,7 +4,7 @@ from fastapi import FastAPI, HTTPException from .dependencies import get_cache, get_dataset, get_dataset_ids -from .routers import base_router, common_router, dataset_collection_router, zarr_router +from .routers import base_router, common_router, dataset_collection_router, zarr_router, xyz_router from .utils.api import ( SingleDatasetOpenAPIOverrider, check_route_conflicts, @@ -55,6 +55,7 @@ def _set_app_routers(dataset_routers=None, dataset_route_prefix=''): dataset_routers = [ (base_router, {'tags': ['info']}), (zarr_router, {'tags': ['zarr']}), + xyz_router ] app_routers += normalize_app_routers(dataset_routers, dataset_route_prefix) diff --git a/xpublish/routers/__init__.py b/xpublish/routers/__init__.py index 6a71e11b..4f88aaa7 100644 --- a/xpublish/routers/__init__.py +++ b/xpublish/routers/__init__.py @@ -1,3 +1,4 @@ from .base import base_router from .common import common_router, dataset_collection_router from .zarr import zarr_router +from .xyz import xyz_router \ No newline at end of file diff --git a/xpublish/routers/xyz.py b/xpublish/routers/xyz.py new file mode 100644 index 00000000..4b2b0c9e --- /dev/null +++ b/xpublish/routers/xyz.py @@ -0,0 +1,125 @@ +import xarray as xr + +from fastapi import APIRouter, Depends, Response +from xpublish.dependencies import get_dataset + + +from datashader import transfer_functions as tf +import pandas as pd +import datashader as ds +import morecantile + + +MERCANTILE_CRS = { + 3857: "WebMercatorQuad", + 32631: "UTM31WGS84Quad", + 3978: "CanadianNAD83_LCC", + 5482: "LINZAntarticaMapTilegrid", + 4326: "WorldCRS84Quad", + 5041: "UPSAntarcticWGS84Quad", + 3035: "EuropeanETRS89_LAEAQuad", + 3395: "WorldMercatorWGS84Quad", + 2193: "NZTM2000", + 5041: "UPSArcticWGS84Quad", +} + + +class XYZ_Router(APIRouter): + def __call__(self, epsg: int, palette, kwargs_datashader={}): + global tms + global col + self.kwargs_datashader = kwargs_datashader + if epsg not in MERCANTILE_CRS.keys(): + raise NotImplementedError + + col = palette + tms = morecantile.tms.get(MERCANTILE_CRS[epsg]) + + return self + + +xyz_router = XYZ_Router() + + +def get_bounds(zoom, x, y): + try: + latlon = tms.xy_bounds(morecantile.Tile(int(x), int(y), int(zoom))) + except: + tms = morecantile.tms.get("WebMercatorQuad") + latlon = tms.xy_bounds(morecantile.Tile(int(x), int(y), int(zoom))) + + return latlon + + +# get tiles +def gettiles(layer, dataset, zoom, x, y, kwargs_datashader): + """ + default spatial dimensions are x and y + """ + + plot_type = kwargs_datashader["plot_type"] + + latlon = get_bounds(zoom, x, y) + + xleft, xright, yleft, yright = latlon.left, latlon.right, latlon.bottom, latlon.top + csv = ds.Canvas( + plot_width=256, + plot_height=256, + x_range=(min(xleft, xright), max(xleft, xright)), + y_range=(min(yleft, yright), max(yleft, yright)), + ) + + if plot_type == "point": + + dataset = dataset[layer].to_dataframe().reset_index()[["x", "y", layer]] + + condition = '(x >= {xleft}) & (x <= {xright}) & (y >= {yleft}) & (y <= {yright})'.format( + xleft=xleft, yleft=yleft, xright=xright, yright=yright) + + frame = dataset.query(condition) + + frame = frame.dropna(axis=0) + + frame["groups"] = pd.cut(frame[layer], range(0, 100, 5), right=False) + + agg = csv.points(frame, 'x', 'y', agg=ds.count_cat("groups")) + + else: + frame = dataset[layer].sel( + x=slice(latlon.left, latlon.right), y=slice(latlon.top, latlon.bottom) + ) + + + agg = csv.raster(frame, upsample_method="nearest") + + img = tf.shade(agg, cmap=col, how="log") + + img_io = img.to_bytesio("PNG") + + img_io.seek(0) + + bytes = img_io.read() + + return bytes + + +class InputDataError(KeyError): + pass + + +def validate_dataset(dataset): + dims = dataset.dims + if not ("x" in dims or "y" in dims): + raise InputDataError + + +@xyz_router.get("/tiles/{layer}/{z}/{x}/{y}") +async def tiles( layer, z, x, y, dataset: xr.Dataset = Depends(get_dataset)): + + validate_dataset(dataset) + + kwargs_datashader = getattr(xyz_router, "kwargs_datashader") + + results = gettiles(layer, dataset, z, x, y, kwargs_datashader) + + return Response(content=results, media_type="image/png") From 1b2ee9f1b554e3a67fa69f896d29fa3c9e59ff5f Mon Sep 17 00:00:00 2001 From: maif Date: Sat, 24 Jul 2021 12:15:25 +0100 Subject: [PATCH 02/14] xyz example --- xpublish/routers/xyz.py | 98 ++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 64 deletions(-) diff --git a/xpublish/routers/xyz.py b/xpublish/routers/xyz.py index 4b2b0c9e..935d20cb 100644 --- a/xpublish/routers/xyz.py +++ b/xpublish/routers/xyz.py @@ -3,14 +3,13 @@ from fastapi import APIRouter, Depends, Response from xpublish.dependencies import get_dataset - from datashader import transfer_functions as tf -import pandas as pd import datashader as ds import morecantile -MERCANTILE_CRS = { +# From Morecantile, morecantile.tms.list() +WEB_CRS = { 3857: "WebMercatorQuad", 32631: "UTM31WGS84Quad", 3978: "CanadianNAD83_LCC", @@ -20,79 +19,52 @@ 3035: "EuropeanETRS89_LAEAQuad", 3395: "WorldMercatorWGS84Quad", 2193: "NZTM2000", - 5041: "UPSArcticWGS84Quad", } +# default +TMS = morecantile.tms.get("WebMercatorQuad") -class XYZ_Router(APIRouter): - def __call__(self, epsg: int, palette, kwargs_datashader={}): - global tms - global col - self.kwargs_datashader = kwargs_datashader - if epsg not in MERCANTILE_CRS.keys(): - raise NotImplementedError - - col = palette - tms = morecantile.tms.get(MERCANTILE_CRS[epsg]) - - return self - -xyz_router = XYZ_Router() +class DataValidationError(KeyError): + pass -def get_bounds(zoom, x, y): - try: - latlon = tms.xy_bounds(morecantile.Tile(int(x), int(y), int(zoom))) - except: - tms = morecantile.tms.get("WebMercatorQuad") - latlon = tms.xy_bounds(morecantile.Tile(int(x), int(y), int(zoom))) +class XYZRouter(APIRouter): + def map_options(self, crs_epsg: int, datashader_settings: dict = {}) -> None: + global TMS - return latlon + self.datashader_settings = datashader_settings + if crs_epsg not in WEB_CRS.keys(): + raise DataValidationError(f"User input {crs_epsg} not supported") -# get tiles -def gettiles(layer, dataset, zoom, x, y, kwargs_datashader): - """ - default spatial dimensions are x and y - """ + TMS = morecantile.tms.get(WEB_CRS[crs_epsg]) - plot_type = kwargs_datashader["plot_type"] - latlon = get_bounds(zoom, x, y) +xyz_router = XYZRouter() - xleft, xright, yleft, yright = latlon.left, latlon.right, latlon.bottom, latlon.top - csv = ds.Canvas( - plot_width=256, - plot_height=256, - x_range=(min(xleft, xright), max(xleft, xright)), - y_range=(min(yleft, yright), max(yleft, yright)), - ) - if plot_type == "point": +def _get_bounds(zoom, x, y): - dataset = dataset[layer].to_dataframe().reset_index()[["x", "y", layer]] + bbx = TMS.xy_bounds(morecantile.Tile(int(x), int(y), int(zoom))) - condition = '(x >= {xleft}) & (x <= {xright}) & (y >= {yleft}) & (y <= {yright})'.format( - xleft=xleft, yleft=yleft, xright=xright, yright=yright) + return bbx.left, bbx.right, bbx.bottom, bbx.top - frame = dataset.query(condition) - frame = frame.dropna(axis=0) +def _get_tiles(layer, dataset, zoom, x, y, datashader_settings): - frame["groups"] = pd.cut(frame[layer], range(0, 100, 5), right=False) + raster_param = datashader_settings.get("raster") + shade_param = datashader_settings.get("shade") - agg = csv.points(frame, 'x', 'y', agg=ds.count_cat("groups")) + xleft, xright, ybottom, ytop = _get_bounds(zoom, x, y) - else: - frame = dataset[layer].sel( - x=slice(latlon.left, latlon.right), y=slice(latlon.top, latlon.bottom) - ) + frame = dataset[layer].sel(x=slice(xleft, xright), y=slice(ytop, ybottom)) + csv = ds.Canvas(plot_width=256, plot_height=256) - agg = csv.raster(frame, upsample_method="nearest") + agg = csv.raster(frame, **raster_param) - img = tf.shade(agg, cmap=col, how="log") + img = tf.shade(agg, **shade_param) img_io = img.to_bytesio("PNG") @@ -103,23 +75,21 @@ def gettiles(layer, dataset, zoom, x, y, kwargs_datashader): return bytes -class InputDataError(KeyError): - pass - - -def validate_dataset(dataset): +def _validate_dataset(dataset): dims = dataset.dims - if not ("x" in dims or "y" in dims): - raise InputDataError + if "x" not in dims or "y" not in dims: + raise DataValidationError( + f" Expected spatial dimension names 'x' and 'y', found: {dims}" + ) @xyz_router.get("/tiles/{layer}/{z}/{x}/{y}") -async def tiles( layer, z, x, y, dataset: xr.Dataset = Depends(get_dataset)): +async def tiles(layer, z, x, y, dataset: xr.Dataset = Depends(get_dataset)): - validate_dataset(dataset) + _validate_dataset(dataset) - kwargs_datashader = getattr(xyz_router, "kwargs_datashader") + datashader_settings = getattr(xyz_router, "datashader_settings") - results = gettiles(layer, dataset, z, x, y, kwargs_datashader) + results = _get_tiles(layer, dataset, z, x, y, datashader_settings) return Response(content=results, media_type="image/png") From 920ac171a92ec355d37cc431ca1fab2f5b43cdb3 Mon Sep 17 00:00:00 2001 From: maif Date: Sat, 24 Jul 2021 12:54:18 +0100 Subject: [PATCH 03/14] example xyz --- xpublish/routers/xyz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xpublish/routers/xyz.py b/xpublish/routers/xyz.py index 935d20cb..5978a1a3 100644 --- a/xpublish/routers/xyz.py +++ b/xpublish/routers/xyz.py @@ -53,8 +53,8 @@ def _get_bounds(zoom, x, y): def _get_tiles(layer, dataset, zoom, x, y, datashader_settings): - raster_param = datashader_settings.get("raster") - shade_param = datashader_settings.get("shade") + raster_param = datashader_settings.get("raster", {}) + shade_param = datashader_settings.get("shade", {"cmap": ["blue", "red"]}) xleft, xright, ybottom, ytop = _get_bounds(zoom, x, y) From 7ad5dcd751a4d69cd0eb9eed459f1feaf6e76dd1 Mon Sep 17 00:00:00 2001 From: maif Date: Sat, 24 Jul 2021 12:56:20 +0100 Subject: [PATCH 04/14] added xyz example notebook --- examples/xyz_client.ipynb | 63 ++ examples/xyz_server.ipynb | 1393 +++++++++++++++++++++++++++++++++++++ 2 files changed, 1456 insertions(+) create mode 100644 examples/xyz_client.ipynb create mode 100644 examples/xyz_server.ipynb diff --git a/examples/xyz_client.ipynb b/examples/xyz_client.ipynb new file mode 100644 index 00000000..d6fde0dc --- /dev/null +++ b/examples/xyz_client.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 6, + "id": "09310ffc", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "8f7b68796bcd4a489d92f92f6e1ff0ab", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[52.204793, 360.121558], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title'…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from ipyleaflet import Map, LocalTileLayer\n", + "\n", + "m = Map(center=(52.204793, 360.121558), zoom=3)\n", + "m.add_layer(LocalTileLayer(path='http://127.0.0.1:9000/tiles/air/{z}/{x}/{y}'))\n", + "\n", + "m" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ef3bbeaa", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "xpublish", + "language": "python", + "name": "xpublish" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/examples/xyz_server.ipynb b/examples/xyz_server.ipynb new file mode 100644 index 00000000..b98665c9 --- /dev/null +++ b/examples/xyz_server.ipynb @@ -0,0 +1,1393 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "5f612787", + "metadata": {}, + "outputs": [], + "source": [ + "import xarray as xr\n", + "from colorcet import bmw, coolwarm\n", + "\n", + "from xpublish.routers import xyz_router" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "5357d6bf", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.Dataset>\n",
+       "Dimensions:  (lat: 25, lon: 53, time: 2920)\n",
+       "Coordinates:\n",
+       "  * lat      (lat) float32 75.0 72.5 70.0 67.5 65.0 ... 25.0 22.5 20.0 17.5 15.0\n",
+       "  * lon      (lon) float32 200.0 202.5 205.0 207.5 ... 322.5 325.0 327.5 330.0\n",
+       "  * time     (time) datetime64[ns] 2013-01-01 ... 2014-12-31T18:00:00\n",
+       "Data variables:\n",
+       "    air      (time, lat, lon) float32 dask.array<chunksize=(2920, 5, 5), meta=np.ndarray>\n",
+       "Attributes:\n",
+       "    Conventions:  COARDS\n",
+       "    title:        4x daily NMC reanalysis (1948)\n",
+       "    description:  Data is from NMC initialized reanalysis\\n(4x/day).  These a...\n",
+       "    platform:     Model\n",
+       "    references:   http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly...
" + ], + "text/plain": [ + "\n", + "Dimensions: (lat: 25, lon: 53, time: 2920)\n", + "Coordinates:\n", + " * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 ... 25.0 22.5 20.0 17.5 15.0\n", + " * lon (lon) float32 200.0 202.5 205.0 207.5 ... 322.5 325.0 327.5 330.0\n", + " * time (time) datetime64[ns] 2013-01-01 ... 2014-12-31T18:00:00\n", + "Data variables:\n", + " air (time, lat, lon) float32 dask.array\n", + "Attributes:\n", + " Conventions: COARDS\n", + " title: 4x daily NMC reanalysis (1948)\n", + " description: Data is from NMC initialized reanalysis\\n(4x/day). These a...\n", + " platform: Model\n", + " references: http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly..." + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ds = xr.tutorial.open_dataset(\n", + " \"air_temperature\", chunks=dict(lat=5, lon=5),\n", + ")\n", + "ds" + ] + }, + { + "cell_type": "markdown", + "id": "df7aedc6", + "metadata": {}, + "source": [ + "The xarray dataset should be a 2D array map." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "a5b70909", + "metadata": {}, + "outputs": [], + "source": [ + "ds = ds.isel(time=1)" + ] + }, + { + "cell_type": "markdown", + "id": "c8872a7f", + "metadata": {}, + "source": [ + "XYZ router accepts only spatial dimensions that are named 'x' and 'y'" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "5c5bba71", + "metadata": {}, + "outputs": [], + "source": [ + "ds = ds.rename({\"lat\": \"y\", \"lon\": \"x\"})" + ] + }, + { + "cell_type": "markdown", + "id": "679cf62c", + "metadata": {}, + "source": [ + "XYZ uses morecantile to tile the dataarray. Morecantile supports different grids, not only the Web Mercator which is the most common and it is used by Google Maps and OpenStreetMap.\n", + "In this example the dataset needs to be reprojected to match the Web Mercator projection." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "6a4bafa5", + "metadata": {}, + "outputs": [], + "source": [ + "ds.rio.set_spatial_dims(x_dim=\"x\", y_dim=\"y\", inplace=True)\n", + "ds.rio.write_crs(4326, inplace=True)\n", + "\n", + "ds = ds.rio.reproject(\n", + " # epsg: 3857\n", + " dst_crs= \"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs\" \n", + " )" + ] + }, + { + "cell_type": "markdown", + "id": "05d53466", + "metadata": {}, + "source": [ + "XYZ router accepts 2 map options to:\n", + "- crs_epsg: set the correct grid tiling \n", + "- datashader_settings: produce custom images setting the datashader parameters" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "eeccd6a1", + "metadata": {}, + "outputs": [], + "source": [ + "crs_epsg = 3857\n", + "\n", + "datashader_settings = {\n", + " # parameters for datashader.Canvas.raster method\n", + " \"raster\": {\"upsample_method\": \"nearest\"}, \n", + " # parameters for datashader.transfer_functions.shade\n", + " \"shade\": { \"cmap\": [\"blue\",\"red\"], \n", + " \"how\": \"log\", \n", + " \"span\": [float(ds[\"air\"].min()), float(ds[\"air\"].max())], \n", + " \"alpha\": 200 }, \n", + "}\n", + "\n", + "xyz_router.map_options(crs_epsg, datashader_settings=datashader_settings)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "aa987a9f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ds.rest(routers=[xyz_router])" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "8e78efe4", + "metadata": {}, + "outputs": [], + "source": [ + "import nest_asyncio \n", + "nest_asyncio.apply()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5c8769be", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO: Started server process [5467]\n", + "INFO: Waiting for application startup.\n", + "INFO: Application startup complete.\n", + "INFO: Uvicorn running on http://0.0.0.0:9000 (Press CTRL+C to quit)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39002 - \"GET /tiles/air/2/2/0 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39004 - \"GET /tiles/air/2/2/1 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39006 - \"GET /tiles/air/2/1/2 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 184, in calc_res\n", + " yres = (ycoords[0] - ycoords[-1]) / (h - 1)\n", + "IndexError: index 0 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39008 - \"GET /tiles/air/2/0/2 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 184, in calc_res\n", + " yres = (ycoords[0] - ycoords[-1]) / (h - 1)\n", + "IndexError: index 0 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39010 - \"GET /tiles/air/2/2/2 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39012 - \"GET /tiles/air/2/3/1 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39014 - \"GET /tiles/air/2/3/0 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39016 - \"GET /tiles/air/2/3/2 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39018 - \"GET /tiles/air/3/2/2 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39020 - \"GET /tiles/air/3/2/1 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39022 - \"GET /tiles/air/3/1/2 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39018 - \"GET /tiles/air/3/0/2 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39020 - \"GET /tiles/air/3/4/1 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39024 - \"GET /tiles/air/3/3/2 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39026 - \"GET /tiles/air/3/2/3 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39028 - \"GET /tiles/air/3/1/1 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39022 - \"GET /tiles/air/3/4/2 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n", + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39030 - \"GET /tiles/air/4/3/4 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39032 - \"GET /tiles/air/4/5/4 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39034 - \"GET /tiles/air/4/3/5 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39036 - \"GET /tiles/air/4/6/5 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39038 - \"GET /tiles/air/4/6/4 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39040 - \"GET /tiles/air/4/7/5 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39032 - \"GET /tiles/air/4/4/4 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39030 - \"GET /tiles/air/4/5/5 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39034 - \"GET /tiles/air/4/7/4 HTTP/1.1\" 500 Internal Server Error\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: Exception in ASGI application\n", + "Traceback (most recent call last):\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py\", line 369, in run_asgi\n", + " result = await app(self.scope, self.receive, self.send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py\", line 59, in __call__\n", + " return await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/applications.py\", line 199, in __call__\n", + " await super().__call__(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/applications.py\", line 112, in __call__\n", + " await self.middleware_stack(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 181, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/middleware/errors.py\", line 159, in __call__\n", + " await self.app(scope, receive, _send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__\n", + " raise exc from None\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__\n", + " await self.app(scope, receive, sender)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 580, in __call__\n", + " await route.handle(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 241, in handle\n", + " await self.app(scope, receive, send)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/starlette/routing.py\", line 52, in app\n", + " response = await func(request)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 216, in app\n", + " raw_response = await run_endpoint_function(\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/fastapi/routing.py\", line 149, in run_endpoint_function\n", + " return await dependant.call(**values)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 93, in tiles\n", + " results = _get_tiles(layer, dataset, z, x, y, datashader_settings)\n", + " File \"/perm/ma/maif/Work_proj/CDS/Git_repositories/xpublish/xpublish/routers/xyz.py\", line 65, in _get_tiles\n", + " agg = csv.raster(frame, **raster_param)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/core.py\", line 1015, in raster\n", + " res = calc_res(source)\n", + " File \"/perm/ma/maif/.local/anaconda3/envs/xpub_dev/lib/python3.8/site-packages/datashader/utils.py\", line 183, in calc_res\n", + " xres = (xcoords[-1] - xcoords[0]) / (w - 1)\n", + "IndexError: index -1 is out of bounds for axis 0 with size 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "INFO: 127.0.0.1:39036 - \"GET /tiles/air/4/4/5 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39036 - \"GET /tiles/air/4/2/4 HTTP/1.1\" 200 OK\n", + "INFO: 127.0.0.1:39030 - \"GET /tiles/air/4/2/5 HTTP/1.1\" 200 OK\n" + ] + } + ], + "source": [ + "ds.rest.serve()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b2a0c60c", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "381cdc9f", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "388ae2d7", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8e491856", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3eb6bbf9", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "69037e60", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "xpublish", + "language": "python", + "name": "xpublish" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 0a97331140344bda69c8ecaf5f9e4d735b1088c5 Mon Sep 17 00:00:00 2001 From: maif Date: Wed, 4 Aug 2021 17:10:58 +0100 Subject: [PATCH 05/14] first test with time dimension in endpoint --- examples/xyz_client.ipynb | 113 ++- examples/xyz_server.ipynb | 1562 +++++++++++++++++++++---------------- xpublish/routers/xyz.py | 33 +- 3 files changed, 1004 insertions(+), 704 deletions(-) diff --git a/examples/xyz_client.ipynb b/examples/xyz_client.ipynb index d6fde0dc..349e29ee 100644 --- a/examples/xyz_client.ipynb +++ b/examples/xyz_client.ipynb @@ -2,19 +2,19 @@ "cells": [ { "cell_type": "code", - "execution_count": 6, - "id": "09310ffc", + "execution_count": 11, + "id": "2c97c6a5", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "8f7b68796bcd4a489d92f92f6e1ff0ab", + "model_id": "478f19334e2c432c98b09dab29b4071b", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "Map(center=[52.204793, 360.121558], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title'…" + "Map(center=[39, -105.121558], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoo…" ] }, "metadata": {}, @@ -23,17 +23,118 @@ ], "source": [ "from ipyleaflet import Map, LocalTileLayer\n", + "from ipywidgets import Layout\n", + "defaultLayout=Layout(width='960px', height='540px')\n", "\n", - "m = Map(center=(52.204793, 360.121558), zoom=3)\n", + "m = Map(center=(39, -105.121558), zoom=2, layout=defaultLayout)\n", "m.add_layer(LocalTileLayer(path='http://127.0.0.1:9000/tiles/air/{z}/{x}/{y}'))\n", "\n", "m" ] }, + { + "cell_type": "code", + "execution_count": 1, + "id": "1c9d35f6", + "metadata": {}, + "outputs": [], + "source": [ + "from traitlets import Unicode\n", + "from ipyleaflet import Map, WMSLayer, basemaps\n", + "from ipyleaflet import Map, LocalTileLayer\n", + "from ipywidgets import Layout\n", + "defaultLayout=Layout(width='960px', height='540px')\n", + "\n", + "\n", + "class TimeWMTSLayer(LocalTileLayer):\n", + "\n", + " time = Unicode('').tag(sync=True, o=True)\n", + "\n", + "\n", + " \n", + "wmts = TimeWMTSLayer(path='http://127.0.0.1:9000/tiles/air/{time}/{z}/{x}/{y}')\n", + " \n", + " \n", + "m = Map(basemap=basemaps.CartoDB.Positron, center=(39, -105.121558), zoom=2, layout=defaultLayout)\n", + "\n", + "m.add_layer(wmts)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "4a84ba22", + "metadata": {}, + "outputs": [], + "source": [ + "from ipywidgets import SelectionSlider\n", + "from pandas import date_range\n", + "\n", + "times = date_range(\"2013-01-01\",\"2013-12-31\",freq=\"6H\").strftime(\"%Y-%m-%dT%H:%M\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "44be1ef0", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "e2f486ca87ef45b2a08e7f451d3995a1", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "SelectionSlider(description='Time:', options=('2013-01-01T00:00', '2013-01-01T06:00', '2013-01-01T12:00', '201…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "slider = SelectionSlider(description='Time:', options=times)\n", + "\n", + "def update_wms(change):\n", + " wmts.time = '{}'.format(slider.value)\n", + " wmts.redraw()\n", + "\n", + "\n", + "slider.observe(update_wms, 'value')\n", + "slider" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "cc28cc1f", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "73bc3dfbe6b54c2da9294624c77516ba", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[39, -105.121558], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoo…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "m" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "ef3bbeaa", + "id": "979a7391", "metadata": {}, "outputs": [], "source": [] diff --git a/examples/xyz_server.ipynb b/examples/xyz_server.ipynb index b98665c9..47b03184 100644 --- a/examples/xyz_server.ipynb +++ b/examples/xyz_server.ipynb @@ -3,20 +3,21 @@ { "cell_type": "code", "execution_count": 1, - "id": "5f612787", + "id": "08cc864d", "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "from colorcet import bmw, coolwarm\n", "\n", - "from xpublish.routers import xyz_router" + "from xpublish.routers import xyz_router\n", + "from xpublish.routers.xyz import validate_dataset" ] }, { "cell_type": "code", "execution_count": 2, - "id": "5357d6bf", + "id": "6ef38b3a", "metadata": {}, "outputs": [ { @@ -386,17 +387,17 @@ " title: 4x daily NMC reanalysis (1948)\n", " description: Data is from NMC initialized reanalysis\\n(4x/day). These a...\n", " platform: Model\n", - " references: http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly...