Closed fabricebrito closed 2 years ago
Hi @fabricebrito - thanks for trying out xpublish. Can I ask you to include a bit more information in your issue description? When I run your example, I get a server as expected:
In [1]: import click
...: import sys
...: import pandas as pd
...: import numpy as np
...: import xarray as xr
...: import xpublish
...:
...: ds = xr.Dataset({'foo': (('x', 'y'), np.random.rand(4, 5))},
...: coords={'x': [10, 20, 30, 40],
...: 'y': pd.date_range('2000-01-01', periods=5),
...: 'z': ('x', list('abcd'))})
...:
...:
...: ds.rest.serve(host='0.0.0.0', port=9000)
INFO: Started server process [93713]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:9000 (Press CTRL+C to quit)
If you can, please add:
xr.show_versions()
You may also try setting up the server this way to see if things work better for you:
In [2]: rest = xpublish.RestAccessor(ds)
In [3]: rest.serve()
INFO: Started server process [93815]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:9000 (Press CTRL+C to quit)
Hi @jhamman
I installed xpublish with conda and that's the behaviour I got. I'll reproduce it in a clean environment.
On the other hand, using pip -e with the source (as you do in .binder) everything is ok:
conda create -y -q -n env_xpublish
conda install -y -n env_xpublish -c conda-forge netcdf4 cachey dask fastapi numcodecs "numpy>=1.17" toolz uvicorn "xarray>=0.15" zarr
conda init bash
source ${HOME}/.bashrc{{conda }}
activate env_xpublish
git clone https://github.com/jhamman/xpublish.git
cd xpublish
pip install -e .
The xpublish approach looks quite promising and we're going to use it in the OGC Testbed 16 for Data Access and Processing API (DAPA) for Geospatial Data (https://portal.ogc.org/files/?artifact_id=91644#PartDAPA)
I'll keep you posted. Thanks!
@fabricebrito - thanks for updating this issue. After looking into this a bit more, I'm fairly sure there is something odd going on with your install script. I'm not able to reproduce the problem with this install path:
conda create -n xpublish_test xpublish netcdf4
conda activate xpublish_test
...
# run your script above
Hello @jhamman - The installation was ok in other environments. I can't really tell why it didn't before. Closing the issue.
PS having fun with intake-stac
@jhamman I believe the conda package should be updated with the latest code. While trying to serve landsat data via xpublish and intake-stac, I got an exception line 62 with the conda package v0.2 at the URL .zmetadata:
File "/home/fbrito/.conda/envs/env_intake/lib/python3.8/site-packages/xpublish/rest.py", line 155, in get_zmetadata
return self.zmetadata_json()
File "/home/fbrito/.conda/envs/env_intake/lib/python3.8/site-packages/xpublish/rest.py", line 83, in zmetadata_json
zjson = copy.deepcopy(self.zmetadata)
File "/home/fbrito/.conda/envs/env_intake/lib/python3.8/site-packages/xpublish/rest.py", line 78, in zmetadata
self._zmetadata = self._get_zmetadata()
File "/home/fbrito/.conda/envs/env_intake/lib/python3.8/site-packages/xpublish/rest.py", line 62, in _get_zmetadata
encoded_da, self._encoding.get(key, {}), da.encoding["dtype"]
KeyError: 'dtype'
I removed the conda package and installed via git clone + pip install -e . and the .zmetadata works as expected
Hope this helps
@fabricebrito xpublish 0.1.0 has been released and conda and pip packages are now available.
I guess it should solve your issue?
Hello,
xpublish looks very promising and I want to use it for serving a few datasets in an experiment. I've installed xpublish in a conda environment
I do run into the exception
AttributeError: 'Dataset' object has no attribute 'rest'
when running the simple script:Any help/tips is really appreciated