holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.7k stars 403 forks source link

Add ability to handle unit tuples in hvplot with xarray data. #4869

Closed asmith26 closed 3 years ago

asmith26 commented 3 years ago

ALL software version info

`mamba list` ``` # Name Version Build Channel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 1_gnu conda-forge affine 2.3.0 py_0 conda-forge aiohttp 3.7.4.post0 pypi_0 pypi anyio 2.2.0 py39hf3d152e_0 conda-forge argon2-cffi 20.1.0 py39hbd71b63_2 conda-forge asciitree 0.3.3 py_2 conda-forge async-timeout 3.0.1 pypi_0 pypi async_generator 1.10 py_0 conda-forge attrs 20.3.0 pyhd3deb0d_0 conda-forge babel 2.9.0 pyhd3deb0d_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.1 py_0 conda-forge bleach 3.3.0 pyh44b312d_0 conda-forge bokeh 2.3.0 py39hf3d152e_0 conda-forge boost-cpp 1.72.0 h9d3c048_4 conda-forge brotlipy 0.7.0 py39h3811e60_1001 conda-forge bzip2 1.0.8 h7f98852_4 conda-forge c-ares 1.17.1 h7f98852_1 conda-forge ca-certificates 2020.12.5 ha878542_0 conda-forge cairo 1.16.0 h7979940_1007 conda-forge cartopy 0.18.0 py39h3b23250_13 conda-forge certifi 2020.12.5 py39hf3d152e_1 conda-forge cffi 1.14.5 py39he32792d_0 conda-forge cfgrib 0.9.8.5 pyhd8ed1ab_0 conda-forge cfitsio 3.470 hb418390_7 conda-forge cftime 1.4.1 py39hce5d2b2_0 conda-forge chardet 4.0.0 py39hf3d152e_1 conda-forge click 7.1.2 pyh9f0ad1d_0 conda-forge click-plugins 1.1.1 py_0 conda-forge cligj 0.7.1 pyhd8ed1ab_0 conda-forge cloudpickle 1.6.0 py_0 conda-forge colorcet 2.0.6 pyhd8ed1ab_0 conda-forge coverage 5.5 py39h3811e60_0 conda-forge cryptography 3.4.6 py39hbca0aa6_0 conda-forge curl 7.75.0 h979ede3_0 conda-forge cycler 0.10.0 py_2 conda-forge cytoolz 0.11.0 py39h3811e60_3 conda-forge dask 2021.3.0 pyhd8ed1ab_0 conda-forge dask-core 2021.3.0 pyhd8ed1ab_0 conda-forge dask-labextension 5.0.1 pypi_0 pypi datashader 0.12.0 pyhd3deb0d_0 conda-forge datashape 0.5.4 py_1 conda-forge dbus 1.13.6 hfdff14a_1 conda-forge decorator 4.4.2 py_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge distributed 2021.3.0 py39hf3d152e_0 conda-forge eccodes 2.20.0 ha0e6eb6_0 conda-forge entrypoints 0.3 py39hde42818_1002 conda-forge exiv2 0.27.1 had08079_0 conda-forge expat 2.2.10 h9c3ff4c_0 conda-forge fasteners 0.14.1 py_3 conda-forge fiona 1.8.18 py39h494ca2c_1 conda-forge fontconfig 2.13.1 hba837de_1004 conda-forge freetype 2.10.4 h0708190_1 conda-forge freexl 1.0.6 h7f98852_0 conda-forge fsspec 0.8.7 pyhd8ed1ab_0 conda-forge future 0.18.2 py39hf3d152e_3 conda-forge gdal 3.2.1 py39h409cc32_7 conda-forge geopandas 0.9.0 pyhd8ed1ab_0 conda-forge geos 3.9.1 h9c3ff4c_2 conda-forge geotiff 1.6.0 h11d48b3_4 conda-forge geoviews 1.9.1 pyhd8ed1ab_0 conda-forge geoviews-core 1.9.1 pyha770c72_0 conda-forge gettext 0.19.8.1 h0b5b191_1005 conda-forge giflib 5.2.1 h516909a_2 conda-forge glib 2.66.7 h9c3ff4c_1 conda-forge glib-tools 2.66.7 h9c3ff4c_1 conda-forge gsl 2.6 he838d99_2 conda-forge gst-plugins-base 1.18.3 h04508c2_0 conda-forge gstreamer 1.18.3 h3560a44_0 conda-forge hdf4 4.2.13 h10796ff_1004 conda-forge hdf5 1.10.6 nompi_h6a2412b_1114 conda-forge heapdict 1.0.1 py_0 conda-forge holoviews 1.14.2 pyhd8ed1ab_0 conda-forge httplib2 0.19.0 pyhd8ed1ab_0 conda-forge hvplot 0.7.1 pyh44b312d_0 conda-forge icu 68.1 h58526e2_0 conda-forge idna 2.10 pyh9f0ad1d_0 conda-forge importlib-metadata 3.7.3 py39hf3d152e_0 conda-forge ipykernel 5.5.0 py39hef51801_1 conda-forge ipython 7.21.0 py39hef51801_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge jasper 1.900.1 h07fcdf6_1006 conda-forge jedi 0.18.0 py39hf3d152e_2 conda-forge jinja2 2.11.3 pyh44b312d_0 conda-forge jpeg 9d h516909a_0 conda-forge json-c 0.15 h98cffda_0 conda-forge json5 0.9.5 pyh9f0ad1d_0 conda-forge jsoncpp 1.9.4 h4bd325d_1 conda-forge jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge jupyter-packaging 0.7.12 pyhd8ed1ab_0 conda-forge jupyter-server-proxy 3.0.0 pypi_0 pypi jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge jupyter_core 4.7.1 py39hf3d152e_0 conda-forge jupyter_server 1.4.1 py39hf3d152e_0 conda-forge jupyterlab 3.0.10 pyhd8ed1ab_0 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge jupyterlab_server 2.3.0 pyhd8ed1ab_0 conda-forge kealib 1.4.14 hcc255d8_2 conda-forge kiwisolver 1.3.1 py39h1a9c180_1 conda-forge krb5 1.17.2 h926e7f8_0 conda-forge laszip 3.4.3 he1b5a44_1 conda-forge laz-perf 1.5.0 he1b5a44_0 conda-forge lcms2 2.12 hddcbb42_0 conda-forge ld_impl_linux-64 2.35.1 hea4e1c9_2 conda-forge libaec 1.0.4 he1b5a44_1 conda-forge libblas 3.9.0 8_openblas conda-forge libcblas 3.9.0 8_openblas conda-forge libclang 11.1.0 default_ha53f305_0 conda-forge libcurl 7.75.0 hc4aaa36_0 conda-forge libdap4 3.20.6 hd7c4107_1 conda-forge libedit 3.1.20191231 he28a2e2_2 conda-forge libev 4.33 h516909a_1 conda-forge libevent 2.1.10 hcdb4288_3 conda-forge libffi 3.3 h58526e2_2 conda-forge libgcc-ng 9.3.0 h2828fa1_18 conda-forge libgdal 3.2.1 h38ff51b_7 conda-forge libgfortran-ng 9.3.0 hff62375_18 conda-forge libgfortran5 9.3.0 hff62375_18 conda-forge libglib 2.66.7 h3e27bee_1 conda-forge libgomp 9.3.0 h2828fa1_18 conda-forge libiconv 1.16 h516909a_0 conda-forge libkml 1.3.0 hd79254b_1012 conda-forge liblapack 3.9.0 8_openblas conda-forge libllvm10 10.0.1 he513fc3_3 conda-forge libllvm11 11.1.0 hf817b99_0 conda-forge libnetcdf 4.7.4 nompi_h56d31a8_107 conda-forge libnghttp2 1.43.0 h812cca2_0 conda-forge libopenblas 0.3.12 pthreads_h4812303_1 conda-forge libpng 1.6.37 hed695b0_2 conda-forge libpq 13.1 hfd2b0eb_2 conda-forge libprotobuf 3.15.6 h780b84a_0 conda-forge librttopo 1.1.0 h1185371_6 conda-forge libsodium 1.0.18 h516909a_1 conda-forge libspatialindex 1.9.3 he1b5a44_3 conda-forge libspatialite 5.0.1 he52d314_3 conda-forge libssh2 1.9.0 ha56f1ee_6 conda-forge libstdcxx-ng 9.3.0 h6de172a_18 conda-forge libtiff 4.2.0 hdc55705_0 conda-forge libuuid 2.32.1 h14c3975_1000 conda-forge libwebp 1.2.0 h3452ae3_0 conda-forge libwebp-base 1.2.0 h7f98852_0 conda-forge libxcb 1.13 h7f98852_1003 conda-forge libxkbcommon 1.0.3 he3ba5ed_0 conda-forge libxml2 2.9.10 h72842e0_3 conda-forge libxslt 1.1.33 h15afd5d_2 conda-forge libzip 1.7.3 he9f05b3_0 conda-forge llvmlite 0.36.0 py39h1bbdace_0 conda-forge locket 0.2.0 py_2 conda-forge lz4-c 1.9.3 h9c3ff4c_0 conda-forge markdown 3.3.4 pyhd8ed1ab_0 conda-forge markupsafe 1.1.1 py39h3811e60_3 conda-forge matplotlib-base 3.3.4 py39h2fa2bec_0 conda-forge mistune 0.8.4 py39h3811e60_1003 conda-forge mock 4.0.3 py39hf3d152e_1 conda-forge monotonic 1.5 py_0 conda-forge msgpack-python 1.0.2 py39h1a9c180_1 conda-forge multidict 5.1.0 pypi_0 pypi multipledispatch 0.6.0 py_0 conda-forge munch 2.5.0 py_0 conda-forge mysql-common 8.0.23 ha770c72_1 conda-forge mysql-libs 8.0.23 h935591d_1 conda-forge nbclassic 0.2.6 pyhd8ed1ab_0 conda-forge nbclient 0.5.3 pyhd8ed1ab_0 conda-forge nbconvert 6.0.7 py39hf3d152e_3 conda-forge nbformat 5.1.2 pyhd8ed1ab_1 conda-forge ncurses 6.2 h58526e2_4 conda-forge nest-asyncio 1.4.3 pyhd8ed1ab_0 conda-forge netcdf4 1.5.6 nompi_py39h36800e2_100 conda-forge nitro 2.7.dev6 he1b5a44_3 conda-forge nose2 0.9.2 py_0 conda-forge notebook 6.2.0 py39hf3d152e_0 conda-forge nspr 4.29 he1b5a44_1 conda-forge nss 3.62 hb5efdd6_0 conda-forge numba 0.53.0 py39h4292f66_0 conda-forge numcodecs 0.7.3 py39he80948d_0 conda-forge numpy 1.20.1 py39hdbf815f_0 conda-forge olefile 0.46 pyh9f0ad1d_1 conda-forge openjpeg 2.4.0 hf7af979_0 conda-forge openssl 1.1.1j h7f98852_0 conda-forge owslib 0.23.0 pyhd8ed1ab_0 conda-forge packaging 20.9 pyh44b312d_0 conda-forge pandas 1.2.3 py39hde0f152_0 conda-forge pandoc 2.12 h7f98852_0 conda-forge pandocfilters 1.4.2 py_1 conda-forge panel 0.11.0 pyhd8ed1ab_0 conda-forge param 1.10.1 pyhd3deb0d_0 conda-forge parso 0.8.1 pyhd8ed1ab_0 conda-forge partd 1.1.0 py_0 conda-forge pcre 8.44 he1b5a44_0 conda-forge pdal 2.2.0 h638e970_7 conda-forge pexpect 4.8.0 pyh9f0ad1d_2 conda-forge pickleshare 0.7.5 py39hde42818_1002 conda-forge pillow 8.1.2 py39hf95b381_0 conda-forge pip 21.0.1 pyhd8ed1ab_0 conda-forge pixman 0.40.0 h36c2ea0_0 conda-forge plotly 4.14.3 pyh44b312d_0 conda-forge poppler 0.89.0 h2de54a5_5 conda-forge poppler-data 0.4.10 0 conda-forge postgresql 13.1 h6303168_2 conda-forge proj 7.2.0 h277dcde_2 conda-forge prometheus_client 0.9.0 pyhd3deb0d_0 conda-forge prompt-toolkit 3.0.17 pyha770c72_0 conda-forge psutil 5.8.0 py39h3811e60_1 conda-forge psycopg2 2.8.6 py39h3811e60_2 conda-forge pthread-stubs 0.4 h36c2ea0_1001 conda-forge ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge pycparser 2.20 pyh9f0ad1d_2 conda-forge pyct 0.4.6 py_0 conda-forge pyct-core 0.4.6 py_0 conda-forge pygments 2.8.1 pyhd8ed1ab_0 conda-forge pyopenssl 20.0.1 pyhd8ed1ab_0 conda-forge pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge pyproj 3.0.1 py39h50a64a9_0 conda-forge pyqt 5.12.3 py39hf3d152e_7 conda-forge pyqt-impl 5.12.3 py39h0fcd23e_7 conda-forge pyqt5-sip 4.19.18 py39he80948d_7 conda-forge pyqtchart 5.12 py39h0fcd23e_7 conda-forge pyqtwebengine 5.12.1 py39h0fcd23e_7 conda-forge pyqtwebkit 5.212 py39h20c28b1_1 conda-forge pyrsistent 0.17.3 py39h3811e60_2 conda-forge pyshp 2.1.3 pyh44b312d_0 conda-forge pysocks 1.7.1 py39hf3d152e_3 conda-forge python 3.9.2 hffdb5ce_0_cpython conda-forge python-dateutil 2.8.1 py_0 conda-forge python_abi 3.9 1_cp39 conda-forge pytz 2021.1 pyhd8ed1ab_0 conda-forge pyviz_comms 2.0.1 pyhd3deb0d_0 conda-forge pyyaml 5.4.1 py39h3811e60_0 conda-forge pyzmq 22.0.3 py39h37b5a0c_1 conda-forge qca 2.2.1 h73816c6_3 conda-forge qgis 3.18.0 py39hce95e4c_3 conda-forge qjson 0.9.0 h73816c6_1006 conda-forge qscintilla2 2.11.2 py39hf01f197_4 conda-forge qt 5.12.9 hda022c4_4 conda-forge qtkeychain 0.12.0 h2264404_0 conda-forge qtlocation 5.12.9 he1b5a44_0 conda-forge qtserialport 5.9.8 h73816c6_1 conda-forge qtwebkit 5.212 h8f65c2e_1 conda-forge qwt 6.1.6 h7ec6b3e_0 conda-forge qwtpolar 1.1.1 h73816c6_7 conda-forge rasterio 1.2.1 py39h63973eb_2 conda-forge readline 8.0 he28a2e2_2 conda-forge requests 2.25.1 pyhd3deb0d_0 conda-forge retrying 1.3.3 py_2 conda-forge rtree 0.9.7 py39hb102c33_1 conda-forge scipy 1.6.0 py39hee8e79c_0 conda-forge send2trash 1.5.0 py_0 conda-forge setuptools 49.6.0 py39hf3d152e_3 conda-forge shapely 1.7.1 py39ha61afbd_4 conda-forge simpervisor 0.4 pypi_0 pypi six 1.15.0 pyh9f0ad1d_0 conda-forge sniffio 1.2.0 py39hf3d152e_1 conda-forge snuggs 1.4.7 py_0 conda-forge sortedcontainers 2.3.0 pyhd8ed1ab_0 conda-forge sqlite 3.34.0 h74cdb3f_0 conda-forge tblib 1.7.0 pypi_0 pypi terminado 0.9.2 py39hf3d152e_0 conda-forge testpath 0.4.4 py_0 conda-forge tiledb 2.2.4 h91fcb0e_3 conda-forge tk 8.6.10 hed695b0_1 conda-forge toolz 0.11.1 py_0 conda-forge tornado 6.1 py39h3811e60_1 conda-forge tqdm 4.59.0 pyhd8ed1ab_0 conda-forge traitlets 5.0.5 py_0 conda-forge typing_extensions 3.7.4.3 py_0 conda-forge tzcode 2021a h7f98852_1 conda-forge tzdata 2021a he74cb21_0 conda-forge urllib3 1.26.4 pyhd8ed1ab_0 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.36.2 pyhd3deb0d_0 conda-forge xarray 0.16.2 pyhd8ed1ab_0 conda-forge xerces-c 3.2.3 h9d8b166_2 conda-forge xorg-kbproto 1.0.7 h14c3975_1002 conda-forge xorg-libice 1.0.10 h516909a_0 conda-forge xorg-libsm 1.2.3 hd9c2040_1000 conda-forge xorg-libx11 1.7.0 h36c2ea0_0 conda-forge xorg-libxau 1.0.9 h14c3975_0 conda-forge xorg-libxdmcp 1.1.3 h516909a_0 conda-forge xorg-libxext 1.3.4 h7f98852_1 conda-forge xorg-libxrender 0.9.10 h7f98852_1003 conda-forge xorg-renderproto 0.11.1 h14c3975_1002 conda-forge xorg-xextproto 7.3.0 h14c3975_1002 conda-forge xorg-xproto 7.0.31 h14c3975_1007 conda-forge xz 5.2.5 h516909a_1 conda-forge yaml 0.2.5 h516909a_0 conda-forge yarl 1.6.3 pypi_0 pypi zarr 2.6.1 pyhd8ed1ab_0 conda-forge zeromq 4.3.4 h9c3ff4c_0 conda-forge zict 2.0.0 pypi_0 pypi zipp 3.4.1 pyhd8ed1ab_0 conda-forge zlib 1.2.11 h516909a_1010 conda-forge zstd 1.4.9 ha95c52a_0 conda-forge ```

Description of expected behavior and the observed behavior

As described at discourse, when trying to visualize Shuttle Radar Topography Mission data (SRTM, https://dwtkns.com/srtm30m/), the units come as a python tuple:

data = xr.open_rasterio("some.hgt")
data.units

When trying to hvplot this, data.sel(band=1).hvplot.image(), this yielded an error:


.../python3.9/site-packages/param/parameterized.py in _validate(self, val)
   1023 
   1024         if not isinstance(val, basestring):
-> 1025             raise ValueError("String '%s' only takes a string value."%self.name)
   1026 
   1027         if self.regex is not None and re.match(self.regex, val) is None:

ValueError: String 'unit' only takes a string value.

This issue had been created to add the ability to handle unit tuples.

github-actions[bot] commented 1 month ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.