Closed TomNicholas closed 3 years ago
if I understand correctly, lev
is a dimension coordinate? To support those, pint-xarray
will convert the string to a unit object and save that as a attribute (.pint.sel
and other methods that use indexes use that to work around the no-units-on-indexes restriction).
I'm not sure why degrees_east
does not work, could you check whether the unit registry at pint_xarray.unit_registry
supports it? Otherwise you might have to update cf-xarray
, you need cf-xarray>=0.6.0
.
I think you have to import cf_xarray.units
it's both, actually, the environment lists cf-xarray=0.5.1
and the import is import cf_xarray
not import cf_xarray.units
Thanks guys, those seem to have fixed my issues!
The example gist here, run on pangeo's cloud (staging - environment below), is an attempt to use pint-xarray with cf-xarray on some real CMIP6 data.
Unfortunately I think it fails to
.quantify
thelev
dataarray properly:degrees_east
, but I thought cf-xarray was supposed to add that?I need to look into this more to work out what is actually going wrong...
Environment:
Output of mamba list
packages in environment at /srv/conda/envs/notebook: # # Name Version Build Channel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 1_gnu conda-forge abseil-cpp 20210324.0 h9c3ff4c_0 conda-forge adal 1.2.7 pyhd8ed1ab_0 conda-forge adlfs 0.7.3 pyhd8ed1ab_1 conda-forge affine 2.3.0 py_0 conda-forge aiobotocore 1.3.0 pyhd8ed1ab_0 conda-forge aiohttp 3.7.4 py38h497a2fe_0 conda-forge aioitertools 0.7.1 pyhd8ed1ab_0 conda-forge alembic 1.5.8 pyhd8ed1ab_0 conda-forge alsa-lib 1.2.3 h516909a_0 conda-forge amqp 5.0.6 pyhd8ed1ab_0 conda-forge anyio 2.2.0 py38h578d9bd_0 conda-forge appdirs 1.4.4 pyh9f0ad1d_0 conda-forge argon2-cffi 20.1.0 py38h497a2fe_2 conda-forge arrow-cpp 3.0.0 py38hd6878d3_11_cpu conda-forge asciitree 0.3.3 py_2 conda-forge asn1crypto 1.4.0 pyh9f0ad1d_0 conda-forge astropy 4.2.1 py38h497a2fe_0 conda-forge async-timeout 3.0.1 py_1000 conda-forge async_generator 1.10 py_0 conda-forge atk-1.0 2.36.0 h3371d22_4 conda-forge attrs 20.3.0 pyhd3deb0d_0 conda-forge av 8.0.3 py38hcaf3a0b_0 conda-forge aws-c-cal 0.4.5 h76129ab_8 conda-forge aws-c-common 0.5.2 h7f98852_0 conda-forge aws-c-event-stream 0.2.7 h6bac3ce_1 conda-forge aws-c-io 0.9.1 ha5b09cb_1 conda-forge aws-checksums 0.1.11 h99e32c3_3 conda-forge aws-sdk-cpp 1.8.151 hceb1b1e_1 conda-forge awscli 1.19.49 py38h578d9bd_0 conda-forge azure-core 1.12.0 pyhd8ed1ab_0 conda-forge azure-datalake-store 0.0.51 pyh9f0ad1d_0 conda-forge azure-identity 1.5.0 pyhd8ed1ab_0 conda-forge azure-storage-blob 12.8.1 pyhd8ed1ab_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.4 pyhd8ed1ab_0 conda-forge bcrypt 3.2.0 py38h497a2fe_1 conda-forge beautifulsoup4 4.9.3 pyhb0f4dca_0 conda-forge billiard 3.6.4.0 py38h497a2fe_0 conda-forge binutils_impl_linux-64 2.35.1 h193b22a_2 conda-forge binutils_linux-64 2.35 h67ddf6f_30 conda-forge bleach 3.3.0 pyh44b312d_0 conda-forge blinker 1.4 py_1 conda-forge blosc 1.21.0 h9c3ff4c_0 conda-forge bokeh 2.3.1 py38h578d9bd_0 conda-forge boost-cpp 1.74.0 hc6e9bd1_2 conda-forge boto3 1.17.49 pyhd8ed1ab_0 conda-forge botocore 1.20.49 pyhd8ed1ab_0 conda-forge bottleneck 1.3.2 py38h5c078b8_3 conda-forge branca 0.4.2 pyhd8ed1ab_0 conda-forge brotli 1.0.9 h9c3ff4c_4 conda-forge brotlipy 0.7.0 py38h497a2fe_1001 conda-forge brunsli 0.1 h9c3ff4c_0 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 cached-property 1.5.2 hd8ed1ab_1 conda-forge cached_property 1.5.2 pyha770c72_1 conda-forge cachetools 4.2.1 pyhd8ed1ab_0 conda-forge cachey 0.2.1 pyh9f0ad1d_0 conda-forge cairo 1.16.0 h6cf1ce9_1008 conda-forge cartopy 0.19.0 py38hc9c980b_0 conda-forge celery 5.0.5 pyhd8ed1ab_0 conda-forge certifi 2020.12.5 py38h578d9bd_1 conda-forge certipy 0.1.3 py_0 conda-forge cf_xarray 0.5.1 pyh44b312d_0 conda-forge cffi 1.14.5 py38ha65f79e_0 conda-forge cfgrib 0.9.9.0 pyhd8ed1ab_1 conda-forge cfitsio 3.470 hb418390_7 conda-forge cftime 1.4.1 py38h5c078b8_0 conda-forge cgen 2020.1 py_0 conda-forge chardet 4.0.0 py38h578d9bd_1 conda-forge charls 2.2.0 h9c3ff4c_0 conda-forge ciso 0.1.0 py38h5c078b8_2 conda-forge click 7.1.2 pyh9f0ad1d_0 conda-forge click-didyoumean 0.0.3 pyh8c360ce_0 conda-forge click-plugins 1.1.1 py_0 conda-forge click-repl 0.1.6 py_0 conda-forge cligj 0.7.1 pyhd8ed1ab_0 conda-forge cloudpickle 1.6.0 py_0 conda-forge cmip6_preprocessing 0.2.0 pyhd8ed1ab_0 conda-forge cmocean 2.0 py_3 conda-forge colorama 0.4.3 py_0 conda-forge colorcet 2.0.6 pyhd8ed1ab_0 conda-forge colorspacious 1.1.2 pyh24bf2e0_0 conda-forge configobj 5.0.6 py_0 conda-forge croniter 0.3.36 pyhd8ed1ab_0 conda-forge cryptography 3.4.7 py38ha5dfef3_0 conda-forge curl 7.76.1 h979ede3_1 conda-forge cycler 0.10.0 py_2 conda-forge cytoolz 0.11.0 py38h497a2fe_3 conda-forge dask 2021.4.1 pyhd8ed1ab_0 conda-forge dask-core 2021.4.1 pyhd8ed1ab_0 conda-forge dask-gateway 0.9.0 py38h578d9bd_0 conda-forge dask-glm 0.2.0 py_1 conda-forge dask-kubernetes 2021.3.1 pyhd8ed1ab_0 conda-forge dask-labextension 5.0.1 pyhd8ed1ab_1 conda-forge dask-ml 1.8.0 pyhd8ed1ab_0 conda-forge datacube 1.8.3 py_1 conda-forge datashader 0.12.1 pyh44b312d_1 conda-forge datashape 0.5.4 py_1 conda-forge dbus 1.13.6 h48d8840_2 conda-forge decorator 5.0.7 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge deprecation 2.1.0 pyh9f0ad1d_0 conda-forge descartes 1.1.0 py_4 conda-forge distributed 2021.4.1 py38h578d9bd_0 conda-forge docker-py 5.0.0 py38h578d9bd_0 conda-forge docker-pycreds 0.4.0 py_0 conda-forge docopt 0.6.2 py_1 conda-forge docrep 0.2.7 py_0 conda-forge docutils 0.15.2 py38h578d9bd_1 conda-forge donfig 0.6.0 pyhd8ed1ab_0 conda-forge eccodes 2.21.0 ha0e6eb6_0 conda-forge entrypoints 0.3 pyhd8ed1ab_1003 conda-forge eofs 1.4.0 py_0 conda-forge erddapy 1.0.0 pyhd8ed1ab_0 conda-forge esmf 8.1.0 mpi_mpich_h224d73f_100 conda-forge esmpy 8.1.0 mpi_mpich_py38h7f78e9f_100 conda-forge expat 2.3.0 h9c3ff4c_0 conda-forge fastapi 0.63.0 pyhd8ed1ab_0 conda-forge fasteners 0.14.1 py_3 conda-forge fastjmd95 0.2.1 pyh44b312d_0 conda-forge fastprogress 1.0.0 py_0 conda-forge ffmpeg 4.3.1 hca11adc_2 conda-forge fiona 1.8.18 py38h58f84aa_1 conda-forge font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge font-ttf-inconsolata 2.001 hab24e00_0 conda-forge font-ttf-source-code-pro 2.030 hab24e00_0 conda-forge font-ttf-ubuntu 0.83 hab24e00_0 conda-forge fontconfig 2.13.1 hba837de_1005 conda-forge fonts-conda-ecosystem 1 0 conda-forge fonts-conda-forge 1 0 conda-forge freetype 2.10.4 h0708190_1 conda-forge freexl 1.0.6 h7f98852_0 conda-forge fribidi 1.0.10 h36c2ea0_0 conda-forge fsspec 2021.4.0 pyhd8ed1ab_0 conda-forge future 0.18.2 py38h578d9bd_3 conda-forge gcc_impl_linux-64 9.3.0 h70c0ae5_19 conda-forge gcc_linux-64 9.3.0 hf25ea35_30 conda-forge gcsfs 2021.4.0 pyhd8ed1ab_0 conda-forge gdal 3.2.1 py38hc0b2d6b_7 conda-forge gdk-pixbuf 2.42.6 h04a7f16_0 conda-forge geocube 0.0.16 pyhd8ed1ab_0 conda-forge geopandas 0.9.0 pyhd8ed1ab_0 conda-forge geos 3.9.1 h9c3ff4c_2 conda-forge geotiff 1.6.0 h2b14fbe_4 conda-forge geoviews-core 1.9.1 pyha770c72_0 conda-forge gettext 0.19.8.1 h0b5b191_1005 conda-forge gflags 2.2.2 he1b5a44_1004 conda-forge gh 1.9.0 ha8f183a_0 conda-forge giflib 5.2.1 h36c2ea0_2 conda-forge glib 2.68.1 h9c3ff4c_0 conda-forge glib-tools 2.68.1 h9c3ff4c_0 conda-forge glog 0.4.0 h49b9bf7_3 conda-forge gmp 6.2.1 h58526e2_0 conda-forge gnutls 3.6.13 h85f3911_1 conda-forge google-auth 1.28.0 pyh44b312d_0 conda-forge google-auth-oauthlib 0.4.4 pyhd8ed1ab_0 conda-forge graphite2 1.3.13 h58526e2_1001 conda-forge graphviz 2.47.1 hebd9034_0 conda-forge greenlet 1.0.0 py38h709712a_0 conda-forge grpc-cpp 1.37.0 h36de60a_1 conda-forge gst-plugins-base 1.18.4 hf529b03_2 conda-forge gstreamer 1.18.4 h76c114f_2 conda-forge gsw 3.4.0 py38h5c078b8_1 conda-forge gtk2 2.24.33 hab0c2f8_0 conda-forge gts 0.7.6 h64030ff_2 conda-forge h11 0.12.0 pyhd8ed1ab_0 conda-forge h5netcdf 0.11.0 pyhd8ed1ab_0 conda-forge h5py 3.2.1 nompi_py38h9915d05_100 conda-forge harfbuzz 2.8.0 h83ec7ef_1 conda-forge hdf4 4.2.13 h10796ff_1005 conda-forge hdf5 1.10.6 mpi_mpich_h996c276_1014 conda-forge heapdict 1.0.1 py_0 conda-forge holoviews 1.14.3 pyhd8ed1ab_0 conda-forge httptools 0.1.1 py38h497a2fe_2 conda-forge hvplot 0.7.1 pyh44b312d_0 conda-forge icu 68.1 h58526e2_0 conda-forge idna 2.10 pyh9f0ad1d_0 conda-forge imagecodecs 2021.3.31 py38h1455ab2_0 conda-forge imageio 2.9.0 py_0 conda-forge importlib-metadata 4.0.1 py38h578d9bd_0 conda-forge importlib_metadata 4.0.1 hd8ed1ab_0 conda-forge importlib_resources 5.1.2 py38h578d9bd_0 conda-forge intake 0.6.2 pyhd8ed1ab_0 conda-forge intake-esm 2021.1.15 pyhd8ed1ab_0 conda-forge intake-geopandas 0.2.4 pyhd8ed1ab_0 conda-forge intake-stac 0.3.0 py_0 conda-forge intake-xarray 0.5.0 pyhd8ed1ab_0 conda-forge ipykernel 5.5.3 py38hd0cf306_0 conda-forge ipyleaflet 0.13.6 pyhd8ed1ab_1 conda-forge ipyspin 0.1.5 pyhd8ed1ab_0 conda-forge ipython 7.22.0 py38hd0cf306_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge ipywidgets 7.6.3 pyhd3deb0d_0 conda-forge isodate 0.6.0 py_1 conda-forge jasper 1.900.1 h07fcdf6_1006 conda-forge jdcal 1.4.1 py_0 conda-forge jedi 0.18.0 py38h578d9bd_2 conda-forge jinja2 2.11.3 pyh44b312d_0 conda-forge jmespath 0.10.0 pyh9f0ad1d_0 conda-forge joblib 1.0.1 pyhd8ed1ab_0 conda-forge jpeg 9d h36c2ea0_0 conda-forge json-c 0.15 h98cffda_0 conda-forge json5 0.9.5 pyh9f0ad1d_0 conda-forge jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge jupyter-packaging 0.9.2 pyhd8ed1ab_0 conda-forge jupyter-panel-proxy 0.1.0 py_0 conda-forge jupyter-resource-usage 0.5.1 pyhd8ed1ab_0 conda-forge jupyter-server-proxy 3.0.2 pyhd8ed1ab_0 conda-forge jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge jupyter_core 4.7.1 py38h578d9bd_0 conda-forge jupyter_server 1.6.4 py38h578d9bd_0 conda-forge jupyter_telemetry 0.1.0 pyhd8ed1ab_1 conda-forge jupyterhub-base 1.4.0 py38h578d9bd_0 conda-forge jupyterhub-singleuser 1.4.0 py38h578d9bd_0 conda-forge jupyterlab 3.0.14 pyhd8ed1ab_0 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge jupyterlab_server 2.4.0 pyhd8ed1ab_0 conda-forge jupyterlab_widgets 1.0.0 pyhd8ed1ab_1 conda-forge jxrlib 1.1 h7f98852_2 conda-forge kealib 1.4.14 hcc255d8_2 conda-forge kernel-headers_linux-64 2.6.32 h77966d4_13 conda-forge kiwisolver 1.3.1 py38h1fd1430_1 conda-forge kombu 5.0.2 py38h578d9bd_2 conda-forge krb5 1.17.2 h926e7f8_0 conda-forge kubernetes_asyncio 12.1.0 pyhd8ed1ab_0 conda-forge lame 3.100 h7f98852_1001 conda-forge lark-parser 0.11.2 pyh44b312d_0 conda-forge lcms2 2.12 hddcbb42_0 conda-forge ld_impl_linux-64 2.35.1 hea4e1c9_2 conda-forge lerc 2.2.1 h9c3ff4c_0 conda-forge libaec 1.0.4 h9c3ff4c_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.76.1 hc4aaa36_1 conda-forge libdap4 3.20.6 hd7c4107_2 conda-forge libdeflate 1.7 h7f98852_5 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-devel_linux-64 9.3.0 h7864c58_19 conda-forge libgcc-ng 9.3.0 h2828fa1_19 conda-forge libgd 2.3.2 h78a0170_0 conda-forge libgdal 3.2.1 h38ff51b_7 conda-forge libgfortran-ng 9.3.0 hff62375_19 conda-forge libgfortran5 9.3.0 hff62375_19 conda-forge libglib 2.68.1 h3e27bee_0 conda-forge libgomp 9.3.0 h2828fa1_19 conda-forge libiconv 1.16 h516909a_0 conda-forge libkml 1.3.0 h238a007_1013 conda-forge liblapack 3.9.0 8_openblas conda-forge libllvm10 10.0.1 he513fc3_3 conda-forge libllvm11 11.1.0 hf817b99_2 conda-forge libnetcdf 4.7.4 mpi_mpich_hdef422e_7 conda-forge libnghttp2 1.43.0 h812cca2_0 conda-forge libogg 1.3.4 h7f98852_1 conda-forge libopenblas 0.3.12 pthreads_h4812303_1 conda-forge libopus 1.3.1 h7f98852_1 conda-forge libpng 1.6.37 h21135ba_2 conda-forge libpq 13.2 hfd2b0eb_2 conda-forge libprotobuf 3.15.8 h780b84a_0 conda-forge librsvg 2.50.3 hfa39831_1 conda-forge librttopo 1.1.0 h1185371_6 conda-forge libsodium 1.0.18 h36c2ea0_1 conda-forge libspatialindex 1.9.3 h9c3ff4c_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_19 conda-forge libthrift 0.14.1 he6d91bd_1 conda-forge libtiff 4.2.0 hdc55705_1 conda-forge libtool 2.4.6 h58526e2_1007 conda-forge libutf8proc 2.6.1 h7f98852_0 conda-forge libuuid 2.32.1 h7f98852_1000 conda-forge libuv 1.41.0 h7f98852_0 conda-forge libvorbis 1.3.7 h9c3ff4c_0 conda-forge libwebp 1.2.0 h3452ae3_0 conda-forge libwebp-base 1.2.0 h7f98852_2 conda-forge libxcb 1.13 h7f98852_1003 conda-forge libxkbcommon 1.0.3 he3ba5ed_0 conda-forge libxml2 2.9.10 h72842e0_4 conda-forge libzopfli 1.0.3 h9c3ff4c_0 conda-forge llvmlite 0.36.0 py38h4630a5e_0 conda-forge locket 0.2.0 py_2 conda-forge lz4 3.1.3 py38hebdc3cf_0 conda-forge lz4-c 1.9.3 h9c3ff4c_0 conda-forge mako 1.1.4 pyh44b312d_0 conda-forge markdown 3.3.4 pyhd8ed1ab_0 conda-forge markupsafe 1.1.1 py38h497a2fe_3 conda-forge marshmallow 3.11.1 pyhd8ed1ab_0 conda-forge marshmallow-oneofschema 2.1.0 pyhd8ed1ab_0 conda-forge matplotlib 3.4.1 py38h578d9bd_0 conda-forge matplotlib-base 3.4.1 py38hcc49a3a_0 conda-forge mercantile 1.2.1 pyhd8ed1ab_0 conda-forge metpy 1.0 pyhd8ed1ab_0 conda-forge mistune 0.8.4 py38h497a2fe_1003 conda-forge monotonic 1.5 py_0 conda-forge mpi 1.0 mpich conda-forge mpi4py 3.0.3 py38he865349_5 conda-forge mpich 3.4.1 h846660c_104 conda-forge msal 1.11.0 pyh44b312d_0 conda-forge msal_extensions 0.3.0 pyh9f0ad1d_0 conda-forge msgpack-python 1.0.2 py38h1fd1430_1 conda-forge msrest 0.6.21 pyh44b312d_0 conda-forge msrestazure 0.6.4 pyhd8ed1ab_0 conda-forge multidict 5.1.0 py38h497a2fe_1 conda-forge multipledispatch 0.6.0 py_0 conda-forge munch 2.5.0 py_0 conda-forge mypy_extensions 0.4.3 py38h578d9bd_3 conda-forge mysql-common 8.0.23 ha770c72_1 conda-forge mysql-libs 8.0.23 h935591d_1 conda-forge natsort 7.1.1 pyhd8ed1ab_0 conda-forge nb_conda_kernels 2.3.1 py38h578d9bd_0 conda-forge nbclassic 0.2.7 pyhd8ed1ab_0 conda-forge nbclient 0.5.3 pyhd8ed1ab_0 conda-forge nbconvert 6.0.7 py38h578d9bd_3 conda-forge nbformat 5.1.3 pyhd8ed1ab_0 conda-forge nbgitpuller 0.9.0 py_0 conda-forge nbstripout 0.4.0 pyhd8ed1ab_0 conda-forge nc-time-axis 1.2.0 py_1 conda-forge ncurses 6.2 h58526e2_4 conda-forge nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge netcdf-fortran 4.5.3 mpi_mpich_hafa3f36_3 conda-forge netcdf4 1.5.6 nompi_py38hf887595_102 conda-forge nettle 3.6 he412f7d_0 conda-forge networkx 2.5 py_0 conda-forge nomkl 1.0 h5ca1d4c_0 conda-forge notebook 6.3.0 pyha770c72_1 conda-forge nspr 4.30 h9c3ff4c_0 conda-forge nss 3.64 hb5efdd6_0 conda-forge numba 0.53.1 py38h0e12cce_0 conda-forge numcodecs 0.7.3 py38h709712a_0 conda-forge numpy 1.20.2 py38h9894fe3_0 conda-forge oauthlib 3.0.1 py_0 conda-forge olefile 0.46 pyh9f0ad1d_1 conda-forge openh264 2.1.1 h780b84a_0 conda-forge openjpeg 2.4.0 hf7af979_0 conda-forge openssl 1.1.1k h7f98852_0 conda-forge orc 1.6.7 heec2584_1 conda-forge packaging 20.9 pyh44b312d_0 conda-forge pamela 1.0.0 py_0 conda-forge pandas 1.2.4 py38h1abd341_0 conda-forge pandoc 2.12 h7f98852_0 conda-forge pandocfilters 1.4.2 py_1 conda-forge panel 0.11.3 pyhd8ed1ab_0 conda-forge pangeo-dask 2021.04.26 hd8ed1ab_0 conda-forge pangeo-notebook 2021.04.26 hd8ed1ab_0 conda-forge pango 1.42.4 h69149e4_5 conda-forge param 1.10.1 pyhd3deb0d_0 conda-forge paramiko 2.7.2 pyh9f0ad1d_0 conda-forge parcels 2.2.2 py38h578d9bd_0 conda-forge parquet-cpp 1.5.1 2 conda-forge parso 0.8.2 pyhd8ed1ab_0 conda-forge partd 1.2.0 pyhd8ed1ab_0 conda-forge pcre 8.44 he1b5a44_0 conda-forge pendulum 2.1.2 pyhd8ed1ab_1 conda-forge pexpect 4.8.0 pyh9f0ad1d_2 conda-forge pickleshare 0.7.5 py_1003 conda-forge pillow 8.1.2 py38ha0e1e83_1 conda-forge pint 0.17 pyhd8ed1ab_0 conda-forge pint-xarray 0.3.dev7+g6ee1bf9 dev_0