Description
openedon May 30, 2023
Hello GeoViews team! Thanks for taking the time to continuously maintain and improve this library. I'm having some difficulty trying to display TIFF files with the recent release (1.10.0), and I was hoping you could help me out.
ALL software version info
Geoviews 1.10.0 (Build pyhd8ed1ab_0, Channel conda-forge)
Bokeh 3.1.1 (Build pyhd8ed1ab_0, Channel conda-forge)
Rioxarray 0.14.1 (Build pyhd8ed1ab_0, Channel conda-forge)
Python 3.10.11 (Build h4de0772_0_cpython, Channel conda-forge)
JupyterLab 4.0.0 (Build pyhd8ed1ab_1, Channel conda-forge)
OS: Windows 11 Home (Version 22H2, Build 22621.1702)
Browser: Google Chrome (Version 113.0.5672.127, Official Build, 64-bit)
Description of expected behavior and the observed behavior
I was able to display GeoTIFFs with geoviews.util.load_tiff()
before it got deprecated.
With the new release of GeoViews, I tried using the suggested geoviews.util.from_xarray(rioxarray.open_rasterio(filename))
but I was not able to get the same Image element as before. I got a Dataset element instead, so I cannot apply any image options to it (see stack traceback below).
Complete, minimal, self-contained example code that reproduces the issue
import geoviews as gv
import rioxarray as rxr
import cartopy.crs as ccrs
gv.extension("bokeh")
geotiff_img = gv.util.from_xarray(
da = rxr.open_rasterio(filename = "https://github.com/mapbox/rasterio/raw/1.2.1/tests/data/RGB.byte.tif"),
vdims = "Some Value",
crs = ccrs.epsg(32618)
).opts(width = 500, height = 500, xaxis = None, yaxis = None)
geotiff_img
Stack traceback and/or browser JavaScript console output
ValueError Traceback (most recent call last)
Cell In[1], line 6
3 import cartopy.crs as ccrs
4 gv.extension("bokeh")
----> 6 geotiff_img = gv.util.from_xarray(
7 da = rxr.open_rasterio(filename = "https://github.com/mapbox/rasterio/raw/1.2.1/tests/data/RGB.byte.tif"),
8 vdims = "Some Value",
9 crs = ccrs.epsg(32618)
10 ).opts(width = 500, height = 500, xaxis = None, yaxis = None)
11 geotiff_img
File ~\anaconda3\envs\test\lib\site-packages\holoviews\core\accessors.py:43, in AccessorPipelineMeta.pipelined.<locals>.pipelined_call(*args, **kwargs)
40 inst._obj._in_method = True
42 try:
---> 43 result = __call__(*args, **kwargs)
45 if not in_method:
46 init_op = factory.instance(
47 output_type=type(inst),
48 kwargs={'mode': getattr(inst, 'mode', None)},
49 )
File ~\anaconda3\envs\test\lib\site-packages\holoviews\core\accessors.py:568, in Opts.__call__(self, *args, **kwargs)
562 msg = ("Calling the .opts method with options broken down by options "
563 "group (i.e. separate plot, style and norm groups) is deprecated. "
564 "Use the .options method converting to the simplified format "
565 "instead or use hv.opts.apply_groups for backward compatibility.")
566 param.main.param.warning(msg)
--> 568 return self._dispatch_opts( *args, **kwargs)
File ~\anaconda3\envs\test\lib\site-packages\holoviews\core\accessors.py:572, in Opts._dispatch_opts(self, *args, **kwargs)
570 def _dispatch_opts(self, *args, **kwargs):
571 if self._mode is None:
--> 572 return self._base_opts(*args, **kwargs)
573 elif self._mode == 'holomap':
574 return self._holomap_opts(*args, **kwargs)
File ~\anaconda3\envs\test\lib\site-packages\holoviews\core\accessors.py:651, in Opts._base_opts(self, *args, **kwargs)
648 return opts.apply_groups(self._obj, **dict(kwargs, **new_kwargs))
650 kwargs['clone'] = False if clone is None else clone
--> 651 return self._obj.options(*new_args, **kwargs)
File ~\anaconda3\envs\test\lib\site-packages\holoviews\core\data\__init__.py:199, in PipelineMeta.pipelined.<locals>.pipelined_fn(*args, **kwargs)
196 inst._in_method = True
198 try:
--> 199 result = method_fn(*args, **kwargs)
200 if PipelineMeta.disable:
201 return result
File ~\anaconda3\envs\test\lib\site-packages\holoviews\core\data\__init__.py:1203, in Dataset.options(self, *args, **kwargs)
1201 @wraps(Dimensioned.options)
1202 def options(self, *args, **kwargs):
-> 1203 return super().options(*args, **kwargs)
File ~\anaconda3\envs\test\lib\site-packages\holoviews\core\dimension.py:1276, in Dimensioned.options(self, clone, *args, **kwargs)
1274 expanded_backends = opts._expand_by_backend(options, backend)
1275 else:
-> 1276 expanded_backends = [(backend, opts._expand_options(options, backend))]
1278 obj = self
1279 for backend, expanded in expanded_backends:
File ~\anaconda3\envs\test\lib\site-packages\holoviews\util\__init__.py:347, in opts._expand_options(cls, options, backend)
345 objtype = objspec.split('.')[0]
346 if objtype not in backend_options:
--> 347 raise ValueError(f'{objtype} type not found, could not apply options.')
348 obj_options = backend_options[objtype]
349 expanded[objspec] = {g: {} for g in obj_options.groups}
ValueError: Dataset type not found, could not apply options.
Screenshots or screencasts of the bug in action
I ran the example code in a Jupyter notebook and nothing except for the error gets outputted.