0s autopkgtest [12:10:23]: starting date and time: 2025-11-17 12:10:23+0000 0s autopkgtest [12:10:23]: git checkout: 4b346b80 nova: make wait_reboot return success even when a no-op 0s autopkgtest [12:10:23]: host juju-7f2275-prod-proposed-migration-environment-20; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.nbjlzp8y/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:numpy,src:python3-defaults --apt-upgrade python-xarray --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 '--env=ADT_TEST_TRIGGERS=numpy/1:2.3.4+ds-3ubuntu1 python3-defaults/3.13.7-2' -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-20@bos03-arm64-1.secgroup --name adt-resolute-arm64-python-xarray-20251117-111050-juju-7f2275-prod-proposed-migration-environment-20-f0759192-b4d8-4924-b130-742ab6733331 --image adt/ubuntu-resolute-arm64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-20 --net-id=net_prod-proposed-migration -e TERM=linux --mirror=http://ftpmaster.internal/ubuntu/ 3s Creating nova instance adt-resolute-arm64-python-xarray-20251117-111050-juju-7f2275-prod-proposed-migration-environment-20-f0759192-b4d8-4924-b130-742ab6733331 from image adt/ubuntu-resolute-arm64-server-20251117.img (UUID 1cd33fbb-18df-4c5a-b8f0-2dcb25269485)... 59s autopkgtest [12:11:22]: testbed dpkg architecture: arm64 59s autopkgtest [12:11:22]: testbed apt version: 3.1.11 60s autopkgtest [12:11:23]: @@@@@@@@@@@@@@@@@@@@ test bed setup 60s autopkgtest [12:11:23]: testbed release detected to be: None 61s autopkgtest [12:11:24]: updating testbed package index (apt update) 61s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [87.8 kB] 61s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 61s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 61s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 61s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [868 kB] 62s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [22.9 kB] 62s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/restricted Sources [9848 B] 62s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [81.1 kB] 62s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 Packages [149 kB] 62s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 c-n-f Metadata [3084 B] 62s Get:11 http://ftpmaster.internal/ubuntu resolute-proposed/restricted arm64 Packages [107 kB] 62s Get:12 http://ftpmaster.internal/ubuntu resolute-proposed/restricted arm64 c-n-f Metadata [324 B] 62s Get:13 http://ftpmaster.internal/ubuntu resolute-proposed/universe arm64 Packages [577 kB] 62s Get:14 http://ftpmaster.internal/ubuntu resolute-proposed/universe arm64 c-n-f Metadata [17.8 kB] 62s Get:15 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse arm64 Packages [12.5 kB] 62s Get:16 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse arm64 c-n-f Metadata [576 B] 63s Fetched 1938 kB in 1s (1772 kB/s) 64s Reading package lists... 65s Hit:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease 65s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 65s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 65s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 66s Reading package lists... 66s Reading package lists... 67s Building dependency tree... 67s Reading state information... 67s Calculating upgrade... 67s The following packages will be upgraded: 67s libpython3-stdlib python3 python3-minimal usbutils 67s 4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 67s Need to get 144 kB of archives. 67s After this operation, 0 B of additional disk space will be used. 67s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 python3-minimal arm64 3.13.7-2 [27.8 kB] 67s Get:2 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 python3 arm64 3.13.7-2 [23.9 kB] 67s Get:3 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 libpython3-stdlib arm64 3.13.7-2 [10.6 kB] 67s Get:4 http://ftpmaster.internal/ubuntu resolute/main arm64 usbutils arm64 1:019-1 [81.7 kB] 68s dpkg-preconfigure: unable to re-open stdin: No such file or directory 68s Fetched 144 kB in 0s (348 kB/s) 68s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 88137 files and directories currently installed.) 68s Preparing to unpack .../python3-minimal_3.13.7-2_arm64.deb ... 68s Unpacking python3-minimal (3.13.7-2) over (3.13.7-1) ... 68s Setting up python3-minimal (3.13.7-2) ... 69s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 88137 files and directories currently installed.) 69s Preparing to unpack .../python3_3.13.7-2_arm64.deb ... 69s running python pre-rtupdate hooks for python3.13... 69s Unpacking python3 (3.13.7-2) over (3.13.7-1) ... 69s Preparing to unpack .../libpython3-stdlib_3.13.7-2_arm64.deb ... 69s Unpacking libpython3-stdlib:arm64 (3.13.7-2) over (3.13.7-1) ... 69s Preparing to unpack .../usbutils_1%3a019-1_arm64.deb ... 69s Unpacking usbutils (1:019-1) over (1:018-2) ... 69s Setting up usbutils (1:019-1) ... 69s Setting up libpython3-stdlib:arm64 (3.13.7-2) ... 69s Setting up python3 (3.13.7-2) ... 69s running python rtupdate hooks for python3.13... 69s running python post-rtupdate hooks for python3.13... 69s Processing triggers for man-db (2.13.1-1) ... 70s autopkgtest [12:11:33]: upgrading testbed (apt dist-upgrade and autopurge) 71s Reading package lists... 71s Building dependency tree... 71s Reading state information... 71s Calculating upgrade... 71s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 72s Reading package lists... 72s Building dependency tree... 72s Reading state information... 72s Solving dependencies... 72s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 75s autopkgtest [12:11:38]: testbed running kernel: Linux 6.17.0-5-generic #5-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 22 09:50:31 UTC 2025 75s autopkgtest [12:11:38]: @@@@@@@@@@@@@@@@@@@@ apt-source python-xarray 78s Get:1 http://ftpmaster.internal/ubuntu resolute/universe python-xarray 2025.03.1-8 (dsc) [3963 B] 78s Get:2 http://ftpmaster.internal/ubuntu resolute/universe python-xarray 2025.03.1-8 (tar) [2781 kB] 78s Get:3 http://ftpmaster.internal/ubuntu resolute/universe python-xarray 2025.03.1-8 (diff) [20.6 kB] 78s gpgv: Signature made Mon May 5 11:14:20 2025 UTC 78s gpgv: using RSA key 7E1AC3FA27A649284C323EF6695C429316C07BFE 78s gpgv: issuer "jdg@debian.org" 78s gpgv: Can't check signature: No public key 78s dpkg-source: warning: cannot verify inline signature for ./python-xarray_2025.03.1-8.dsc: no acceptable signature found 79s autopkgtest [12:11:42]: testing package python-xarray version 2025.03.1-8 79s autopkgtest [12:11:42]: build not needed 101s autopkgtest [12:12:04]: test pybuild-autopkgtest: preparing testbed 101s Reading package lists... 101s Building dependency tree... 101s Reading state information... 101s Solving dependencies... 102s The following NEW packages will be installed: 102s autoconf automake autopoint autotools-dev blt build-essential comerr-dev cpp 102s cpp-14 cpp-14-aarch64-linux-gnu cpp-15 cpp-15-aarch64-linux-gnu 102s cpp-aarch64-linux-gnu debhelper debugedit dh-autoreconf dh-python 102s dh-strip-nondeterminism docutils-common dwz fontconfig fontconfig-config 102s fonts-dejavu-core fonts-dejavu-extra fonts-dejavu-mono fonts-font-awesome 102s fonts-lato fonts-lyx fonts-mathjax fonts-open-sans fonts-urw-base35 g++ 102s g++-15 g++-15-aarch64-linux-gnu g++-aarch64-linux-gnu gcc gcc-14 102s gcc-14-aarch64-linux-gnu gcc-14-base gcc-15 gcc-15-aarch64-linux-gnu 102s gcc-aarch64-linux-gnu gdb gettext gfortran-14 gfortran-14-aarch64-linux-gnu 102s gfortran-15 gfortran-15-aarch64-linux-gnu ghostscript intltool-debian 102s ipython3 krb5-multidev libaec-dev libaec0 libamd-comgr3 libamdhip64-6 102s libarchive-zip-perl libasan8 libavahi-client3 libavahi-common-data 102s libavahi-common3 libb2-1 libbabeltrace1 libblas3 libblosc1 102s libboost-iostreams1.88.0 libboost-thread1.88.0 libbrotli-dev libbz2-dev 102s libcairo2 libcares2 libcc1-0 libcups2t64 libcurl4-gnutls-dev libdatrie1 102s libdebhelper-perl libdeflate0 libdouble-conversion3 libdxflib3 102s libeccodes-data libeccodes-dev libeccodes0 libeckit-dev libeckit-utils 102s libeckit0d libegl-mesa0 libegl1 libeigen3-dev libevent-2.1-7t64 libevent-dev 102s libevent-extra-2.1-7t64 libevent-openssl-2.1-7t64 libevent-pthreads-2.1-7t64 102s libfabric1 libfile-stripnondeterminism-perl libfontconfig1 libfontenc1 102s libgbm1 libgcc-14-dev libgcc-15-dev libgeos-c1t64 libgeos3.13.1 libgeotiff5 102s libgfortran-14-dev libgfortran-15-dev libgfortran5 libgl1-mesa-dri libglvnd0 102s libglx-mesa0 libglx0 libgmp-dev libgmpxx4ldbl libgnutls-dane0t64 102s libgnutls-openssl27t64 libgnutls28-dev libgomp1 libgraphite2-3 libgs-common 102s libgs10 libgs10-common libgssrpc4t64 libharfbuzz0b libhdf5-310 102s libhdf5-hl-310 libhsa-runtime64-1 libhsakmt1 libhwasan0 libhwloc-dev 102s libhwloc-plugins libhwloc15 libibmad5 libibumad3 libibverbs-dev libice6 102s libidn12 libidn2-dev libijs-0.35 libimagequant0 libinput-bin libinput10 102s libisl23 libitm1 libjbig0 libjbig2dec0 libjemalloc-dev libjpeg-dev 102s libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev libjs-jquery 102s libjs-jquery-ui libjs-mathjax libjs-requirejs libjs-sphinxdoc 102s libjs-sprintf-js libjs-underscore libjson-perl libkadm5clnt-mit12 102s libkadm5srv-mit12 libkdb5-10t64 libkrb5-dev liblapack3 liblcms2-2 102s libldap-dev liblerc4 libllvm21 liblsan0 libltdl-dev libltdl7 liblua5.4-0 102s liblz4-dev liblzf1 libmagics++-data libmagics++-dev libmagics++-metview-dev 102s libmagplus3v5 libmd4c0 libmpc3 libmtdev1t64 libmysqlclient24 libnetcdf22 102s libnghttp2-dev libnl-3-dev libnl-route-3-dev libnode115 libnorm1t64 102s libnuma-dev libodc-0d libodc-dev libopenblas-dev libopenblas-pthread-dev 102s libopenblas0 libopenblas0-pthread libopengl0 libopenjp2-7 libopenmpi-dev 102s libopenmpi40 libp11-kit-dev libpango-1.0-0 libpangocairo-1.0-0 102s libpangoft2-1.0-0 libpaper2 libpciaccess0 libpcre2-16-0 libpgm-5.3-0t64 102s libpixman-1-0 libpkgconf3 libpng-dev libpq5 libproj25 libpsl-dev 102s libpython3.14-minimal libpython3.14-stdlib libqhull-r8.0 libqhullcpp8.0 102s libqt6core6t64 libqt6dbus6 libqt6gui6 libqt6widgets6 librados2 libraqm0 102s librdmacm1t64 librsync2t64 librtmp-dev libsharpyuv0 libsm6 libsnappy-dev 102s libsnappy1v5 libsodium23 libsource-highlight-common libsource-highlight4t64 102s libssh2-1-dev libssl-dev libstdc++-15-dev libsz2 libtasn1-6-dev libtcl8.6 102s libterralib-dev libterralib3t64 libthai-data libthai0 libtiff6 libtk8.6 102s libtool libts0t64 libtsan2 libubsan1 libucx0 libunbound8 libvulkan1 102s libwacom-common libwacom9 libwayland-client0 libwebp7 libwebpdemux2 102s libwebpmux3 libx11-xcb1 libxcb-cursor0 libxcb-dri3-0 libxcb-glx0 102s libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-present0 libxcb-randr0 102s libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 102s libxcb-util1 libxcb-xfixes0 libxcb-xinput0 libxcb-xkb1 libxft2 102s libxkbcommon-x11-0 libxnvctrl0 libxrender1 libxshmfence1 libxslt1.1 libxss1 102s libxt6t64 libxxf86vm1 libxxhash-dev libzmq5 libzopfli1 libzstd-dev m4 102s magics++ mesa-libgallium mpi-default-dev mypy mysql-common nettle-dev 102s node-acorn node-argparse node-balanced-match node-brace-expansion 102s node-cjs-module-lexer node-corepack node-debug node-esprima 102s node-fortawesome-fontawesome-free node-js-yaml node-llhttp node-lru-cache 102s node-minimatch node-ms node-semver node-sprintf-js node-undici node-xtend 102s nodejs ocl-icd-libopencl1 odc openmpi-bin openmpi-common pandoc pandoc-data 102s pkgconf pkgconf-bin po-debconf poppler-data proj-data 102s pybuild-plugin-autopkgtest pybuild-plugin-pyproject python-cartopy-data 102s python-dask-doc python-hypothesis-doc python-matplotlib-data 102s python-pandas-doc python-scipy-doc python-tinycss2-common python-xarray-doc 102s python3-accessible-pygments python3-alabaster python3-all python3-asttokens 102s python3-autodocsumm python3-bleach python3-bottleneck python3-brotli 102s python3-bs4 python3-build python3-cartopy python3-cffi python3-cfgrib 102s python3-cftime python3-click python3-cloudpickle python3-comm 102s python3-contourpy python3-coverage python3-crc32c python3-cycler 102s python3-dask python3-debugpy python3-decorator python3-defusedxml 102s python3-doc python3-docutils python3-donfig python3-eccodes 102s python3-ecmwflibs python3-execnet python3-executing python3-fastjsonschema 102s python3-findlibs python3-flexcache python3-flexparser python3-fonttools 102s python3-fs python3-fsspec python3-h5netcdf python3-h5py python3-h5py-serial 102s python3-html5lib python3-hypothesis python3-imagesize python3-iniconfig 102s python3-installer python3-ipykernel python3-ipython python3-jedi 102s python3-jupyter-client python3-jupyter-console python3-jupyter-core 102s python3-jupyterlab-pygments python3-kiwisolver python3-locket python3-lxml 102s python3-lz4 python3-matplotlib python3-matplotlib-inline python3-mistune 102s python3-mpmath python3-mypy python3-mypy-extensions python3-nbclient 102s python3-nbconvert python3-nbformat python3-nbsphinx python3-nest-asyncio 102s python3-netcdf4 python3-numcodecs python3-numpy python3-numpy-dev 102s python3-numpydoc python3-pandas python3-pandas-lib python3-pandocfilters 102s python3-parso python3-partd python3-pickleshare python3-pil 102s python3-pil.imagetk python3-pint python3-pip python3-platformdirs 102s python3-pluggy python3-ply python3-pooch python3-prompt-toolkit 102s python3-psutil python3-pure-eval python3-pycparser 102s python3-pydata-sphinx-theme python3-pyproj python3-pyproject-hooks 102s python3-pyshp python3-pytest python3-pytest-mypy python3-pytest-xdist 102s python3-pytz python3-regex python3-roman python3-scipy python3-seaborn 102s python3-setuptools-scm python3-shapely python3-snowballstemmer 102s python3-sortedcontainers python3-soupsieve python3-sphinx 102s python3-sphinx-book-theme python3-sphinx-copybutton python3-sphinx-design 102s python3-sphinx-gallery python3-sphinx-inline-tabs 102s python3-sphinx-remove-toctrees python3-sphinx-rtd-theme 102s python3-sphinxcontrib-mermaid python3-sphinxcontrib.jquery 102s python3-sphinxext-opengraph python3-sphinxext-rediraffe python3-stack-data 102s python3-sympy python3-tinycss2 python3-tk python3-tomlkit python3-toolz 102s python3-tornado python3-traitlets python3-typeshed python3-ufolib2 102s python3-wcwidth python3-webencodings python3-wheel python3-xarray 102s python3-zarr python3-zmq python3-zopfli python3.13-doc python3.13-tk 102s python3.14 python3.14-minimal python3.14-tk sgml-base sphinx-common 102s sphinx-rtd-theme-common tk8.6-blt2.5 tzdata-legacy unicode-data x11-common 102s xfonts-encodings xfonts-utils xml-core zlib1g-dev 102s 0 upgraded, 489 newly installed, 0 to remove and 0 not upgraded. 102s Need to get 578 MB of archives. 102s After this operation, 2775 MB of additional disk space will be used. 102s Get:1 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-lato all 2.015-1 [2781 kB] 103s Get:2 http://ftpmaster.internal/ubuntu resolute/main arm64 poppler-data all 0.4.12-1 [2060 kB] 103s Get:3 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 python3-numpy-dev arm64 1:2.3.4+ds-3ubuntu1 [145 kB] 103s Get:4 http://ftpmaster.internal/ubuntu resolute/main arm64 libblas3 arm64 3.12.1-7 [181 kB] 103s Get:5 http://ftpmaster.internal/ubuntu resolute/main arm64 libgfortran5 arm64 15.2.0-7ubuntu1 [450 kB] 103s Get:6 http://ftpmaster.internal/ubuntu resolute/universe arm64 libopenblas0-pthread arm64 0.3.30+ds-3 [4307 kB] 103s Get:7 http://ftpmaster.internal/ubuntu resolute/main arm64 liblapack3 arm64 3.12.1-7 [2300 kB] 103s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 python3-numpy arm64 1:2.3.4+ds-3ubuntu1 [4575 kB] 103s Get:9 http://ftpmaster.internal/ubuntu resolute/main arm64 libpython3.14-minimal arm64 3.14.0-4 [903 kB] 103s Get:10 http://ftpmaster.internal/ubuntu resolute/main arm64 python3.14-minimal arm64 3.14.0-4 [2543 kB] 103s Get:11 http://ftpmaster.internal/ubuntu resolute/main arm64 m4 arm64 1.4.20-2 [213 kB] 103s Get:12 http://ftpmaster.internal/ubuntu resolute/main arm64 autoconf all 2.72-3.1ubuntu1 [384 kB] 103s Get:13 http://ftpmaster.internal/ubuntu resolute/main arm64 autotools-dev all 20240727.1 [43.4 kB] 103s Get:14 http://ftpmaster.internal/ubuntu resolute/main arm64 automake all 1:1.18.1-2 [581 kB] 103s Get:15 http://ftpmaster.internal/ubuntu resolute/main arm64 autopoint all 0.23.2-1 [620 kB] 103s Get:16 http://ftpmaster.internal/ubuntu resolute/main arm64 libtcl8.6 arm64 8.6.17+dfsg-1 [1024 kB] 103s Get:17 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-dejavu-mono all 2.37-8 [502 kB] 103s Get:18 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-dejavu-core all 2.37-8 [835 kB] 103s Get:19 http://ftpmaster.internal/ubuntu resolute/main arm64 libfontenc1 arm64 1:1.1.8-1build1 [13.9 kB] 104s Get:20 http://ftpmaster.internal/ubuntu resolute/main arm64 x11-common all 1:7.7+24ubuntu1 [22.4 kB] 104s Get:21 http://ftpmaster.internal/ubuntu resolute/main arm64 xfonts-encodings all 1:1.0.5-0ubuntu2 [578 kB] 104s Get:22 http://ftpmaster.internal/ubuntu resolute/main arm64 xfonts-utils arm64 1:7.7+7 [95.6 kB] 104s Get:23 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-urw-base35 all 20200910-8 [11.0 MB] 104s Get:24 http://ftpmaster.internal/ubuntu resolute/main arm64 fontconfig-config arm64 2.15.0-2.3ubuntu1 [38.1 kB] 104s Get:25 http://ftpmaster.internal/ubuntu resolute/main arm64 libfontconfig1 arm64 2.15.0-2.3ubuntu1 [144 kB] 104s Get:26 http://ftpmaster.internal/ubuntu resolute/main arm64 libxrender1 arm64 1:0.9.12-1 [19.5 kB] 104s Get:27 http://ftpmaster.internal/ubuntu resolute/main arm64 libxft2 arm64 2.3.6-1build1 [44.1 kB] 104s Get:28 http://ftpmaster.internal/ubuntu resolute/main arm64 libxss1 arm64 1:1.2.3-1build3 [7244 B] 104s Get:29 http://ftpmaster.internal/ubuntu resolute/main arm64 libtk8.6 arm64 8.6.17-1 [811 kB] 104s Get:30 http://ftpmaster.internal/ubuntu resolute/main arm64 tk8.6-blt2.5 arm64 2.5.3+dfsg-8 [624 kB] 104s Get:31 http://ftpmaster.internal/ubuntu resolute/main arm64 blt arm64 2.5.3+dfsg-8 [4824 B] 104s Get:32 http://ftpmaster.internal/ubuntu resolute/main arm64 libisl23 arm64 0.27-1 [676 kB] 104s Get:33 http://ftpmaster.internal/ubuntu resolute/main arm64 libmpc3 arm64 1.3.1-2 [55.6 kB] 104s Get:34 http://ftpmaster.internal/ubuntu resolute/main arm64 cpp-15-aarch64-linux-gnu arm64 15.2.0-7ubuntu1 [11.7 MB] 104s Get:35 http://ftpmaster.internal/ubuntu resolute/main arm64 cpp-15 arm64 15.2.0-7ubuntu1 [1026 B] 104s Get:36 http://ftpmaster.internal/ubuntu resolute/main arm64 cpp-aarch64-linux-gnu arm64 4:15.2.0-4ubuntu1 [5736 B] 104s Get:37 http://ftpmaster.internal/ubuntu resolute/main arm64 cpp arm64 4:15.2.0-4ubuntu1 [22.4 kB] 104s Get:38 http://ftpmaster.internal/ubuntu resolute/main arm64 libcc1-0 arm64 15.2.0-7ubuntu1 [49.0 kB] 104s Get:39 http://ftpmaster.internal/ubuntu resolute/main arm64 libgomp1 arm64 15.2.0-7ubuntu1 [147 kB] 104s Get:40 http://ftpmaster.internal/ubuntu resolute/main arm64 libitm1 arm64 15.2.0-7ubuntu1 [27.9 kB] 104s Get:41 http://ftpmaster.internal/ubuntu resolute/main arm64 libasan8 arm64 15.2.0-7ubuntu1 [2923 kB] 105s Get:42 http://ftpmaster.internal/ubuntu resolute/main arm64 liblsan0 arm64 15.2.0-7ubuntu1 [1316 kB] 105s Get:43 http://ftpmaster.internal/ubuntu resolute/main arm64 libtsan2 arm64 15.2.0-7ubuntu1 [2689 kB] 105s Get:44 http://ftpmaster.internal/ubuntu resolute/main arm64 libubsan1 arm64 15.2.0-7ubuntu1 [1176 kB] 105s Get:45 http://ftpmaster.internal/ubuntu resolute/main arm64 libhwasan0 arm64 15.2.0-7ubuntu1 [1638 kB] 105s Get:46 http://ftpmaster.internal/ubuntu resolute/main arm64 libgcc-15-dev arm64 15.2.0-7ubuntu1 [2600 kB] 105s Get:47 http://ftpmaster.internal/ubuntu resolute/main arm64 gcc-15-aarch64-linux-gnu arm64 15.2.0-7ubuntu1 [23.1 MB] 106s Get:48 http://ftpmaster.internal/ubuntu resolute/main arm64 gcc-15 arm64 15.2.0-7ubuntu1 [513 kB] 106s Get:49 http://ftpmaster.internal/ubuntu resolute/main arm64 gcc-aarch64-linux-gnu arm64 4:15.2.0-4ubuntu1 [1206 B] 106s Get:50 http://ftpmaster.internal/ubuntu resolute/main arm64 gcc arm64 4:15.2.0-4ubuntu1 [5016 B] 106s Get:51 http://ftpmaster.internal/ubuntu resolute/main arm64 libstdc++-15-dev arm64 15.2.0-7ubuntu1 [2546 kB] 106s Get:52 http://ftpmaster.internal/ubuntu resolute/main arm64 g++-15-aarch64-linux-gnu arm64 15.2.0-7ubuntu1 [13.2 MB] 106s Get:53 http://ftpmaster.internal/ubuntu resolute/main arm64 g++-15 arm64 15.2.0-7ubuntu1 [23.7 kB] 106s Get:54 http://ftpmaster.internal/ubuntu resolute/main arm64 g++-aarch64-linux-gnu arm64 4:15.2.0-4ubuntu1 [956 B] 106s Get:55 http://ftpmaster.internal/ubuntu resolute/main arm64 g++ arm64 4:15.2.0-4ubuntu1 [1080 B] 106s Get:56 http://ftpmaster.internal/ubuntu resolute/main arm64 build-essential arm64 12.12ubuntu1 [5082 B] 106s Get:57 http://ftpmaster.internal/ubuntu resolute/main arm64 gcc-14-base arm64 14.3.0-10ubuntu1 [57.2 kB] 106s Get:58 http://ftpmaster.internal/ubuntu resolute/universe arm64 cpp-14-aarch64-linux-gnu arm64 14.3.0-10ubuntu1 [10.6 MB] 107s Get:59 http://ftpmaster.internal/ubuntu resolute/universe arm64 cpp-14 arm64 14.3.0-10ubuntu1 [1030 B] 107s Get:60 http://ftpmaster.internal/ubuntu resolute/main arm64 libdebhelper-perl all 13.24.2ubuntu1 [95.7 kB] 107s Get:61 http://ftpmaster.internal/ubuntu resolute/main arm64 libgcc-14-dev arm64 14.3.0-10ubuntu1 [2593 kB] 107s Get:62 http://ftpmaster.internal/ubuntu resolute/universe arm64 gcc-14-aarch64-linux-gnu arm64 14.3.0-10ubuntu1 [20.9 MB] 108s Get:63 http://ftpmaster.internal/ubuntu resolute/universe arm64 gcc-14 arm64 14.3.0-10ubuntu1 [545 kB] 108s Get:64 http://ftpmaster.internal/ubuntu resolute/main arm64 libtool all 2.5.4-7 [169 kB] 108s Get:65 http://ftpmaster.internal/ubuntu resolute/main arm64 dh-autoreconf all 21 [12.5 kB] 108s Get:66 http://ftpmaster.internal/ubuntu resolute/main arm64 libarchive-zip-perl all 1.68-1 [90.2 kB] 108s Get:67 http://ftpmaster.internal/ubuntu resolute/main arm64 libfile-stripnondeterminism-perl all 1.15.0-1 [20.5 kB] 108s Get:68 http://ftpmaster.internal/ubuntu resolute/main arm64 dh-strip-nondeterminism all 1.15.0-1 [5090 B] 108s Get:69 http://ftpmaster.internal/ubuntu resolute/main arm64 debugedit arm64 1:5.2-3 [49.1 kB] 108s Get:70 http://ftpmaster.internal/ubuntu resolute/main arm64 dwz arm64 0.16-2 [113 kB] 108s Get:71 http://ftpmaster.internal/ubuntu resolute/main arm64 gettext arm64 0.23.2-1 [998 kB] 108s Get:72 http://ftpmaster.internal/ubuntu resolute/main arm64 intltool-debian all 0.35.0+20060710.6 [23.2 kB] 108s Get:73 http://ftpmaster.internal/ubuntu resolute/main arm64 po-debconf all 1.0.21+nmu1 [233 kB] 108s Get:74 http://ftpmaster.internal/ubuntu resolute/main arm64 debhelper all 13.24.2ubuntu1 [896 kB] 108s Get:75 http://ftpmaster.internal/ubuntu resolute/universe arm64 dh-python all 6.20250414 [119 kB] 108s Get:76 http://ftpmaster.internal/ubuntu resolute/main arm64 sgml-base all 1.31+nmu1 [11.0 kB] 108s Get:77 http://ftpmaster.internal/ubuntu resolute/main arm64 xml-core all 0.19 [20.3 kB] 108s Get:78 http://ftpmaster.internal/ubuntu resolute/main arm64 docutils-common all 0.21.2+dfsg-2 [131 kB] 108s Get:79 http://ftpmaster.internal/ubuntu resolute/main arm64 fontconfig arm64 2.15.0-2.3ubuntu1 [191 kB] 108s Get:80 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-dejavu-extra all 2.37-8 [1947 kB] 108s Get:81 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-font-awesome all 5.0.10+really4.7.0~dfsg-4.1 [516 kB] 108s Get:82 http://ftpmaster.internal/ubuntu resolute/universe arm64 fonts-lyx all 2.4.4-2 [171 kB] 108s Get:83 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-mathjax all 2.7.9+dfsg-1 [2208 kB] 108s Get:84 http://ftpmaster.internal/ubuntu resolute/universe arm64 fonts-open-sans all 1.11-2 [635 kB] 108s Get:85 http://ftpmaster.internal/ubuntu resolute/main arm64 libbabeltrace1 arm64 1.5.11-4build3 [157 kB] 108s Get:86 http://ftpmaster.internal/ubuntu resolute/main arm64 libsource-highlight-common all 3.1.9-4.3build1 [64.2 kB] 108s Get:87 http://ftpmaster.internal/ubuntu resolute/main arm64 libsource-highlight4t64 arm64 3.1.9-4.3build1 [243 kB] 108s Get:88 http://ftpmaster.internal/ubuntu resolute/main arm64 gdb arm64 16.3-1ubuntu2 [4952 kB] 108s Get:89 http://ftpmaster.internal/ubuntu resolute/universe arm64 libgfortran-14-dev arm64 14.3.0-10ubuntu1 [496 kB] 108s Get:90 http://ftpmaster.internal/ubuntu resolute/universe arm64 gfortran-14-aarch64-linux-gnu arm64 14.3.0-10ubuntu1 [11.4 MB] 109s Get:91 http://ftpmaster.internal/ubuntu resolute/universe arm64 gfortran-14 arm64 14.3.0-10ubuntu1 [15.1 kB] 109s Get:92 http://ftpmaster.internal/ubuntu resolute/main arm64 libgfortran-15-dev arm64 15.2.0-7ubuntu1 [489 kB] 109s Get:93 http://ftpmaster.internal/ubuntu resolute/main arm64 gfortran-15-aarch64-linux-gnu arm64 15.2.0-7ubuntu1 [12.5 MB] 109s Get:94 http://ftpmaster.internal/ubuntu resolute/main arm64 gfortran-15 arm64 15.2.0-7ubuntu1 [17.7 kB] 109s Get:95 http://ftpmaster.internal/ubuntu resolute/main arm64 libgs-common all 10.05.0dfsg1-0ubuntu4 [176 kB] 109s Get:96 http://ftpmaster.internal/ubuntu resolute/main arm64 libgs10-common all 10.05.0dfsg1-0ubuntu4 [490 kB] 109s Get:97 http://ftpmaster.internal/ubuntu resolute/main arm64 libavahi-common-data arm64 0.8-16ubuntu3 [31.1 kB] 109s Get:98 http://ftpmaster.internal/ubuntu resolute/main arm64 libavahi-common3 arm64 0.8-16ubuntu3 [24.5 kB] 109s Get:99 http://ftpmaster.internal/ubuntu resolute/main arm64 libavahi-client3 arm64 0.8-16ubuntu3 [28.4 kB] 109s Get:100 http://ftpmaster.internal/ubuntu resolute/main arm64 libcups2t64 arm64 2.4.12-0ubuntu3 [269 kB] 109s Get:101 http://ftpmaster.internal/ubuntu resolute/main arm64 libidn12 arm64 1.43-2 [59.6 kB] 109s Get:102 http://ftpmaster.internal/ubuntu resolute/main arm64 libijs-0.35 arm64 0.35-16 [15.3 kB] 109s Get:103 http://ftpmaster.internal/ubuntu resolute/main arm64 libjbig2dec0 arm64 0.20-1build3 [63.2 kB] 109s Get:104 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg-turbo8 arm64 2.1.5-4ubuntu2 [165 kB] 110s Get:105 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg8 arm64 8c-2ubuntu11 [2148 B] 110s Get:106 http://ftpmaster.internal/ubuntu resolute/main arm64 libopenjp2-7 arm64 2.5.3-2.1 [179 kB] 110s Get:107 http://ftpmaster.internal/ubuntu resolute/main arm64 libpaper2 arm64 2.2.5-0.3 [17.3 kB] 110s Get:108 http://ftpmaster.internal/ubuntu resolute/main arm64 libdeflate0 arm64 1.23-2 [46.4 kB] 110s Get:109 http://ftpmaster.internal/ubuntu resolute/main arm64 libjbig0 arm64 2.1-6.1ubuntu2 [29.3 kB] 110s Get:110 http://ftpmaster.internal/ubuntu resolute/main arm64 liblerc4 arm64 4.0.0+ds-5ubuntu1 [167 kB] 110s Get:111 http://ftpmaster.internal/ubuntu resolute/main arm64 libsharpyuv0 arm64 1.5.0-0.1 [16.9 kB] 110s Get:112 http://ftpmaster.internal/ubuntu resolute/main arm64 libwebp7 arm64 1.5.0-0.1 [194 kB] 110s Get:113 http://ftpmaster.internal/ubuntu resolute/main arm64 libtiff6 arm64 4.7.0-3ubuntu3 [196 kB] 110s Get:114 http://ftpmaster.internal/ubuntu resolute/main arm64 libice6 arm64 2:1.1.1-1 [42.3 kB] 110s Get:115 http://ftpmaster.internal/ubuntu resolute/main arm64 libsm6 arm64 2:1.2.6-1 [16.6 kB] 110s Get:116 http://ftpmaster.internal/ubuntu resolute/main arm64 libxt6t64 arm64 1:1.2.1-1.3 [168 kB] 110s Get:117 http://ftpmaster.internal/ubuntu resolute/main arm64 libgs10 arm64 10.05.0dfsg1-0ubuntu4 [3609 kB] 110s Get:118 http://ftpmaster.internal/ubuntu resolute/main arm64 ghostscript arm64 10.05.0dfsg1-0ubuntu4 [43.0 kB] 110s Get:119 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-decorator all 5.2.1-2 [28.1 kB] 110s Get:120 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-parso all 0.8.5-1 [68.0 kB] 110s Get:121 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-typeshed all 0.0~git20241223.ea91db2-4 [1554 kB] 110s Get:122 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-jedi all 0.19.1+ds1-1 [693 kB] 110s Get:123 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-traitlets all 5.14.3+really5.14.3-1 [71.5 kB] 110s Get:124 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-matplotlib-inline all 0.1.7-1 [9186 B] 110s Get:125 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-wcwidth all 0.2.13+dfsg1-1 [26.3 kB] 110s Get:126 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-prompt-toolkit all 3.0.52-1 [258 kB] 110s Get:127 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-asttokens all 3.0.0-2 [20.5 kB] 110s Get:128 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-executing all 2.2.0-0.2 [25.0 kB] 110s Get:129 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pure-eval all 0.2.3-1 [11.4 kB] 110s Get:130 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-stack-data all 0.6.3-1 [22.0 kB] 110s Get:131 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-ipython all 8.35.0-2 [575 kB] 110s Get:132 http://ftpmaster.internal/ubuntu resolute/universe arm64 ipython3 all 8.35.0-2 [4908 B] 110s Get:133 http://ftpmaster.internal/ubuntu resolute/main arm64 comerr-dev arm64 2.1-1.47.2-3ubuntu2 [45.6 kB] 110s Get:134 http://ftpmaster.internal/ubuntu resolute/main arm64 libgssrpc4t64 arm64 1.21.3-5ubuntu2 [57.9 kB] 110s Get:135 http://ftpmaster.internal/ubuntu resolute/main arm64 libkadm5clnt-mit12 arm64 1.21.3-5ubuntu2 [39.7 kB] 110s Get:136 http://ftpmaster.internal/ubuntu resolute/main arm64 libkdb5-10t64 arm64 1.21.3-5ubuntu2 [40.9 kB] 111s Get:137 http://ftpmaster.internal/ubuntu resolute/main arm64 libkadm5srv-mit12 arm64 1.21.3-5ubuntu2 [54.2 kB] 111s Get:138 http://ftpmaster.internal/ubuntu resolute/main arm64 krb5-multidev arm64 1.21.3-5ubuntu2 [125 kB] 111s Get:139 http://ftpmaster.internal/ubuntu resolute/universe arm64 libaec0 arm64 1.1.4-2 [22.2 kB] 111s Get:140 http://ftpmaster.internal/ubuntu resolute/main arm64 libllvm21 arm64 1:21.1.2-2ubuntu6 [29.4 MB] 111s Get:141 http://ftpmaster.internal/ubuntu resolute/universe arm64 libamd-comgr3 arm64 7.0.2+dfsg-1 [14.8 MB] 112s Get:142 http://ftpmaster.internal/ubuntu resolute/universe arm64 libhsakmt1 arm64 6.4.3+dfsg-3 [67.5 kB] 112s Get:143 http://ftpmaster.internal/ubuntu resolute/universe arm64 libhsa-runtime64-1 arm64 6.4.3+dfsg-3 [366 kB] 112s Get:144 http://ftpmaster.internal/ubuntu resolute/universe arm64 libamdhip64-6 arm64 6.4.3-3 [10.4 MB] 112s Get:145 http://ftpmaster.internal/ubuntu resolute/universe arm64 libb2-1 arm64 0.98.1-1.1build1 [17.1 kB] 112s Get:146 http://ftpmaster.internal/ubuntu resolute/main arm64 libsnappy1v5 arm64 1.2.2-2 [30.1 kB] 112s Get:147 http://ftpmaster.internal/ubuntu resolute/universe arm64 libblosc1 arm64 1.21.5+ds-2 [25.9 kB] 112s Get:148 http://ftpmaster.internal/ubuntu resolute/main arm64 libboost-iostreams1.88.0 arm64 1.88.0-1.4ubuntu2 [261 kB] 112s Get:149 http://ftpmaster.internal/ubuntu resolute/main arm64 libboost-thread1.88.0 arm64 1.88.0-1.4ubuntu2 [273 kB] 112s Get:150 http://ftpmaster.internal/ubuntu resolute/main arm64 libbrotli-dev arm64 1.1.0-2build6 [355 kB] 112s Get:151 http://ftpmaster.internal/ubuntu resolute/main arm64 libbz2-dev arm64 1.0.8-6build1 [36.2 kB] 112s Get:152 http://ftpmaster.internal/ubuntu resolute/main arm64 libpixman-1-0 arm64 0.46.4-1 [204 kB] 112s Get:153 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-render0 arm64 1.17.0-2build1 [18.1 kB] 112s Get:154 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-shm0 arm64 1.17.0-2build1 [6234 B] 112s Get:155 http://ftpmaster.internal/ubuntu resolute/main arm64 libcairo2 arm64 1.18.4-1build1 [592 kB] 112s Get:156 http://ftpmaster.internal/ubuntu resolute/main arm64 libcares2 arm64 1.34.5-1 [101 kB] 112s Get:157 http://ftpmaster.internal/ubuntu resolute/main arm64 libevent-2.1-7t64 arm64 2.1.12-stable-10build1 [152 kB] 112s Get:158 http://ftpmaster.internal/ubuntu resolute/main arm64 libunbound8 arm64 1.22.0-2ubuntu4 [431 kB] 112s Get:159 http://ftpmaster.internal/ubuntu resolute/main arm64 libgnutls-dane0t64 arm64 3.8.9-3ubuntu2 [25.0 kB] 112s Get:160 http://ftpmaster.internal/ubuntu resolute/main arm64 libgnutls-openssl27t64 arm64 3.8.9-3ubuntu2 [25.1 kB] 112s Get:161 http://ftpmaster.internal/ubuntu resolute/main arm64 libidn2-dev arm64 2.3.8-4 [123 kB] 112s Get:162 http://ftpmaster.internal/ubuntu resolute/main arm64 libp11-kit-dev arm64 0.25.9-2 [29.3 kB] 112s Get:163 http://ftpmaster.internal/ubuntu resolute/main arm64 libtasn1-6-dev arm64 4.20.0-2build1 [93.6 kB] 112s Get:164 http://ftpmaster.internal/ubuntu resolute/main arm64 libgmpxx4ldbl arm64 2:6.3.0+dfsg-5ubuntu1 [9944 B] 112s Get:165 http://ftpmaster.internal/ubuntu resolute/main arm64 libgmp-dev arm64 2:6.3.0+dfsg-5ubuntu1 [348 kB] 112s Get:166 http://ftpmaster.internal/ubuntu resolute/main arm64 nettle-dev arm64 3.10.2-1 [1183 kB] 112s Get:167 http://ftpmaster.internal/ubuntu resolute/main arm64 libgnutls28-dev arm64 3.8.9-3ubuntu2 [1155 kB] 113s Get:168 http://ftpmaster.internal/ubuntu resolute/main arm64 libkrb5-dev arm64 1.21.3-5ubuntu2 [11.9 kB] 113s Get:169 http://ftpmaster.internal/ubuntu resolute/main arm64 libldap-dev arm64 2.6.10+dfsg-1ubuntu2 [331 kB] 113s Get:170 http://ftpmaster.internal/ubuntu resolute/main arm64 libpkgconf3 arm64 1.8.1-4build1 [33.7 kB] 113s Get:171 http://ftpmaster.internal/ubuntu resolute/main arm64 pkgconf-bin arm64 1.8.1-4build1 [21.7 kB] 113s Get:172 http://ftpmaster.internal/ubuntu resolute/main arm64 pkgconf arm64 1.8.1-4build1 [16.8 kB] 113s Get:173 http://ftpmaster.internal/ubuntu resolute/main arm64 libnghttp2-dev arm64 1.64.0-1.1ubuntu1 [119 kB] 113s Get:174 http://ftpmaster.internal/ubuntu resolute/main arm64 libpsl-dev arm64 0.21.2-1.1build1 [77.2 kB] 113s Get:175 http://ftpmaster.internal/ubuntu resolute/main arm64 zlib1g-dev arm64 1:1.3.dfsg+really1.3.1-1ubuntu2 [899 kB] 113s Get:176 http://ftpmaster.internal/ubuntu resolute/main arm64 librtmp-dev arm64 2.4+20151223.gitfa8646d.1-3 [70.6 kB] 113s Get:177 http://ftpmaster.internal/ubuntu resolute/main arm64 libssl-dev arm64 3.5.3-1ubuntu2 [3448 kB] 113s Get:178 http://ftpmaster.internal/ubuntu resolute/main arm64 libssh2-1-dev arm64 1.11.1-1build1 [292 kB] 113s Get:179 http://ftpmaster.internal/ubuntu resolute/main arm64 libzstd-dev arm64 1.5.7+dfsg-2 [349 kB] 113s Get:180 http://ftpmaster.internal/ubuntu resolute/main arm64 libcurl4-gnutls-dev arm64 8.14.1-2ubuntu1 [526 kB] 113s Get:181 http://ftpmaster.internal/ubuntu resolute/main arm64 libdatrie1 arm64 0.2.13-4 [19.1 kB] 113s Get:182 http://ftpmaster.internal/ubuntu resolute/universe arm64 libdouble-conversion3 arm64 3.3.1-2 [38.9 kB] 113s Get:183 http://ftpmaster.internal/ubuntu resolute/universe arm64 libdxflib3 arm64 3.26.4-2 [55.9 kB] 113s Get:184 http://ftpmaster.internal/ubuntu resolute/universe arm64 libeccodes-data all 2.41.0-1 [1779 kB] 113s Get:185 http://ftpmaster.internal/ubuntu resolute/universe arm64 libeccodes0 arm64 2.41.0-1 [836 kB] 113s Get:186 http://ftpmaster.internal/ubuntu resolute/universe arm64 libsz2 arm64 1.1.4-2 [5258 B] 113s Get:187 http://ftpmaster.internal/ubuntu resolute/universe arm64 libaec-dev arm64 1.1.4-2 [19.2 kB] 113s Get:188 http://ftpmaster.internal/ubuntu resolute/main arm64 libpng-dev arm64 1.6.50-1 [268 kB] 113s Get:189 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg-turbo8-dev arm64 2.1.5-4ubuntu2 [306 kB] 113s Get:190 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg8-dev arm64 8c-2ubuntu11 [1484 B] 113s Get:191 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg-dev arm64 8c-2ubuntu11 [1482 B] 113s Get:192 http://ftpmaster.internal/ubuntu resolute/universe arm64 libeccodes-dev arm64 2.41.0-1 [1180 kB] 113s Get:193 http://ftpmaster.internal/ubuntu resolute/universe arm64 libopenblas0 arm64 0.3.30+ds-3 [6306 B] 113s Get:194 http://ftpmaster.internal/ubuntu resolute/main arm64 libevent-pthreads-2.1-7t64 arm64 2.1.12-stable-10build1 [8272 B] 113s Get:195 http://ftpmaster.internal/ubuntu resolute/main arm64 librdmacm1t64 arm64 56.1-1ubuntu1 [71.4 kB] 113s Get:196 http://ftpmaster.internal/ubuntu resolute/universe arm64 libfabric1 arm64 2.1.0-1.1 [622 kB] 113s Get:197 http://ftpmaster.internal/ubuntu resolute/universe arm64 libhwloc15 arm64 2.12.2-1 [169 kB] 113s Get:198 http://ftpmaster.internal/ubuntu resolute/main arm64 libibumad3 arm64 56.1-1ubuntu1 [31.3 kB] 113s Get:199 http://ftpmaster.internal/ubuntu resolute/main arm64 libibmad5 arm64 56.1-1ubuntu1 [44.1 kB] 113s Get:200 http://ftpmaster.internal/ubuntu resolute/universe arm64 libucx0 arm64 1.19.0+ds-1build1 [1187 kB] 113s Get:201 http://ftpmaster.internal/ubuntu resolute/main arm64 libpciaccess0 arm64 0.18.1-1ubuntu2 [19.4 kB] 113s Get:202 http://ftpmaster.internal/ubuntu resolute/main arm64 libxnvctrl0 arm64 510.47.03-0ubuntu4 [12.4 kB] 113s Get:203 http://ftpmaster.internal/ubuntu resolute/main arm64 ocl-icd-libopencl1 arm64 2.3.4-1 [41.1 kB] 114s Get:204 http://ftpmaster.internal/ubuntu resolute/universe arm64 libhwloc-plugins arm64 2.12.2-1 [16.6 kB] 114s Get:205 http://ftpmaster.internal/ubuntu resolute/universe arm64 libopenmpi40 arm64 5.0.8-8ubuntu1 [3274 kB] 114s Get:206 http://ftpmaster.internal/ubuntu resolute/universe arm64 proj-data all 9.7.0-1 [7970 kB] 115s Get:207 http://ftpmaster.internal/ubuntu resolute/universe arm64 libproj25 arm64 9.7.0-1 [1368 kB] 115s Get:208 http://ftpmaster.internal/ubuntu resolute/universe arm64 libqhull-r8.0 arm64 2020.2-7 [190 kB] 115s Get:209 http://ftpmaster.internal/ubuntu resolute/universe arm64 libqhullcpp8.0 arm64 2020.2-7 [49.0 kB] 115s Get:210 http://ftpmaster.internal/ubuntu resolute/main arm64 librados2 arm64 19.2.3-0ubuntu2 [4124 kB] 115s Get:211 http://ftpmaster.internal/ubuntu resolute/main arm64 librsync2t64 arm64 2.3.4-1.1ubuntu2 [42.3 kB] 115s Get:212 http://ftpmaster.internal/ubuntu resolute/universe arm64 libeckit0d arm64 1.32.3-1 [1820 kB] 115s Get:213 http://ftpmaster.internal/ubuntu resolute/universe arm64 libeckit-utils arm64 1.32.3-1 [51.8 kB] 115s Get:214 http://ftpmaster.internal/ubuntu resolute/universe arm64 openmpi-common all 5.0.8-8ubuntu1 [108 kB] 115s Get:215 http://ftpmaster.internal/ubuntu resolute/main arm64 libnl-3-dev arm64 3.11.0-2 [107 kB] 115s Get:216 http://ftpmaster.internal/ubuntu resolute/main arm64 libnl-route-3-dev arm64 3.11.0-2 [237 kB] 115s Get:217 http://ftpmaster.internal/ubuntu resolute/main arm64 libibverbs-dev arm64 56.1-1ubuntu1 [703 kB] 115s Get:218 http://ftpmaster.internal/ubuntu resolute/main arm64 libnuma-dev arm64 2.0.19-1 [39.7 kB] 115s Get:219 http://ftpmaster.internal/ubuntu resolute/main arm64 libltdl7 arm64 2.5.4-7 [42.8 kB] 115s Get:220 http://ftpmaster.internal/ubuntu resolute/main arm64 libltdl-dev arm64 2.5.4-7 [173 kB] 115s Get:221 http://ftpmaster.internal/ubuntu resolute/universe arm64 libhwloc-dev arm64 2.12.2-1 [274 kB] 115s Get:222 http://ftpmaster.internal/ubuntu resolute/main arm64 libevent-extra-2.1-7t64 arm64 2.1.12-stable-10build1 [67.1 kB] 115s Get:223 http://ftpmaster.internal/ubuntu resolute/main arm64 libevent-openssl-2.1-7t64 arm64 2.1.12-stable-10build1 [15.9 kB] 115s Get:224 http://ftpmaster.internal/ubuntu resolute/main arm64 libevent-dev arm64 2.1.12-stable-10build1 [295 kB] 115s Get:225 http://ftpmaster.internal/ubuntu resolute/main arm64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 115s Get:226 http://ftpmaster.internal/ubuntu resolute/universe arm64 libjs-jquery-ui all 1.13.2+dfsg-1 [252 kB] 115s Get:227 http://ftpmaster.internal/ubuntu resolute/universe arm64 openmpi-bin arm64 5.0.8-8ubuntu1 [209 kB] 115s Get:228 http://ftpmaster.internal/ubuntu resolute/universe arm64 libopenmpi-dev arm64 5.0.8-8ubuntu1 [1225 kB] 115s Get:229 http://ftpmaster.internal/ubuntu resolute/universe arm64 mpi-default-dev arm64 1.19 [3384 B] 115s Get:230 http://ftpmaster.internal/ubuntu resolute/main arm64 libxxhash-dev arm64 0.8.3-2 [81.7 kB] 115s Get:231 http://ftpmaster.internal/ubuntu resolute/main arm64 libjemalloc-dev arm64 5.3.0-3build1 [391 kB] 115s Get:232 http://ftpmaster.internal/ubuntu resolute/main arm64 libsnappy-dev arm64 1.2.2-2 [45.2 kB] 115s Get:233 http://ftpmaster.internal/ubuntu resolute/main arm64 liblz4-dev arm64 1.10.0-6 [104 kB] 115s Get:234 http://ftpmaster.internal/ubuntu resolute/universe arm64 libeigen3-dev all 3.4.0-5 [1056 kB] 115s Get:235 http://ftpmaster.internal/ubuntu resolute/universe arm64 libopenblas-pthread-dev arm64 0.3.30+ds-3 [4259 kB] 115s Get:236 http://ftpmaster.internal/ubuntu resolute/universe arm64 libopenblas-dev arm64 0.3.30+ds-3 [21.3 kB] 115s Get:237 http://ftpmaster.internal/ubuntu resolute/universe arm64 libeckit-dev arm64 1.32.3-1 [273 kB] 115s Get:238 http://ftpmaster.internal/ubuntu resolute/main arm64 libx11-xcb1 arm64 2:1.8.12-1build1 [8216 B] 115s Get:239 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-dri3-0 arm64 1.17.0-2build1 [8120 B] 115s Get:240 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-present0 arm64 1.17.0-2build1 [6560 B] 116s Get:241 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-randr0 arm64 1.17.0-2build1 [20.2 kB] 116s Get:242 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-sync1 arm64 1.17.0-2build1 [10.4 kB] 116s Get:243 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-xfixes0 arm64 1.17.0-2build1 [11.4 kB] 116s Get:244 http://ftpmaster.internal/ubuntu resolute/main arm64 libxshmfence1 arm64 1.3.3-1 [5378 B] 116s Get:245 http://ftpmaster.internal/ubuntu resolute/main arm64 mesa-libgallium arm64 25.2.6-1ubuntu1 [12.1 MB] 116s Get:246 http://ftpmaster.internal/ubuntu resolute/main arm64 libgbm1 arm64 25.2.6-1ubuntu1 [34.3 kB] 116s Get:247 http://ftpmaster.internal/ubuntu resolute/main arm64 libwayland-client0 arm64 1.24.0-2 [27.6 kB] 116s Get:248 http://ftpmaster.internal/ubuntu resolute/main arm64 libegl-mesa0 arm64 25.2.6-1ubuntu1 [114 kB] 116s Get:249 http://ftpmaster.internal/ubuntu resolute/universe arm64 libgeos3.13.1 arm64 3.13.1-1 [916 kB] 116s Get:250 http://ftpmaster.internal/ubuntu resolute/universe arm64 libgeos-c1t64 arm64 3.13.1-1 [92.2 kB] 116s Get:251 http://ftpmaster.internal/ubuntu resolute/universe arm64 libgeotiff5 arm64 1.7.4-1 [58.9 kB] 116s Get:252 http://ftpmaster.internal/ubuntu resolute/main arm64 libvulkan1 arm64 1.4.328.1-1 [169 kB] 116s Get:253 http://ftpmaster.internal/ubuntu resolute/main arm64 libgl1-mesa-dri arm64 25.2.6-1ubuntu1 [34.9 kB] 116s Get:254 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-glx0 arm64 1.17.0-2build1 [27.8 kB] 116s Get:255 http://ftpmaster.internal/ubuntu resolute/main arm64 libxxf86vm1 arm64 1:1.1.4-2 [10.2 kB] 116s Get:256 http://ftpmaster.internal/ubuntu resolute/main arm64 libglx-mesa0 arm64 25.2.6-1ubuntu1 [110 kB] 116s Get:257 http://ftpmaster.internal/ubuntu resolute/main arm64 libgraphite2-3 arm64 1.3.14-2ubuntu1 [70.6 kB] 116s Get:258 http://ftpmaster.internal/ubuntu resolute/main arm64 libharfbuzz0b arm64 12.1.0-1 [523 kB] 116s Get:259 http://ftpmaster.internal/ubuntu resolute/universe arm64 libhdf5-310 arm64 1.14.5+repack-4 [1286 kB] 116s Get:260 http://ftpmaster.internal/ubuntu resolute/universe arm64 libhdf5-hl-310 arm64 1.14.5+repack-4 [58.9 kB] 116s Get:261 http://ftpmaster.internal/ubuntu resolute/main arm64 libimagequant0 arm64 2.18.0-1build1 [37.1 kB] 116s Get:262 http://ftpmaster.internal/ubuntu resolute/main arm64 libwacom-common all 2.16.1-1 [113 kB] 116s Get:263 http://ftpmaster.internal/ubuntu resolute/main arm64 libwacom9 arm64 2.16.1-1 [28.2 kB] 116s Get:264 http://ftpmaster.internal/ubuntu resolute/main arm64 libinput-bin arm64 1.28.1-1ubuntu2 [24.2 kB] 116s Get:265 http://ftpmaster.internal/ubuntu resolute/main arm64 libmtdev1t64 arm64 1.1.7-1 [14.6 kB] 116s Get:266 http://ftpmaster.internal/ubuntu resolute/main arm64 libinput10 arm64 1.28.1-1ubuntu2 [138 kB] 116s Get:267 http://ftpmaster.internal/ubuntu resolute/main arm64 libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB] 116s Get:268 http://ftpmaster.internal/ubuntu resolute/main arm64 libjs-sphinxdoc all 8.2.3-1ubuntu2 [28.0 kB] 116s Get:269 http://ftpmaster.internal/ubuntu resolute/universe arm64 libjs-sprintf-js all 1.1.2+ds1+~1.1.2-1 [12.8 kB] 116s Get:270 http://ftpmaster.internal/ubuntu resolute/main arm64 libjson-perl all 4.10000-1 [81.9 kB] 116s Get:271 http://ftpmaster.internal/ubuntu resolute/main arm64 liblcms2-2 arm64 2.17-1 [170 kB] 116s Get:272 http://ftpmaster.internal/ubuntu resolute/main arm64 liblua5.4-0 arm64 5.4.8-1 [171 kB] 116s Get:273 http://ftpmaster.internal/ubuntu resolute/universe arm64 liblzf1 arm64 3.6-4 [7426 B] 116s Get:274 http://ftpmaster.internal/ubuntu resolute/universe arm64 libmagics++-data all 4.16.0+really4.16.0-2 [41.0 MB] 118s Get:275 http://ftpmaster.internal/ubuntu resolute/universe arm64 libnetcdf22 arm64 1:4.9.3-1build1 [555 kB] 118s Get:276 http://ftpmaster.internal/ubuntu resolute/universe arm64 libodc-0d arm64 1.6.2-2 [400 kB] 118s Get:277 http://ftpmaster.internal/ubuntu resolute/main arm64 libthai-data all 0.1.29-2build1 [158 kB] 118s Get:278 http://ftpmaster.internal/ubuntu resolute/main arm64 libthai0 arm64 0.1.29-2build1 [18.2 kB] 118s Get:279 http://ftpmaster.internal/ubuntu resolute/main arm64 libpango-1.0-0 arm64 1.56.3-2 [237 kB] 118s Get:280 http://ftpmaster.internal/ubuntu resolute/main arm64 libpangoft2-1.0-0 arm64 1.56.3-2 [50.2 kB] 118s Get:281 http://ftpmaster.internal/ubuntu resolute/main arm64 libpangocairo-1.0-0 arm64 1.56.3-2 [27.7 kB] 118s Get:282 http://ftpmaster.internal/ubuntu resolute/main arm64 libpcre2-16-0 arm64 10.46-1 [225 kB] 118s Get:283 http://ftpmaster.internal/ubuntu resolute/universe arm64 libqt6core6t64 arm64 6.9.2+dfsg-3ubuntu1 [1945 kB] 118s Get:284 http://ftpmaster.internal/ubuntu resolute/main arm64 libglvnd0 arm64 1.7.0-1build2 [59.2 kB] 118s Get:285 http://ftpmaster.internal/ubuntu resolute/main arm64 libegl1 arm64 1.7.0-1build2 [31.9 kB] 118s Get:286 http://ftpmaster.internal/ubuntu resolute/main arm64 libglx0 arm64 1.7.0-1build2 [34.5 kB] 118s Get:287 http://ftpmaster.internal/ubuntu resolute/universe arm64 libmd4c0 arm64 0.5.2-2 [42.4 kB] 118s Get:288 http://ftpmaster.internal/ubuntu resolute/main arm64 libopengl0 arm64 1.7.0-1build2 [34.7 kB] 118s Get:289 http://ftpmaster.internal/ubuntu resolute/universe arm64 libqt6dbus6 arm64 6.9.2+dfsg-3ubuntu1 [270 kB] 118s Get:290 http://ftpmaster.internal/ubuntu resolute/universe arm64 libts0t64 arm64 1.22-1.1build1 [63.9 kB] 118s Get:291 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-util1 arm64 0.4.1-1 [10.9 kB] 118s Get:292 http://ftpmaster.internal/ubuntu resolute/universe arm64 libxcb-image0 arm64 0.4.0-2build1 [10.8 kB] 118s Get:293 http://ftpmaster.internal/ubuntu resolute/universe arm64 libxcb-render-util0 arm64 0.3.10-1 [10.5 kB] 118s Get:294 http://ftpmaster.internal/ubuntu resolute/universe arm64 libxcb-cursor0 arm64 0.1.5-1 [10.6 kB] 118s Get:295 http://ftpmaster.internal/ubuntu resolute/universe arm64 libxcb-icccm4 arm64 0.4.2-1 [10.9 kB] 118s Get:296 http://ftpmaster.internal/ubuntu resolute/universe arm64 libxcb-keysyms1 arm64 0.4.1-1 [8802 B] 118s Get:297 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-shape0 arm64 1.17.0-2build1 [6732 B] 118s Get:298 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-xinput0 arm64 1.17.0-2build1 [37.8 kB] 118s Get:299 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-xkb1 arm64 1.17.0-2build1 [35.3 kB] 118s Get:300 http://ftpmaster.internal/ubuntu resolute/main arm64 libxkbcommon-x11-0 arm64 1.12.3-1 [13.8 kB] 118s Get:301 http://ftpmaster.internal/ubuntu resolute/universe arm64 libqt6gui6 arm64 6.9.2+dfsg-3ubuntu1 [3314 kB] 118s Get:302 http://ftpmaster.internal/ubuntu resolute/universe arm64 libqt6widgets6 arm64 6.9.2+dfsg-3ubuntu1 [2782 kB] 118s Get:303 http://ftpmaster.internal/ubuntu resolute/main arm64 mysql-common all 5.8+1.1.1ubuntu1 [6922 B] 118s Get:304 http://ftpmaster.internal/ubuntu resolute/main arm64 libmysqlclient24 arm64 8.4.7-0ubuntu2 [1244 kB] 119s Get:305 http://ftpmaster.internal/ubuntu resolute/main arm64 libpq5 arm64 17.6-1build1 [149 kB] 119s Get:306 http://ftpmaster.internal/ubuntu resolute/universe arm64 libterralib3t64 arm64 4.3.0+dfsg.2-12.2build2 [2381 kB] 119s Get:307 http://ftpmaster.internal/ubuntu resolute/universe arm64 libmagplus3v5 arm64 4.16.0+really4.16.0-2 [2481 kB] 119s Get:308 http://ftpmaster.internal/ubuntu resolute/universe arm64 libmagics++-metview-dev arm64 4.16.0+really4.16.0-2 [954 kB] 119s Get:309 http://ftpmaster.internal/ubuntu resolute/universe arm64 libterralib-dev arm64 4.3.0+dfsg.2-12.2build2 [3960 kB] 119s Get:310 http://ftpmaster.internal/ubuntu resolute/universe arm64 magics++ arm64 4.16.0+really4.16.0-2 [32.3 kB] 119s Get:311 http://ftpmaster.internal/ubuntu resolute/universe arm64 odc arm64 1.6.2-2 [8808 B] 119s Get:312 http://ftpmaster.internal/ubuntu resolute/universe arm64 libodc-dev arm64 1.6.2-2 [67.7 kB] 119s Get:313 http://ftpmaster.internal/ubuntu resolute/universe arm64 libmagics++-dev arm64 4.16.0+really4.16.0-2 [83.8 kB] 120s Get:314 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-xtend all 4.0.2-3 [3902 B] 120s Get:315 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-corepack all 0.24.0-5 [757 kB] 120s Get:316 http://ftpmaster.internal/ubuntu resolute/universe arm64 nodejs arm64 20.19.4+dfsg-1 [342 kB] 120s Get:317 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-acorn all 8.8.1+ds+~cs25.17.7-2 [115 kB] 120s Get:318 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-cjs-module-lexer all 1.2.3+dfsg-1 [32.1 kB] 120s Get:319 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-balanced-match all 2.0.0-1 [4910 B] 120s Get:320 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-brace-expansion all 2.0.1+~1.1.0-2 [8172 B] 120s Get:321 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-minimatch all 9.0.3-6 [78.0 kB] 120s Get:322 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-ms all 2.1.3+~cs0.7.31-3 [5738 B] 120s Get:323 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-debug all 4.4.1+~4.1.12-1 [17.7 kB] 120s Get:324 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-lru-cache all 10.0.1-3 [61.9 kB] 120s Get:325 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-semver all 7.6.1+~7.5.8-2 [45.2 kB] 120s Get:326 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-llhttp all 9.3.3~really9.3.0+~cs12.11.8-3 [158 kB] 120s Get:327 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-undici all 7.16.0+dfsg+~cs3.2.0-2 [380 kB] 120s Get:328 http://ftpmaster.internal/ubuntu resolute/universe arm64 libnode115 arm64 20.19.4+dfsg-1 [13.7 MB] 120s Get:329 http://ftpmaster.internal/ubuntu resolute/universe arm64 libnorm1t64 arm64 1.5.9+dfsg-4 [152 kB] 120s Get:330 http://ftpmaster.internal/ubuntu resolute/universe arm64 libpgm-5.3-0t64 arm64 5.3.128~dfsg-2.1build1 [162 kB] 120s Get:331 http://ftpmaster.internal/ubuntu resolute/main arm64 libpython3.14-stdlib arm64 3.14.0-4 [2349 kB] 120s Get:332 http://ftpmaster.internal/ubuntu resolute/main arm64 libraqm0 arm64 0.10.3-1 [15.0 kB] 120s Get:333 http://ftpmaster.internal/ubuntu resolute/main arm64 libsodium23 arm64 1.0.18-1build3 [119 kB] 120s Get:334 http://ftpmaster.internal/ubuntu resolute/main arm64 libwebpdemux2 arm64 1.5.0-0.1 [12.5 kB] 120s Get:335 http://ftpmaster.internal/ubuntu resolute/main arm64 libwebpmux3 arm64 1.5.0-0.1 [25.4 kB] 120s Get:336 http://ftpmaster.internal/ubuntu resolute/main arm64 libxslt1.1 arm64 1.1.43-0.3 [172 kB] 120s Get:337 http://ftpmaster.internal/ubuntu resolute/universe arm64 libzmq5 arm64 4.3.5-1build2 [247 kB] 120s Get:338 http://ftpmaster.internal/ubuntu resolute/universe arm64 libzopfli1 arm64 1.0.3-3 [108 kB] 120s Get:339 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-mypy-extensions all 1.1.0-1 [6716 B] 120s Get:340 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-psutil arm64 7.1.0-1ubuntu1 [191 kB] 120s Get:341 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-mypy arm64 1.15.0-5 [8679 kB] 120s Get:342 http://ftpmaster.internal/ubuntu resolute/universe arm64 mypy all 1.15.0-5 [25.4 kB] 120s Get:343 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-esprima all 4.0.1+ds+~4.0.3-2 [69.3 kB] 120s Get:344 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-fortawesome-fontawesome-free all 6.7.2+ds1-1 [1653 kB] 121s Get:345 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-sprintf-js all 1.1.2+ds1+~1.1.2-1 [3916 B] 121s Get:346 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-argparse all 2.0.1-2 [33.2 kB] 121s Get:347 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-js-yaml all 4.1.0+dfsg+~4.0.5-7 [61.9 kB] 121s Get:348 http://ftpmaster.internal/ubuntu resolute/universe arm64 pandoc-data all 3.1.11.1-3build1 [78.8 kB] 121s Get:349 http://ftpmaster.internal/ubuntu resolute/universe arm64 pandoc arm64 3.1.11.1+ds-4 [28.0 MB] 121s Get:350 http://ftpmaster.internal/ubuntu resolute/universe arm64 pybuild-plugin-autopkgtest all 6.20250414 [1746 B] 121s Get:351 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pyproject-hooks all 1.2.0-1 [10.2 kB] 121s Get:352 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-wheel all 0.46.1-2 [22.1 kB] 121s Get:353 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-build all 1.2.2-4 [31.0 kB] 121s Get:354 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-installer all 0.7.0+dfsg1-3 [17.4 kB] 121s Get:355 http://ftpmaster.internal/ubuntu resolute/universe arm64 pybuild-plugin-pyproject all 6.20250414 [1728 B] 121s Get:356 http://ftpmaster.internal/ubuntu resolute/universe arm64 python-cartopy-data all 0.25.0+dfsg-1 [6537 kB] 121s Get:357 http://ftpmaster.internal/ubuntu resolute/main arm64 libjs-mathjax all 2.7.9+dfsg-1 [5665 kB] 121s Get:358 http://ftpmaster.internal/ubuntu resolute/universe arm64 python-dask-doc all 2024.12.1+dfsg-2 [10.4 MB] 122s Get:359 http://ftpmaster.internal/ubuntu resolute/universe arm64 python-matplotlib-data all 3.10.7+dfsg1-1 [2930 kB] 122s Get:360 http://ftpmaster.internal/ubuntu resolute/universe arm64 python-pandas-doc all 2.3.3+dfsg-1ubuntu1 [14.1 MB] 122s Get:361 http://ftpmaster.internal/ubuntu resolute/universe arm64 python-tinycss2-common all 1.4.0-2 [47.0 kB] 122s Get:362 http://ftpmaster.internal/ubuntu resolute/universe arm64 libjs-requirejs all 2.3.7+ds+~2.1.37-1 [201 kB] 122s Get:363 http://ftpmaster.internal/ubuntu resolute/universe arm64 python-xarray-doc all 2025.03.1-8 [5284 kB] 122s Get:364 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-accessible-pygments all 0.0.5-2 [790 kB] 122s Get:365 http://ftpmaster.internal/ubuntu resolute/main arm64 python3.14 arm64 3.14.0-4 [805 kB] 122s Get:366 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 python3-all arm64 3.13.7-2 [890 B] 122s Get:367 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-defusedxml all 0.7.1-3 [42.2 kB] 122s Get:368 http://ftpmaster.internal/ubuntu resolute/main arm64 sphinx-common all 8.2.3-1ubuntu2 [656 kB] 122s Get:369 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-alabaster all 0.7.16-0.1 [18.5 kB] 122s Get:370 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-roman all 5.1-1 [10.6 kB] 122s Get:371 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-docutils all 0.21.2+dfsg-2 [409 kB] 122s Get:372 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-imagesize all 1.4.1-1 [6844 B] 122s Get:373 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-snowballstemmer all 3.0.1-1 [65.9 kB] 122s Get:374 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-sphinx all 8.2.3-1ubuntu2 [482 kB] 122s Get:375 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-autodocsumm all 0.2.14-2 [11.9 kB] 122s Get:376 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-webencodings all 0.5.1-5 [11.5 kB] 122s Get:377 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-html5lib all 1.2-2 [90.6 kB] 122s Get:378 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-bleach all 6.2.0-1 [43.9 kB] 122s Get:379 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-bottleneck arm64 1.4.2+ds1-2build2 [88.4 kB] 122s Get:380 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-brotli arm64 1.1.0-2build6 [343 kB] 122s Get:381 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-soupsieve all 2.7-2 [33.6 kB] 122s Get:382 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-bs4 all 4.13.4-3 [137 kB] 122s Get:383 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-pil arm64 11.3.0-1ubuntu2 [492 kB] 123s Get:384 http://ftpmaster.internal/ubuntu resolute/main arm64 python3.14-tk arm64 3.14.0-4 [107 kB] 123s Get:385 http://ftpmaster.internal/ubuntu resolute/main arm64 python3.13-tk arm64 3.13.9-1 [106 kB] 123s Get:386 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-tk arm64 3.13.9-1 [8946 B] 123s Get:387 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pil.imagetk arm64 11.3.0-1ubuntu2 [9582 B] 123s Get:388 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-contourpy arm64 1.3.1-2 [240 kB] 123s Get:389 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-cycler all 0.12.1-2 [9850 B] 123s Get:390 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-platformdirs all 4.3.7-1 [16.9 kB] 123s Get:391 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-fs all 2.4.16-9ubuntu1 [91.5 kB] 123s Get:392 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-lxml arm64 6.0.2-1 [2155 kB] 123s Get:393 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-lz4 arm64 4.4.4+dfsg-3 [27.6 kB] 123s Get:394 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-scipy arm64 1.15.3-1ubuntu1 [18.7 MB] 123s Get:395 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-mpmath all 1.3.0-2 [423 kB] 123s Get:396 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sympy all 1.14.0-2 [4306 kB] 123s Get:397 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-ufolib2 all 0.17.1+dfsg1-1 [33.5 kB] 123s Get:398 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-zopfli arm64 0.4.0-1 [10.8 kB] 123s Get:399 http://ftpmaster.internal/ubuntu resolute/universe arm64 unicode-data all 16.0.0-1 [9513 kB] 123s Get:400 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-fonttools arm64 4.57.0-2build1 [1648 kB] 123s Get:401 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-kiwisolver arm64 1.4.10~rc0-1 [60.1 kB] 123s Get:402 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-matplotlib arm64 3.10.7+dfsg1-1 [17.1 MB] 124s Get:403 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pyproj arm64 3.7.2-1 [578 kB] 124s Get:404 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pyshp all 2.3.1-3 [61.8 kB] 124s Get:405 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-shapely arm64 2.1.2-1 [406 kB] 125s Get:406 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-cartopy arm64 0.25.0+dfsg-1 [516 kB] 125s Get:407 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-ply all 3.11-9 [45.8 kB] 125s Get:408 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-pycparser all 2.23-1 [77.2 kB] 125s Get:409 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-cffi all 2.0.0-2 [75.5 kB] 125s Get:410 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-click all 8.2.0+0.really.8.1.8-1 [80.0 kB] 125s Get:411 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-findlibs arm64 0.0.5-1build1 [3844 B] 125s Get:412 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-ecmwflibs arm64 2:0.6.3-2build2 [8558 B] 125s Get:413 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-eccodes arm64 2:2.43.0-1 [33.1 kB] 125s Get:414 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-pytz all 2025.2-4 [32.3 kB] 125s Get:415 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pandas-lib arm64 2.3.3+dfsg-1ubuntu1 [6979 kB] 128s Get:416 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pandas all 2.3.3+dfsg-1ubuntu1 [2948 kB] 128s Get:417 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-xarray all 2025.03.1-8 [831 kB] 128s Get:418 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-cfgrib arm64 0.9.15.1-1 [50.2 kB] 128s Get:419 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-cftime arm64 1.6.5-1 [485 kB] 128s Get:420 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-cloudpickle all 3.1.1-1 [22.4 kB] 128s Get:421 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-comm all 0.2.1-1 [7016 B] 128s Get:422 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-coverage arm64 7.8.2+dfsg1-1 [157 kB] 128s Get:423 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-crc32c arm64 2.7.1-1build1 [23.9 kB] 128s Get:424 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-fsspec all 2025.3.2-1ubuntu1 [217 kB] 128s Get:425 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-toolz all 1.0.0-2 [45.0 kB] 128s Get:426 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-locket all 1.0.0-2 [5872 B] 128s Get:427 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-partd all 1.4.2-1 [15.7 kB] 128s Get:428 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-dask all 2024.12.1+dfsg-2 [875 kB] 128s Get:429 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-debugpy arm64 1.8.12+ds-1ubuntu1 [741 kB] 128s Get:430 http://ftpmaster.internal/ubuntu resolute/main arm64 python3.13-doc all 3.13.9-1 [14.3 MB] 129s Get:431 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 python3-doc all 3.13.7-2 [10.8 kB] 129s Get:432 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-donfig all 0.8.1+dfsg-3 [17.3 kB] 129s Get:433 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-execnet all 2.1.1-1 [33.4 kB] 129s Get:434 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-fastjsonschema all 2.21.1-1 [20.4 kB] 129s Get:435 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-flexcache all 0.3-2 [13.4 kB] 129s Get:436 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-flexparser all 0.4-1 [43.8 kB] 129s Get:437 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-h5py-serial arm64 3.13.0-1ubuntu1 [1123 kB] 130s Get:438 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-h5py all 3.13.0-1ubuntu1 [8230 B] 130s Get:439 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-h5netcdf all 1.6.1-1 [46.7 kB] 130s Get:440 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-sortedcontainers all 2.4.0-2 [27.6 kB] 130s Get:441 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-hypothesis all 6.130.5-2 [341 kB] 130s Get:442 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-iniconfig all 2.1.0-1 [6840 B] 130s Get:443 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-jupyter-core all 5.7.2-5 [28.1 kB] 130s Get:444 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-tornado arm64 6.5.2-3 [305 kB] 130s Get:445 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-zmq arm64 27.1.0-1 [231 kB] 130s Get:446 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-jupyter-client all 8.6.3-3 [78.4 kB] 130s Get:447 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-nest-asyncio all 1.5.4-1 [6256 B] 130s Get:448 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-ipykernel all 6.29.5-2 [82.7 kB] 130s Get:449 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-jupyter-console all 6.6.3-2 [21.6 kB] 130s Get:450 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-jupyterlab-pygments all 0.2.2-3 [6054 B] 130s Get:451 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-mistune all 3.1.4-1 [35.0 kB] 130s Get:452 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-nbformat all 5.9.1-1 [41.2 kB] 130s Get:453 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-nbclient all 0.8.0-2 [53.9 kB] 130s Get:454 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-tinycss2 all 1.4.0-2 [22.5 kB] 130s Get:455 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pandocfilters all 1.5.1-1 [23.6 kB] 130s Get:456 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-nbconvert all 7.16.6-1 [140 kB] 130s Get:457 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-nbsphinx all 0.9.5+ds-1 [41.0 kB] 130s Get:458 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-netcdf4 arm64 1.7.2-1build4 [587 kB] 130s Get:459 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pydata-sphinx-theme all 0.16.1+dfsg-3 [959 kB] 130s Get:460 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-numcodecs arm64 0.16.3+ds-1 [490 kB] 130s Get:461 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-numpydoc all 1.9.0-1 [53.2 kB] 130s Get:462 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pickleshare all 0.7.5-5 [7570 B] 130s Get:463 http://ftpmaster.internal/ubuntu resolute/main arm64 python3-pint all 0.24.4-2 [203 kB] 130s Get:464 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pip all 25.1.1+dfsg-1ubuntu2 [1416 kB] 130s Get:465 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pluggy all 1.6.0-1 [21.0 kB] 130s Get:466 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pooch all 1.8.2-1 [49.9 kB] 130s Get:467 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pytest all 8.3.5-2 [252 kB] 130s Get:468 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-regex arm64 0.1.20250918-1 [304 kB] 130s Get:469 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-tomlkit all 0.13.3-2 [39.1 kB] 130s Get:470 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pytest-mypy all 3.2.0-2 [21.6 kB] 130s Get:471 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-pytest-xdist all 3.8.0-2 [34.6 kB] 130s Get:472 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-seaborn all 0.13.2-5 [225 kB] 130s Get:473 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-setuptools-scm all 8.2.1-3 [32.7 kB] 130s Get:474 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinx-book-theme all 1.1.4-2 [83.3 kB] 130s Get:475 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinx-copybutton all 0.5.2-3 [16.7 kB] 130s Get:476 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinx-design all 0.6.1-2 [894 kB] 130s Get:477 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinx-gallery all 0.17.1-1 [334 kB] 130s Get:478 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinx-inline-tabs all 2023.4.21-3 [39.2 kB] 130s Get:479 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinx-remove-toctrees all 1.0.0-1 [6198 B] 130s Get:480 http://ftpmaster.internal/ubuntu resolute/main arm64 sphinx-rtd-theme-common all 3.0.2+dfsg-3 [1013 kB] 130s Get:481 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinxcontrib.jquery all 4.1-6 [6856 B] 130s Get:482 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinx-rtd-theme all 3.0.2+dfsg-3 [23.5 kB] 130s Get:483 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinxcontrib-mermaid all 1.0.0-1 [4844 kB] 130s Get:484 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinxext-opengraph all 0.12.0-1 [873 kB] 131s Get:485 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-sphinxext-rediraffe all 0.3.0-1 [8414 B] 131s Get:486 http://ftpmaster.internal/ubuntu resolute/universe arm64 python3-zarr all 3.1.3-1 [2192 kB] 131s Get:487 http://ftpmaster.internal/ubuntu resolute/main arm64 tzdata-legacy all 2025b-5ubuntu1 [99.3 kB] 131s Get:488 http://ftpmaster.internal/ubuntu resolute/universe arm64 python-hypothesis-doc all 6.130.5-2 [563 kB] 131s Get:489 http://ftpmaster.internal/ubuntu resolute/universe arm64 python-scipy-doc all 1.15.3-1ubuntu1 [26.6 kB] 132s Preconfiguring packages ... 132s Fetched 578 MB in 29s (20.1 MB/s) 132s Selecting previously unselected package fonts-lato. 132s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 88137 files and directories currently installed.) 132s Preparing to unpack .../000-fonts-lato_2.015-1_all.deb ... 132s Unpacking fonts-lato (2.015-1) ... 132s Selecting previously unselected package poppler-data. 132s Preparing to unpack .../001-poppler-data_0.4.12-1_all.deb ... 132s Unpacking poppler-data (0.4.12-1) ... 132s Selecting previously unselected package python3-numpy-dev:arm64. 132s Preparing to unpack .../002-python3-numpy-dev_1%3a2.3.4+ds-3ubuntu1_arm64.deb ... 132s Unpacking python3-numpy-dev:arm64 (1:2.3.4+ds-3ubuntu1) ... 132s Selecting previously unselected package libblas3:arm64. 132s Preparing to unpack .../003-libblas3_3.12.1-7_arm64.deb ... 132s Unpacking libblas3:arm64 (3.12.1-7) ... 132s Selecting previously unselected package libgfortran5:arm64. 132s Preparing to unpack .../004-libgfortran5_15.2.0-7ubuntu1_arm64.deb ... 132s Unpacking libgfortran5:arm64 (15.2.0-7ubuntu1) ... 132s Selecting previously unselected package libopenblas0-pthread:arm64. 132s Preparing to unpack .../005-libopenblas0-pthread_0.3.30+ds-3_arm64.deb ... 132s Unpacking libopenblas0-pthread:arm64 (0.3.30+ds-3) ... 132s Selecting previously unselected package liblapack3:arm64. 133s Preparing to unpack .../006-liblapack3_3.12.1-7_arm64.deb ... 133s Unpacking liblapack3:arm64 (3.12.1-7) ... 133s Selecting previously unselected package python3-numpy. 133s Preparing to unpack .../007-python3-numpy_1%3a2.3.4+ds-3ubuntu1_arm64.deb ... 133s Unpacking python3-numpy (1:2.3.4+ds-3ubuntu1) ... 133s Selecting previously unselected package libpython3.14-minimal:arm64. 133s Preparing to unpack .../008-libpython3.14-minimal_3.14.0-4_arm64.deb ... 133s Unpacking libpython3.14-minimal:arm64 (3.14.0-4) ... 133s Selecting previously unselected package python3.14-minimal. 133s Preparing to unpack .../009-python3.14-minimal_3.14.0-4_arm64.deb ... 133s Unpacking python3.14-minimal (3.14.0-4) ... 133s Selecting previously unselected package m4. 133s Preparing to unpack .../010-m4_1.4.20-2_arm64.deb ... 133s Unpacking m4 (1.4.20-2) ... 133s Selecting previously unselected package autoconf. 133s Preparing to unpack .../011-autoconf_2.72-3.1ubuntu1_all.deb ... 133s Unpacking autoconf (2.72-3.1ubuntu1) ... 133s Selecting previously unselected package autotools-dev. 133s Preparing to unpack .../012-autotools-dev_20240727.1_all.deb ... 133s Unpacking autotools-dev (20240727.1) ... 133s Selecting previously unselected package automake. 133s Preparing to unpack .../013-automake_1%3a1.18.1-2_all.deb ... 133s Unpacking automake (1:1.18.1-2) ... 133s Selecting previously unselected package autopoint. 133s Preparing to unpack .../014-autopoint_0.23.2-1_all.deb ... 133s Unpacking autopoint (0.23.2-1) ... 133s Selecting previously unselected package libtcl8.6:arm64. 133s Preparing to unpack .../015-libtcl8.6_8.6.17+dfsg-1_arm64.deb ... 133s Unpacking libtcl8.6:arm64 (8.6.17+dfsg-1) ... 133s Selecting previously unselected package fonts-dejavu-mono. 133s Preparing to unpack .../016-fonts-dejavu-mono_2.37-8_all.deb ... 133s Unpacking fonts-dejavu-mono (2.37-8) ... 133s Selecting previously unselected package fonts-dejavu-core. 134s Preparing to unpack .../017-fonts-dejavu-core_2.37-8_all.deb ... 134s Unpacking fonts-dejavu-core (2.37-8) ... 134s Selecting previously unselected package libfontenc1:arm64. 134s Preparing to unpack .../018-libfontenc1_1%3a1.1.8-1build1_arm64.deb ... 134s Unpacking libfontenc1:arm64 (1:1.1.8-1build1) ... 134s Selecting previously unselected package x11-common. 134s Preparing to unpack .../019-x11-common_1%3a7.7+24ubuntu1_all.deb ... 134s Unpacking x11-common (1:7.7+24ubuntu1) ... 134s Selecting previously unselected package xfonts-encodings. 134s Preparing to unpack .../020-xfonts-encodings_1%3a1.0.5-0ubuntu2_all.deb ... 134s Unpacking xfonts-encodings (1:1.0.5-0ubuntu2) ... 134s Selecting previously unselected package xfonts-utils. 134s Preparing to unpack .../021-xfonts-utils_1%3a7.7+7_arm64.deb ... 134s Unpacking xfonts-utils (1:7.7+7) ... 134s Selecting previously unselected package fonts-urw-base35. 134s Preparing to unpack .../022-fonts-urw-base35_20200910-8_all.deb ... 134s Unpacking fonts-urw-base35 (20200910-8) ... 134s Selecting previously unselected package fontconfig-config. 134s Preparing to unpack .../023-fontconfig-config_2.15.0-2.3ubuntu1_arm64.deb ... 134s Unpacking fontconfig-config (2.15.0-2.3ubuntu1) ... 134s Selecting previously unselected package libfontconfig1:arm64. 134s Preparing to unpack .../024-libfontconfig1_2.15.0-2.3ubuntu1_arm64.deb ... 134s Unpacking libfontconfig1:arm64 (2.15.0-2.3ubuntu1) ... 134s Selecting previously unselected package libxrender1:arm64. 134s Preparing to unpack .../025-libxrender1_1%3a0.9.12-1_arm64.deb ... 134s Unpacking libxrender1:arm64 (1:0.9.12-1) ... 135s Selecting previously unselected package libxft2:arm64. 135s Preparing to unpack .../026-libxft2_2.3.6-1build1_arm64.deb ... 135s Unpacking libxft2:arm64 (2.3.6-1build1) ... 135s Selecting previously unselected package libxss1:arm64. 135s Preparing to unpack .../027-libxss1_1%3a1.2.3-1build3_arm64.deb ... 135s Unpacking libxss1:arm64 (1:1.2.3-1build3) ... 135s Selecting previously unselected package libtk8.6:arm64. 135s Preparing to unpack .../028-libtk8.6_8.6.17-1_arm64.deb ... 135s Unpacking libtk8.6:arm64 (8.6.17-1) ... 135s Selecting previously unselected package tk8.6-blt2.5. 135s Preparing to unpack .../029-tk8.6-blt2.5_2.5.3+dfsg-8_arm64.deb ... 135s Unpacking tk8.6-blt2.5 (2.5.3+dfsg-8) ... 135s Selecting previously unselected package blt. 135s Preparing to unpack .../030-blt_2.5.3+dfsg-8_arm64.deb ... 135s Unpacking blt (2.5.3+dfsg-8) ... 135s Selecting previously unselected package libisl23:arm64. 135s Preparing to unpack .../031-libisl23_0.27-1_arm64.deb ... 135s Unpacking libisl23:arm64 (0.27-1) ... 135s Selecting previously unselected package libmpc3:arm64. 135s Preparing to unpack .../032-libmpc3_1.3.1-2_arm64.deb ... 135s Unpacking libmpc3:arm64 (1.3.1-2) ... 135s Selecting previously unselected package cpp-15-aarch64-linux-gnu. 135s Preparing to unpack .../033-cpp-15-aarch64-linux-gnu_15.2.0-7ubuntu1_arm64.deb ... 135s Unpacking cpp-15-aarch64-linux-gnu (15.2.0-7ubuntu1) ... 135s Selecting previously unselected package cpp-15. 135s Preparing to unpack .../034-cpp-15_15.2.0-7ubuntu1_arm64.deb ... 135s Unpacking cpp-15 (15.2.0-7ubuntu1) ... 135s Selecting previously unselected package cpp-aarch64-linux-gnu. 135s Preparing to unpack .../035-cpp-aarch64-linux-gnu_4%3a15.2.0-4ubuntu1_arm64.deb ... 135s Unpacking cpp-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 135s Selecting previously unselected package cpp. 135s Preparing to unpack .../036-cpp_4%3a15.2.0-4ubuntu1_arm64.deb ... 135s Unpacking cpp (4:15.2.0-4ubuntu1) ... 135s Selecting previously unselected package libcc1-0:arm64. 135s Preparing to unpack .../037-libcc1-0_15.2.0-7ubuntu1_arm64.deb ... 135s Unpacking libcc1-0:arm64 (15.2.0-7ubuntu1) ... 135s Selecting previously unselected package libgomp1:arm64. 135s Preparing to unpack .../038-libgomp1_15.2.0-7ubuntu1_arm64.deb ... 135s Unpacking libgomp1:arm64 (15.2.0-7ubuntu1) ... 135s Selecting previously unselected package libitm1:arm64. 135s Preparing to unpack .../039-libitm1_15.2.0-7ubuntu1_arm64.deb ... 135s Unpacking libitm1:arm64 (15.2.0-7ubuntu1) ... 135s Selecting previously unselected package libasan8:arm64. 136s Preparing to unpack .../040-libasan8_15.2.0-7ubuntu1_arm64.deb ... 136s Unpacking libasan8:arm64 (15.2.0-7ubuntu1) ... 136s Selecting previously unselected package liblsan0:arm64. 136s Preparing to unpack .../041-liblsan0_15.2.0-7ubuntu1_arm64.deb ... 136s Unpacking liblsan0:arm64 (15.2.0-7ubuntu1) ... 136s Selecting previously unselected package libtsan2:arm64. 136s Preparing to unpack .../042-libtsan2_15.2.0-7ubuntu1_arm64.deb ... 136s Unpacking libtsan2:arm64 (15.2.0-7ubuntu1) ... 136s Selecting previously unselected package libubsan1:arm64. 136s Preparing to unpack .../043-libubsan1_15.2.0-7ubuntu1_arm64.deb ... 136s Unpacking libubsan1:arm64 (15.2.0-7ubuntu1) ... 136s Selecting previously unselected package libhwasan0:arm64. 136s Preparing to unpack .../044-libhwasan0_15.2.0-7ubuntu1_arm64.deb ... 136s Unpacking libhwasan0:arm64 (15.2.0-7ubuntu1) ... 136s Selecting previously unselected package libgcc-15-dev:arm64. 136s Preparing to unpack .../045-libgcc-15-dev_15.2.0-7ubuntu1_arm64.deb ... 136s Unpacking libgcc-15-dev:arm64 (15.2.0-7ubuntu1) ... 136s Selecting previously unselected package gcc-15-aarch64-linux-gnu. 136s Preparing to unpack .../046-gcc-15-aarch64-linux-gnu_15.2.0-7ubuntu1_arm64.deb ... 136s Unpacking gcc-15-aarch64-linux-gnu (15.2.0-7ubuntu1) ... 137s Selecting previously unselected package gcc-15. 137s Preparing to unpack .../047-gcc-15_15.2.0-7ubuntu1_arm64.deb ... 137s Unpacking gcc-15 (15.2.0-7ubuntu1) ... 137s Selecting previously unselected package gcc-aarch64-linux-gnu. 137s Preparing to unpack .../048-gcc-aarch64-linux-gnu_4%3a15.2.0-4ubuntu1_arm64.deb ... 137s Unpacking gcc-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 137s Selecting previously unselected package gcc. 137s Preparing to unpack .../049-gcc_4%3a15.2.0-4ubuntu1_arm64.deb ... 137s Unpacking gcc (4:15.2.0-4ubuntu1) ... 137s Selecting previously unselected package libstdc++-15-dev:arm64. 137s Preparing to unpack .../050-libstdc++-15-dev_15.2.0-7ubuntu1_arm64.deb ... 137s Unpacking libstdc++-15-dev:arm64 (15.2.0-7ubuntu1) ... 137s Selecting previously unselected package g++-15-aarch64-linux-gnu. 137s Preparing to unpack .../051-g++-15-aarch64-linux-gnu_15.2.0-7ubuntu1_arm64.deb ... 137s Unpacking g++-15-aarch64-linux-gnu (15.2.0-7ubuntu1) ... 137s Selecting previously unselected package g++-15. 137s Preparing to unpack .../052-g++-15_15.2.0-7ubuntu1_arm64.deb ... 137s Unpacking g++-15 (15.2.0-7ubuntu1) ... 137s Selecting previously unselected package g++-aarch64-linux-gnu. 137s Preparing to unpack .../053-g++-aarch64-linux-gnu_4%3a15.2.0-4ubuntu1_arm64.deb ... 137s Unpacking g++-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 137s Selecting previously unselected package g++. 137s Preparing to unpack .../054-g++_4%3a15.2.0-4ubuntu1_arm64.deb ... 137s Unpacking g++ (4:15.2.0-4ubuntu1) ... 137s Selecting previously unselected package build-essential. 137s Preparing to unpack .../055-build-essential_12.12ubuntu1_arm64.deb ... 137s Unpacking build-essential (12.12ubuntu1) ... 137s Selecting previously unselected package gcc-14-base:arm64. 137s Preparing to unpack .../056-gcc-14-base_14.3.0-10ubuntu1_arm64.deb ... 137s Unpacking gcc-14-base:arm64 (14.3.0-10ubuntu1) ... 137s Selecting previously unselected package cpp-14-aarch64-linux-gnu. 137s Preparing to unpack .../057-cpp-14-aarch64-linux-gnu_14.3.0-10ubuntu1_arm64.deb ... 137s Unpacking cpp-14-aarch64-linux-gnu (14.3.0-10ubuntu1) ... 138s Selecting previously unselected package cpp-14. 138s Preparing to unpack .../058-cpp-14_14.3.0-10ubuntu1_arm64.deb ... 138s Unpacking cpp-14 (14.3.0-10ubuntu1) ... 138s Selecting previously unselected package libdebhelper-perl. 138s Preparing to unpack .../059-libdebhelper-perl_13.24.2ubuntu1_all.deb ... 138s Unpacking libdebhelper-perl (13.24.2ubuntu1) ... 138s Selecting previously unselected package libgcc-14-dev:arm64. 138s Preparing to unpack .../060-libgcc-14-dev_14.3.0-10ubuntu1_arm64.deb ... 138s Unpacking libgcc-14-dev:arm64 (14.3.0-10ubuntu1) ... 138s Selecting previously unselected package gcc-14-aarch64-linux-gnu. 138s Preparing to unpack .../061-gcc-14-aarch64-linux-gnu_14.3.0-10ubuntu1_arm64.deb ... 138s Unpacking gcc-14-aarch64-linux-gnu (14.3.0-10ubuntu1) ... 138s Selecting previously unselected package gcc-14. 138s Preparing to unpack .../062-gcc-14_14.3.0-10ubuntu1_arm64.deb ... 138s Unpacking gcc-14 (14.3.0-10ubuntu1) ... 138s Selecting previously unselected package libtool. 138s Preparing to unpack .../063-libtool_2.5.4-7_all.deb ... 138s Unpacking libtool (2.5.4-7) ... 138s Selecting previously unselected package dh-autoreconf. 138s Preparing to unpack .../064-dh-autoreconf_21_all.deb ... 138s Unpacking dh-autoreconf (21) ... 139s Selecting previously unselected package libarchive-zip-perl. 139s Preparing to unpack .../065-libarchive-zip-perl_1.68-1_all.deb ... 139s Unpacking libarchive-zip-perl (1.68-1) ... 139s Selecting previously unselected package libfile-stripnondeterminism-perl. 139s Preparing to unpack .../066-libfile-stripnondeterminism-perl_1.15.0-1_all.deb ... 139s Unpacking libfile-stripnondeterminism-perl (1.15.0-1) ... 139s Selecting previously unselected package dh-strip-nondeterminism. 139s Preparing to unpack .../067-dh-strip-nondeterminism_1.15.0-1_all.deb ... 139s Unpacking dh-strip-nondeterminism (1.15.0-1) ... 139s Selecting previously unselected package debugedit. 139s Preparing to unpack .../068-debugedit_1%3a5.2-3_arm64.deb ... 139s Unpacking debugedit (1:5.2-3) ... 139s Selecting previously unselected package dwz. 139s Preparing to unpack .../069-dwz_0.16-2_arm64.deb ... 139s Unpacking dwz (0.16-2) ... 139s Selecting previously unselected package gettext. 139s Preparing to unpack .../070-gettext_0.23.2-1_arm64.deb ... 139s Unpacking gettext (0.23.2-1) ... 139s Selecting previously unselected package intltool-debian. 139s Preparing to unpack .../071-intltool-debian_0.35.0+20060710.6_all.deb ... 139s Unpacking intltool-debian (0.35.0+20060710.6) ... 139s Selecting previously unselected package po-debconf. 139s Preparing to unpack .../072-po-debconf_1.0.21+nmu1_all.deb ... 139s Unpacking po-debconf (1.0.21+nmu1) ... 139s Selecting previously unselected package debhelper. 139s Preparing to unpack .../073-debhelper_13.24.2ubuntu1_all.deb ... 139s Unpacking debhelper (13.24.2ubuntu1) ... 139s Selecting previously unselected package dh-python. 139s Preparing to unpack .../074-dh-python_6.20250414_all.deb ... 139s Unpacking dh-python (6.20250414) ... 139s Selecting previously unselected package sgml-base. 139s Preparing to unpack .../075-sgml-base_1.31+nmu1_all.deb ... 139s Unpacking sgml-base (1.31+nmu1) ... 139s Selecting previously unselected package xml-core. 139s Preparing to unpack .../076-xml-core_0.19_all.deb ... 139s Unpacking xml-core (0.19) ... 139s Selecting previously unselected package docutils-common. 139s Preparing to unpack .../077-docutils-common_0.21.2+dfsg-2_all.deb ... 139s Unpacking docutils-common (0.21.2+dfsg-2) ... 139s Selecting previously unselected package fontconfig. 139s Preparing to unpack .../078-fontconfig_2.15.0-2.3ubuntu1_arm64.deb ... 139s Unpacking fontconfig (2.15.0-2.3ubuntu1) ... 139s Selecting previously unselected package fonts-dejavu-extra. 139s Preparing to unpack .../079-fonts-dejavu-extra_2.37-8_all.deb ... 139s Unpacking fonts-dejavu-extra (2.37-8) ... 139s Selecting previously unselected package fonts-font-awesome. 140s Preparing to unpack .../080-fonts-font-awesome_5.0.10+really4.7.0~dfsg-4.1_all.deb ... 140s Unpacking fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 140s Selecting previously unselected package fonts-lyx. 140s Preparing to unpack .../081-fonts-lyx_2.4.4-2_all.deb ... 140s Unpacking fonts-lyx (2.4.4-2) ... 140s Selecting previously unselected package fonts-mathjax. 140s Preparing to unpack .../082-fonts-mathjax_2.7.9+dfsg-1_all.deb ... 140s Unpacking fonts-mathjax (2.7.9+dfsg-1) ... 140s Selecting previously unselected package fonts-open-sans. 140s Preparing to unpack .../083-fonts-open-sans_1.11-2_all.deb ... 140s Unpacking fonts-open-sans (1.11-2) ... 140s Selecting previously unselected package libbabeltrace1:arm64. 140s Preparing to unpack .../084-libbabeltrace1_1.5.11-4build3_arm64.deb ... 140s Unpacking libbabeltrace1:arm64 (1.5.11-4build3) ... 140s Selecting previously unselected package libsource-highlight-common. 140s Preparing to unpack .../085-libsource-highlight-common_3.1.9-4.3build1_all.deb ... 140s Unpacking libsource-highlight-common (3.1.9-4.3build1) ... 140s Selecting previously unselected package libsource-highlight4t64:arm64. 140s Preparing to unpack .../086-libsource-highlight4t64_3.1.9-4.3build1_arm64.deb ... 140s Unpacking libsource-highlight4t64:arm64 (3.1.9-4.3build1) ... 140s Selecting previously unselected package gdb. 140s Preparing to unpack .../087-gdb_16.3-1ubuntu2_arm64.deb ... 140s Unpacking gdb (16.3-1ubuntu2) ... 140s Selecting previously unselected package libgfortran-14-dev:arm64. 140s Preparing to unpack .../088-libgfortran-14-dev_14.3.0-10ubuntu1_arm64.deb ... 140s Unpacking libgfortran-14-dev:arm64 (14.3.0-10ubuntu1) ... 140s Selecting previously unselected package gfortran-14-aarch64-linux-gnu. 140s Preparing to unpack .../089-gfortran-14-aarch64-linux-gnu_14.3.0-10ubuntu1_arm64.deb ... 140s Unpacking gfortran-14-aarch64-linux-gnu (14.3.0-10ubuntu1) ... 141s Selecting previously unselected package gfortran-14. 141s Preparing to unpack .../090-gfortran-14_14.3.0-10ubuntu1_arm64.deb ... 141s Unpacking gfortran-14 (14.3.0-10ubuntu1) ... 141s Selecting previously unselected package libgfortran-15-dev:arm64. 141s Preparing to unpack .../091-libgfortran-15-dev_15.2.0-7ubuntu1_arm64.deb ... 141s Unpacking libgfortran-15-dev:arm64 (15.2.0-7ubuntu1) ... 141s Selecting previously unselected package gfortran-15-aarch64-linux-gnu. 141s Preparing to unpack .../092-gfortran-15-aarch64-linux-gnu_15.2.0-7ubuntu1_arm64.deb ... 141s Unpacking gfortran-15-aarch64-linux-gnu (15.2.0-7ubuntu1) ... 141s Selecting previously unselected package gfortran-15. 141s Preparing to unpack .../093-gfortran-15_15.2.0-7ubuntu1_arm64.deb ... 141s Unpacking gfortran-15 (15.2.0-7ubuntu1) ... 141s Selecting previously unselected package libgs-common. 141s Preparing to unpack .../094-libgs-common_10.05.0dfsg1-0ubuntu4_all.deb ... 141s Unpacking libgs-common (10.05.0dfsg1-0ubuntu4) ... 141s Selecting previously unselected package libgs10-common. 141s Preparing to unpack .../095-libgs10-common_10.05.0dfsg1-0ubuntu4_all.deb ... 141s Unpacking libgs10-common (10.05.0dfsg1-0ubuntu4) ... 141s Selecting previously unselected package libavahi-common-data:arm64. 141s Preparing to unpack .../096-libavahi-common-data_0.8-16ubuntu3_arm64.deb ... 141s Unpacking libavahi-common-data:arm64 (0.8-16ubuntu3) ... 141s Selecting previously unselected package libavahi-common3:arm64. 141s Preparing to unpack .../097-libavahi-common3_0.8-16ubuntu3_arm64.deb ... 141s Unpacking libavahi-common3:arm64 (0.8-16ubuntu3) ... 141s Selecting previously unselected package libavahi-client3:arm64. 141s Preparing to unpack .../098-libavahi-client3_0.8-16ubuntu3_arm64.deb ... 141s Unpacking libavahi-client3:arm64 (0.8-16ubuntu3) ... 141s Selecting previously unselected package libcups2t64:arm64. 141s Preparing to unpack .../099-libcups2t64_2.4.12-0ubuntu3_arm64.deb ... 141s Unpacking libcups2t64:arm64 (2.4.12-0ubuntu3) ... 141s Selecting previously unselected package libidn12:arm64. 141s Preparing to unpack .../100-libidn12_1.43-2_arm64.deb ... 141s Unpacking libidn12:arm64 (1.43-2) ... 141s Selecting previously unselected package libijs-0.35:arm64. 141s Preparing to unpack .../101-libijs-0.35_0.35-16_arm64.deb ... 141s Unpacking libijs-0.35:arm64 (0.35-16) ... 141s Selecting previously unselected package libjbig2dec0:arm64. 141s Preparing to unpack .../102-libjbig2dec0_0.20-1build3_arm64.deb ... 141s Unpacking libjbig2dec0:arm64 (0.20-1build3) ... 142s Selecting previously unselected package libjpeg-turbo8:arm64. 142s Preparing to unpack .../103-libjpeg-turbo8_2.1.5-4ubuntu2_arm64.deb ... 142s Unpacking libjpeg-turbo8:arm64 (2.1.5-4ubuntu2) ... 142s Selecting previously unselected package libjpeg8:arm64. 142s Preparing to unpack .../104-libjpeg8_8c-2ubuntu11_arm64.deb ... 142s Unpacking libjpeg8:arm64 (8c-2ubuntu11) ... 142s Selecting previously unselected package libopenjp2-7:arm64. 142s Preparing to unpack .../105-libopenjp2-7_2.5.3-2.1_arm64.deb ... 142s Unpacking libopenjp2-7:arm64 (2.5.3-2.1) ... 142s Selecting previously unselected package libpaper2:arm64. 142s Preparing to unpack .../106-libpaper2_2.2.5-0.3_arm64.deb ... 142s Unpacking libpaper2:arm64 (2.2.5-0.3) ... 142s Selecting previously unselected package libdeflate0:arm64. 142s Preparing to unpack .../107-libdeflate0_1.23-2_arm64.deb ... 142s Unpacking libdeflate0:arm64 (1.23-2) ... 142s Selecting previously unselected package libjbig0:arm64. 142s Preparing to unpack .../108-libjbig0_2.1-6.1ubuntu2_arm64.deb ... 142s Unpacking libjbig0:arm64 (2.1-6.1ubuntu2) ... 142s Selecting previously unselected package liblerc4:arm64. 142s Preparing to unpack .../109-liblerc4_4.0.0+ds-5ubuntu1_arm64.deb ... 142s Unpacking liblerc4:arm64 (4.0.0+ds-5ubuntu1) ... 142s Selecting previously unselected package libsharpyuv0:arm64. 142s Preparing to unpack .../110-libsharpyuv0_1.5.0-0.1_arm64.deb ... 142s Unpacking libsharpyuv0:arm64 (1.5.0-0.1) ... 142s Selecting previously unselected package libwebp7:arm64. 142s Preparing to unpack .../111-libwebp7_1.5.0-0.1_arm64.deb ... 142s Unpacking libwebp7:arm64 (1.5.0-0.1) ... 142s Selecting previously unselected package libtiff6:arm64. 142s Preparing to unpack .../112-libtiff6_4.7.0-3ubuntu3_arm64.deb ... 142s Unpacking libtiff6:arm64 (4.7.0-3ubuntu3) ... 142s Selecting previously unselected package libice6:arm64. 142s Preparing to unpack .../113-libice6_2%3a1.1.1-1_arm64.deb ... 142s Unpacking libice6:arm64 (2:1.1.1-1) ... 142s Selecting previously unselected package libsm6:arm64. 142s Preparing to unpack .../114-libsm6_2%3a1.2.6-1_arm64.deb ... 142s Unpacking libsm6:arm64 (2:1.2.6-1) ... 142s Selecting previously unselected package libxt6t64:arm64. 142s Preparing to unpack .../115-libxt6t64_1%3a1.2.1-1.3_arm64.deb ... 142s Unpacking libxt6t64:arm64 (1:1.2.1-1.3) ... 142s Selecting previously unselected package libgs10:arm64. 142s Preparing to unpack .../116-libgs10_10.05.0dfsg1-0ubuntu4_arm64.deb ... 142s Unpacking libgs10:arm64 (10.05.0dfsg1-0ubuntu4) ... 142s Selecting previously unselected package ghostscript. 142s Preparing to unpack .../117-ghostscript_10.05.0dfsg1-0ubuntu4_arm64.deb ... 142s Unpacking ghostscript (10.05.0dfsg1-0ubuntu4) ... 142s Selecting previously unselected package python3-decorator. 142s Preparing to unpack .../118-python3-decorator_5.2.1-2_all.deb ... 142s Unpacking python3-decorator (5.2.1-2) ... 143s Selecting previously unselected package python3-parso. 143s Preparing to unpack .../119-python3-parso_0.8.5-1_all.deb ... 143s Unpacking python3-parso (0.8.5-1) ... 143s Selecting previously unselected package python3-typeshed. 143s Preparing to unpack .../120-python3-typeshed_0.0~git20241223.ea91db2-4_all.deb ... 143s Unpacking python3-typeshed (0.0~git20241223.ea91db2-4) ... 143s Selecting previously unselected package python3-jedi. 143s Preparing to unpack .../121-python3-jedi_0.19.1+ds1-1_all.deb ... 143s Unpacking python3-jedi (0.19.1+ds1-1) ... 143s Selecting previously unselected package python3-traitlets. 143s Preparing to unpack .../122-python3-traitlets_5.14.3+really5.14.3-1_all.deb ... 143s Unpacking python3-traitlets (5.14.3+really5.14.3-1) ... 143s Selecting previously unselected package python3-matplotlib-inline. 143s Preparing to unpack .../123-python3-matplotlib-inline_0.1.7-1_all.deb ... 143s Unpacking python3-matplotlib-inline (0.1.7-1) ... 143s Selecting previously unselected package python3-wcwidth. 143s Preparing to unpack .../124-python3-wcwidth_0.2.13+dfsg1-1_all.deb ... 143s Unpacking python3-wcwidth (0.2.13+dfsg1-1) ... 143s Selecting previously unselected package python3-prompt-toolkit. 143s Preparing to unpack .../125-python3-prompt-toolkit_3.0.52-1_all.deb ... 143s Unpacking python3-prompt-toolkit (3.0.52-1) ... 143s Selecting previously unselected package python3-asttokens. 143s Preparing to unpack .../126-python3-asttokens_3.0.0-2_all.deb ... 143s Unpacking python3-asttokens (3.0.0-2) ... 143s Selecting previously unselected package python3-executing. 143s Preparing to unpack .../127-python3-executing_2.2.0-0.2_all.deb ... 143s Unpacking python3-executing (2.2.0-0.2) ... 144s Selecting previously unselected package python3-pure-eval. 144s Preparing to unpack .../128-python3-pure-eval_0.2.3-1_all.deb ... 144s Unpacking python3-pure-eval (0.2.3-1) ... 144s Selecting previously unselected package python3-stack-data. 144s Preparing to unpack .../129-python3-stack-data_0.6.3-1_all.deb ... 144s Unpacking python3-stack-data (0.6.3-1) ... 144s Selecting previously unselected package python3-ipython. 144s Preparing to unpack .../130-python3-ipython_8.35.0-2_all.deb ... 144s Unpacking python3-ipython (8.35.0-2) ... 144s Selecting previously unselected package ipython3. 144s Preparing to unpack .../131-ipython3_8.35.0-2_all.deb ... 144s Unpacking ipython3 (8.35.0-2) ... 144s Selecting previously unselected package comerr-dev:arm64. 144s Preparing to unpack .../132-comerr-dev_2.1-1.47.2-3ubuntu2_arm64.deb ... 144s Unpacking comerr-dev:arm64 (2.1-1.47.2-3ubuntu2) ... 144s Selecting previously unselected package libgssrpc4t64:arm64. 144s Preparing to unpack .../133-libgssrpc4t64_1.21.3-5ubuntu2_arm64.deb ... 144s Unpacking libgssrpc4t64:arm64 (1.21.3-5ubuntu2) ... 144s Selecting previously unselected package libkadm5clnt-mit12:arm64. 144s Preparing to unpack .../134-libkadm5clnt-mit12_1.21.3-5ubuntu2_arm64.deb ... 144s Unpacking libkadm5clnt-mit12:arm64 (1.21.3-5ubuntu2) ... 144s Selecting previously unselected package libkdb5-10t64:arm64. 144s Preparing to unpack .../135-libkdb5-10t64_1.21.3-5ubuntu2_arm64.deb ... 144s Unpacking libkdb5-10t64:arm64 (1.21.3-5ubuntu2) ... 144s Selecting previously unselected package libkadm5srv-mit12:arm64. 144s Preparing to unpack .../136-libkadm5srv-mit12_1.21.3-5ubuntu2_arm64.deb ... 144s Unpacking libkadm5srv-mit12:arm64 (1.21.3-5ubuntu2) ... 144s Selecting previously unselected package krb5-multidev:arm64. 144s Preparing to unpack .../137-krb5-multidev_1.21.3-5ubuntu2_arm64.deb ... 144s Unpacking krb5-multidev:arm64 (1.21.3-5ubuntu2) ... 144s Selecting previously unselected package libaec0:arm64. 144s Preparing to unpack .../138-libaec0_1.1.4-2_arm64.deb ... 144s Unpacking libaec0:arm64 (1.1.4-2) ... 144s Selecting previously unselected package libllvm21:arm64. 144s Preparing to unpack .../139-libllvm21_1%3a21.1.2-2ubuntu6_arm64.deb ... 144s Unpacking libllvm21:arm64 (1:21.1.2-2ubuntu6) ... 145s Selecting previously unselected package libamd-comgr3:arm64. 145s Preparing to unpack .../140-libamd-comgr3_7.0.2+dfsg-1_arm64.deb ... 145s Unpacking libamd-comgr3:arm64 (7.0.2+dfsg-1) ... 145s Selecting previously unselected package libhsakmt1:arm64. 145s Preparing to unpack .../141-libhsakmt1_6.4.3+dfsg-3_arm64.deb ... 145s Unpacking libhsakmt1:arm64 (6.4.3+dfsg-3) ... 145s Selecting previously unselected package libhsa-runtime64-1:arm64. 145s Preparing to unpack .../142-libhsa-runtime64-1_6.4.3+dfsg-3_arm64.deb ... 145s Unpacking libhsa-runtime64-1:arm64 (6.4.3+dfsg-3) ... 145s Selecting previously unselected package libamdhip64-6:arm64. 145s Preparing to unpack .../143-libamdhip64-6_6.4.3-3_arm64.deb ... 145s Unpacking libamdhip64-6:arm64 (6.4.3-3) ... 146s Selecting previously unselected package libb2-1:arm64. 146s Preparing to unpack .../144-libb2-1_0.98.1-1.1build1_arm64.deb ... 146s Unpacking libb2-1:arm64 (0.98.1-1.1build1) ... 146s Selecting previously unselected package libsnappy1v5:arm64. 146s Preparing to unpack .../145-libsnappy1v5_1.2.2-2_arm64.deb ... 146s Unpacking libsnappy1v5:arm64 (1.2.2-2) ... 146s Selecting previously unselected package libblosc1:arm64. 146s Preparing to unpack .../146-libblosc1_1.21.5+ds-2_arm64.deb ... 146s Unpacking libblosc1:arm64 (1.21.5+ds-2) ... 146s Selecting previously unselected package libboost-iostreams1.88.0:arm64. 146s Preparing to unpack .../147-libboost-iostreams1.88.0_1.88.0-1.4ubuntu2_arm64.deb ... 146s Unpacking libboost-iostreams1.88.0:arm64 (1.88.0-1.4ubuntu2) ... 146s Selecting previously unselected package libboost-thread1.88.0:arm64. 146s Preparing to unpack .../148-libboost-thread1.88.0_1.88.0-1.4ubuntu2_arm64.deb ... 146s Unpacking libboost-thread1.88.0:arm64 (1.88.0-1.4ubuntu2) ... 146s Selecting previously unselected package libbrotli-dev:arm64. 146s Preparing to unpack .../149-libbrotli-dev_1.1.0-2build6_arm64.deb ... 146s Unpacking libbrotli-dev:arm64 (1.1.0-2build6) ... 146s Selecting previously unselected package libbz2-dev:arm64. 146s Preparing to unpack .../150-libbz2-dev_1.0.8-6build1_arm64.deb ... 146s Unpacking libbz2-dev:arm64 (1.0.8-6build1) ... 146s Selecting previously unselected package libpixman-1-0:arm64. 146s Preparing to unpack .../151-libpixman-1-0_0.46.4-1_arm64.deb ... 146s Unpacking libpixman-1-0:arm64 (0.46.4-1) ... 146s Selecting previously unselected package libxcb-render0:arm64. 146s Preparing to unpack .../152-libxcb-render0_1.17.0-2build1_arm64.deb ... 146s Unpacking libxcb-render0:arm64 (1.17.0-2build1) ... 146s Selecting previously unselected package libxcb-shm0:arm64. 146s Preparing to unpack .../153-libxcb-shm0_1.17.0-2build1_arm64.deb ... 146s Unpacking libxcb-shm0:arm64 (1.17.0-2build1) ... 146s Selecting previously unselected package libcairo2:arm64. 146s Preparing to unpack .../154-libcairo2_1.18.4-1build1_arm64.deb ... 146s Unpacking libcairo2:arm64 (1.18.4-1build1) ... 146s Selecting previously unselected package libcares2:arm64. 146s Preparing to unpack .../155-libcares2_1.34.5-1_arm64.deb ... 146s Unpacking libcares2:arm64 (1.34.5-1) ... 146s Selecting previously unselected package libevent-2.1-7t64:arm64. 146s Preparing to unpack .../156-libevent-2.1-7t64_2.1.12-stable-10build1_arm64.deb ... 146s Unpacking libevent-2.1-7t64:arm64 (2.1.12-stable-10build1) ... 146s Selecting previously unselected package libunbound8:arm64. 146s Preparing to unpack .../157-libunbound8_1.22.0-2ubuntu4_arm64.deb ... 146s Unpacking libunbound8:arm64 (1.22.0-2ubuntu4) ... 146s Selecting previously unselected package libgnutls-dane0t64:arm64. 146s Preparing to unpack .../158-libgnutls-dane0t64_3.8.9-3ubuntu2_arm64.deb ... 146s Unpacking libgnutls-dane0t64:arm64 (3.8.9-3ubuntu2) ... 146s Selecting previously unselected package libgnutls-openssl27t64:arm64. 147s Preparing to unpack .../159-libgnutls-openssl27t64_3.8.9-3ubuntu2_arm64.deb ... 147s Unpacking libgnutls-openssl27t64:arm64 (3.8.9-3ubuntu2) ... 147s Selecting previously unselected package libidn2-dev:arm64. 147s Preparing to unpack .../160-libidn2-dev_2.3.8-4_arm64.deb ... 147s Unpacking libidn2-dev:arm64 (2.3.8-4) ... 147s Selecting previously unselected package libp11-kit-dev:arm64. 147s Preparing to unpack .../161-libp11-kit-dev_0.25.9-2_arm64.deb ... 147s Unpacking libp11-kit-dev:arm64 (0.25.9-2) ... 147s Selecting previously unselected package libtasn1-6-dev:arm64. 147s Preparing to unpack .../162-libtasn1-6-dev_4.20.0-2build1_arm64.deb ... 147s Unpacking libtasn1-6-dev:arm64 (4.20.0-2build1) ... 147s Selecting previously unselected package libgmpxx4ldbl:arm64. 147s Preparing to unpack .../163-libgmpxx4ldbl_2%3a6.3.0+dfsg-5ubuntu1_arm64.deb ... 147s Unpacking libgmpxx4ldbl:arm64 (2:6.3.0+dfsg-5ubuntu1) ... 147s Selecting previously unselected package libgmp-dev:arm64. 147s Preparing to unpack .../164-libgmp-dev_2%3a6.3.0+dfsg-5ubuntu1_arm64.deb ... 147s Unpacking libgmp-dev:arm64 (2:6.3.0+dfsg-5ubuntu1) ... 147s Selecting previously unselected package nettle-dev:arm64. 147s Preparing to unpack .../165-nettle-dev_3.10.2-1_arm64.deb ... 147s Unpacking nettle-dev:arm64 (3.10.2-1) ... 147s Selecting previously unselected package libgnutls28-dev:arm64. 147s Preparing to unpack .../166-libgnutls28-dev_3.8.9-3ubuntu2_arm64.deb ... 147s Unpacking libgnutls28-dev:arm64 (3.8.9-3ubuntu2) ... 147s Selecting previously unselected package libkrb5-dev:arm64. 147s Preparing to unpack .../167-libkrb5-dev_1.21.3-5ubuntu2_arm64.deb ... 147s Unpacking libkrb5-dev:arm64 (1.21.3-5ubuntu2) ... 147s Selecting previously unselected package libldap-dev:arm64. 147s Preparing to unpack .../168-libldap-dev_2.6.10+dfsg-1ubuntu2_arm64.deb ... 147s Unpacking libldap-dev:arm64 (2.6.10+dfsg-1ubuntu2) ... 147s Selecting previously unselected package libpkgconf3:arm64. 147s Preparing to unpack .../169-libpkgconf3_1.8.1-4build1_arm64.deb ... 147s Unpacking libpkgconf3:arm64 (1.8.1-4build1) ... 147s Selecting previously unselected package pkgconf-bin. 147s Preparing to unpack .../170-pkgconf-bin_1.8.1-4build1_arm64.deb ... 147s Unpacking pkgconf-bin (1.8.1-4build1) ... 147s Selecting previously unselected package pkgconf:arm64. 147s Preparing to unpack .../171-pkgconf_1.8.1-4build1_arm64.deb ... 147s Unpacking pkgconf:arm64 (1.8.1-4build1) ... 147s Selecting previously unselected package libnghttp2-dev:arm64. 147s Preparing to unpack .../172-libnghttp2-dev_1.64.0-1.1ubuntu1_arm64.deb ... 147s Unpacking libnghttp2-dev:arm64 (1.64.0-1.1ubuntu1) ... 147s Selecting previously unselected package libpsl-dev:arm64. 147s Preparing to unpack .../173-libpsl-dev_0.21.2-1.1build1_arm64.deb ... 147s Unpacking libpsl-dev:arm64 (0.21.2-1.1build1) ... 147s Selecting previously unselected package zlib1g-dev:arm64. 147s Preparing to unpack .../174-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu2_arm64.deb ... 147s Unpacking zlib1g-dev:arm64 (1:1.3.dfsg+really1.3.1-1ubuntu2) ... 147s Selecting previously unselected package librtmp-dev:arm64. 147s Preparing to unpack .../175-librtmp-dev_2.4+20151223.gitfa8646d.1-3_arm64.deb ... 147s Unpacking librtmp-dev:arm64 (2.4+20151223.gitfa8646d.1-3) ... 148s Selecting previously unselected package libssl-dev:arm64. 148s Preparing to unpack .../176-libssl-dev_3.5.3-1ubuntu2_arm64.deb ... 148s Unpacking libssl-dev:arm64 (3.5.3-1ubuntu2) ... 148s Selecting previously unselected package libssh2-1-dev:arm64. 148s Preparing to unpack .../177-libssh2-1-dev_1.11.1-1build1_arm64.deb ... 148s Unpacking libssh2-1-dev:arm64 (1.11.1-1build1) ... 148s Selecting previously unselected package libzstd-dev:arm64. 148s Preparing to unpack .../178-libzstd-dev_1.5.7+dfsg-2_arm64.deb ... 148s Unpacking libzstd-dev:arm64 (1.5.7+dfsg-2) ... 148s Selecting previously unselected package libcurl4-gnutls-dev:arm64. 148s Preparing to unpack .../179-libcurl4-gnutls-dev_8.14.1-2ubuntu1_arm64.deb ... 148s Unpacking libcurl4-gnutls-dev:arm64 (8.14.1-2ubuntu1) ... 148s Selecting previously unselected package libdatrie1:arm64. 148s Preparing to unpack .../180-libdatrie1_0.2.13-4_arm64.deb ... 148s Unpacking libdatrie1:arm64 (0.2.13-4) ... 148s Selecting previously unselected package libdouble-conversion3:arm64. 148s Preparing to unpack .../181-libdouble-conversion3_3.3.1-2_arm64.deb ... 148s Unpacking libdouble-conversion3:arm64 (3.3.1-2) ... 148s Selecting previously unselected package libdxflib3:arm64. 148s Preparing to unpack .../182-libdxflib3_3.26.4-2_arm64.deb ... 148s Unpacking libdxflib3:arm64 (3.26.4-2) ... 148s Selecting previously unselected package libeccodes-data. 148s Preparing to unpack .../183-libeccodes-data_2.41.0-1_all.deb ... 148s Unpacking libeccodes-data (2.41.0-1) ... 150s Selecting previously unselected package libeccodes0:arm64. 150s Preparing to unpack .../184-libeccodes0_2.41.0-1_arm64.deb ... 150s Unpacking libeccodes0:arm64 (2.41.0-1) ... 150s Selecting previously unselected package libsz2:arm64. 150s Preparing to unpack .../185-libsz2_1.1.4-2_arm64.deb ... 150s Unpacking libsz2:arm64 (1.1.4-2) ... 150s Selecting previously unselected package libaec-dev:arm64. 150s Preparing to unpack .../186-libaec-dev_1.1.4-2_arm64.deb ... 150s Unpacking libaec-dev:arm64 (1.1.4-2) ... 150s Selecting previously unselected package libpng-dev:arm64. 150s Preparing to unpack .../187-libpng-dev_1.6.50-1_arm64.deb ... 150s Unpacking libpng-dev:arm64 (1.6.50-1) ... 150s Selecting previously unselected package libjpeg-turbo8-dev:arm64. 150s Preparing to unpack .../188-libjpeg-turbo8-dev_2.1.5-4ubuntu2_arm64.deb ... 150s Unpacking libjpeg-turbo8-dev:arm64 (2.1.5-4ubuntu2) ... 150s Selecting previously unselected package libjpeg8-dev:arm64. 150s Preparing to unpack .../189-libjpeg8-dev_8c-2ubuntu11_arm64.deb ... 150s Unpacking libjpeg8-dev:arm64 (8c-2ubuntu11) ... 150s Selecting previously unselected package libjpeg-dev:arm64. 150s Preparing to unpack .../190-libjpeg-dev_8c-2ubuntu11_arm64.deb ... 150s Unpacking libjpeg-dev:arm64 (8c-2ubuntu11) ... 150s Selecting previously unselected package libeccodes-dev:arm64. 150s Preparing to unpack .../191-libeccodes-dev_2.41.0-1_arm64.deb ... 150s Unpacking libeccodes-dev:arm64 (2.41.0-1) ... 150s Selecting previously unselected package libopenblas0:arm64. 150s Preparing to unpack .../192-libopenblas0_0.3.30+ds-3_arm64.deb ... 150s Unpacking libopenblas0:arm64 (0.3.30+ds-3) ... 150s Selecting previously unselected package libevent-pthreads-2.1-7t64:arm64. 150s Preparing to unpack .../193-libevent-pthreads-2.1-7t64_2.1.12-stable-10build1_arm64.deb ... 150s Unpacking libevent-pthreads-2.1-7t64:arm64 (2.1.12-stable-10build1) ... 150s Selecting previously unselected package librdmacm1t64:arm64. 150s Preparing to unpack .../194-librdmacm1t64_56.1-1ubuntu1_arm64.deb ... 150s Unpacking librdmacm1t64:arm64 (56.1-1ubuntu1) ... 150s Selecting previously unselected package libfabric1:arm64. 151s Preparing to unpack .../195-libfabric1_2.1.0-1.1_arm64.deb ... 151s Unpacking libfabric1:arm64 (2.1.0-1.1) ... 151s Selecting previously unselected package libhwloc15:arm64. 151s Preparing to unpack .../196-libhwloc15_2.12.2-1_arm64.deb ... 151s Unpacking libhwloc15:arm64 (2.12.2-1) ... 151s Selecting previously unselected package libibumad3:arm64. 151s Preparing to unpack .../197-libibumad3_56.1-1ubuntu1_arm64.deb ... 151s Unpacking libibumad3:arm64 (56.1-1ubuntu1) ... 151s Selecting previously unselected package libibmad5:arm64. 151s Preparing to unpack .../198-libibmad5_56.1-1ubuntu1_arm64.deb ... 151s Unpacking libibmad5:arm64 (56.1-1ubuntu1) ... 151s Selecting previously unselected package libucx0:arm64. 151s Preparing to unpack .../199-libucx0_1.19.0+ds-1build1_arm64.deb ... 151s Unpacking libucx0:arm64 (1.19.0+ds-1build1) ... 151s Selecting previously unselected package libpciaccess0:arm64. 151s Preparing to unpack .../200-libpciaccess0_0.18.1-1ubuntu2_arm64.deb ... 151s Unpacking libpciaccess0:arm64 (0.18.1-1ubuntu2) ... 151s Selecting previously unselected package libxnvctrl0:arm64. 151s Preparing to unpack .../201-libxnvctrl0_510.47.03-0ubuntu4_arm64.deb ... 151s Unpacking libxnvctrl0:arm64 (510.47.03-0ubuntu4) ... 151s Selecting previously unselected package ocl-icd-libopencl1:arm64. 151s Preparing to unpack .../202-ocl-icd-libopencl1_2.3.4-1_arm64.deb ... 151s Unpacking ocl-icd-libopencl1:arm64 (2.3.4-1) ... 151s Selecting previously unselected package libhwloc-plugins:arm64. 151s Preparing to unpack .../203-libhwloc-plugins_2.12.2-1_arm64.deb ... 151s Unpacking libhwloc-plugins:arm64 (2.12.2-1) ... 151s Selecting previously unselected package libopenmpi40:arm64. 151s Preparing to unpack .../204-libopenmpi40_5.0.8-8ubuntu1_arm64.deb ... 151s Unpacking libopenmpi40:arm64 (5.0.8-8ubuntu1) ... 151s Selecting previously unselected package proj-data. 151s Preparing to unpack .../205-proj-data_9.7.0-1_all.deb ... 151s Unpacking proj-data (9.7.0-1) ... 151s Selecting previously unselected package libproj25:arm64. 151s Preparing to unpack .../206-libproj25_9.7.0-1_arm64.deb ... 151s Unpacking libproj25:arm64 (9.7.0-1) ... 151s Selecting previously unselected package libqhull-r8.0:arm64. 151s Preparing to unpack .../207-libqhull-r8.0_2020.2-7_arm64.deb ... 151s Unpacking libqhull-r8.0:arm64 (2020.2-7) ... 151s Selecting previously unselected package libqhullcpp8.0:arm64. 152s Preparing to unpack .../208-libqhullcpp8.0_2020.2-7_arm64.deb ... 152s Unpacking libqhullcpp8.0:arm64 (2020.2-7) ... 152s Selecting previously unselected package librados2. 152s Preparing to unpack .../209-librados2_19.2.3-0ubuntu2_arm64.deb ... 152s Unpacking librados2 (19.2.3-0ubuntu2) ... 152s Selecting previously unselected package librsync2t64:arm64. 152s Preparing to unpack .../210-librsync2t64_2.3.4-1.1ubuntu2_arm64.deb ... 152s Unpacking librsync2t64:arm64 (2.3.4-1.1ubuntu2) ... 152s Selecting previously unselected package libeckit0d:arm64. 152s Preparing to unpack .../211-libeckit0d_1.32.3-1_arm64.deb ... 152s Unpacking libeckit0d:arm64 (1.32.3-1) ... 152s Selecting previously unselected package libeckit-utils. 152s Preparing to unpack .../212-libeckit-utils_1.32.3-1_arm64.deb ... 152s Unpacking libeckit-utils (1.32.3-1) ... 152s Selecting previously unselected package openmpi-common. 152s Preparing to unpack .../213-openmpi-common_5.0.8-8ubuntu1_all.deb ... 152s Unpacking openmpi-common (5.0.8-8ubuntu1) ... 152s Selecting previously unselected package libnl-3-dev:arm64. 152s Preparing to unpack .../214-libnl-3-dev_3.11.0-2_arm64.deb ... 152s Unpacking libnl-3-dev:arm64 (3.11.0-2) ... 152s Selecting previously unselected package libnl-route-3-dev:arm64. 152s Preparing to unpack .../215-libnl-route-3-dev_3.11.0-2_arm64.deb ... 152s Unpacking libnl-route-3-dev:arm64 (3.11.0-2) ... 152s Selecting previously unselected package libibverbs-dev:arm64. 152s Preparing to unpack .../216-libibverbs-dev_56.1-1ubuntu1_arm64.deb ... 152s Unpacking libibverbs-dev:arm64 (56.1-1ubuntu1) ... 152s Selecting previously unselected package libnuma-dev:arm64. 152s Preparing to unpack .../217-libnuma-dev_2.0.19-1_arm64.deb ... 152s Unpacking libnuma-dev:arm64 (2.0.19-1) ... 152s Selecting previously unselected package libltdl7:arm64. 152s Preparing to unpack .../218-libltdl7_2.5.4-7_arm64.deb ... 152s Unpacking libltdl7:arm64 (2.5.4-7) ... 152s Selecting previously unselected package libltdl-dev:arm64. 152s Preparing to unpack .../219-libltdl-dev_2.5.4-7_arm64.deb ... 152s Unpacking libltdl-dev:arm64 (2.5.4-7) ... 152s Selecting previously unselected package libhwloc-dev:arm64. 152s Preparing to unpack .../220-libhwloc-dev_2.12.2-1_arm64.deb ... 152s Unpacking libhwloc-dev:arm64 (2.12.2-1) ... 152s Selecting previously unselected package libevent-extra-2.1-7t64:arm64. 152s Preparing to unpack .../221-libevent-extra-2.1-7t64_2.1.12-stable-10build1_arm64.deb ... 152s Unpacking libevent-extra-2.1-7t64:arm64 (2.1.12-stable-10build1) ... 153s Selecting previously unselected package libevent-openssl-2.1-7t64:arm64. 153s Preparing to unpack .../222-libevent-openssl-2.1-7t64_2.1.12-stable-10build1_arm64.deb ... 153s Unpacking libevent-openssl-2.1-7t64:arm64 (2.1.12-stable-10build1) ... 153s Selecting previously unselected package libevent-dev. 153s Preparing to unpack .../223-libevent-dev_2.1.12-stable-10build1_arm64.deb ... 153s Unpacking libevent-dev (2.1.12-stable-10build1) ... 153s Selecting previously unselected package libjs-jquery. 153s Preparing to unpack .../224-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 153s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 153s Selecting previously unselected package libjs-jquery-ui. 153s Preparing to unpack .../225-libjs-jquery-ui_1.13.2+dfsg-1_all.deb ... 153s Unpacking libjs-jquery-ui (1.13.2+dfsg-1) ... 153s Selecting previously unselected package openmpi-bin. 153s Preparing to unpack .../226-openmpi-bin_5.0.8-8ubuntu1_arm64.deb ... 153s Unpacking openmpi-bin (5.0.8-8ubuntu1) ... 153s Selecting previously unselected package libopenmpi-dev:arm64. 153s Preparing to unpack .../227-libopenmpi-dev_5.0.8-8ubuntu1_arm64.deb ... 153s Unpacking libopenmpi-dev:arm64 (5.0.8-8ubuntu1) ... 153s Selecting previously unselected package mpi-default-dev. 153s Preparing to unpack .../228-mpi-default-dev_1.19_arm64.deb ... 153s Unpacking mpi-default-dev (1.19) ... 153s Selecting previously unselected package libxxhash-dev:arm64. 153s Preparing to unpack .../229-libxxhash-dev_0.8.3-2_arm64.deb ... 153s Unpacking libxxhash-dev:arm64 (0.8.3-2) ... 153s Selecting previously unselected package libjemalloc-dev. 153s Preparing to unpack .../230-libjemalloc-dev_5.3.0-3build1_arm64.deb ... 153s Unpacking libjemalloc-dev (5.3.0-3build1) ... 153s Selecting previously unselected package libsnappy-dev:arm64. 153s Preparing to unpack .../231-libsnappy-dev_1.2.2-2_arm64.deb ... 153s Unpacking libsnappy-dev:arm64 (1.2.2-2) ... 153s Selecting previously unselected package liblz4-dev:arm64. 153s Preparing to unpack .../232-liblz4-dev_1.10.0-6_arm64.deb ... 153s Unpacking liblz4-dev:arm64 (1.10.0-6) ... 153s Selecting previously unselected package libeigen3-dev. 153s Preparing to unpack .../233-libeigen3-dev_3.4.0-5_all.deb ... 153s Unpacking libeigen3-dev (3.4.0-5) ... 153s Selecting previously unselected package libopenblas-pthread-dev:arm64. 153s Preparing to unpack .../234-libopenblas-pthread-dev_0.3.30+ds-3_arm64.deb ... 153s Unpacking libopenblas-pthread-dev:arm64 (0.3.30+ds-3) ... 154s Selecting previously unselected package libopenblas-dev:arm64. 154s Preparing to unpack .../235-libopenblas-dev_0.3.30+ds-3_arm64.deb ... 154s Unpacking libopenblas-dev:arm64 (0.3.30+ds-3) ... 154s Selecting previously unselected package libeckit-dev:arm64. 154s Preparing to unpack .../236-libeckit-dev_1.32.3-1_arm64.deb ... 154s Unpacking libeckit-dev:arm64 (1.32.3-1) ... 154s Selecting previously unselected package libx11-xcb1:arm64. 154s Preparing to unpack .../237-libx11-xcb1_2%3a1.8.12-1build1_arm64.deb ... 154s Unpacking libx11-xcb1:arm64 (2:1.8.12-1build1) ... 154s Selecting previously unselected package libxcb-dri3-0:arm64. 154s Preparing to unpack .../238-libxcb-dri3-0_1.17.0-2build1_arm64.deb ... 154s Unpacking libxcb-dri3-0:arm64 (1.17.0-2build1) ... 154s Selecting previously unselected package libxcb-present0:arm64. 154s Preparing to unpack .../239-libxcb-present0_1.17.0-2build1_arm64.deb ... 154s Unpacking libxcb-present0:arm64 (1.17.0-2build1) ... 154s Selecting previously unselected package libxcb-randr0:arm64. 154s Preparing to unpack .../240-libxcb-randr0_1.17.0-2build1_arm64.deb ... 154s Unpacking libxcb-randr0:arm64 (1.17.0-2build1) ... 154s Selecting previously unselected package libxcb-sync1:arm64. 154s Preparing to unpack .../241-libxcb-sync1_1.17.0-2build1_arm64.deb ... 154s Unpacking libxcb-sync1:arm64 (1.17.0-2build1) ... 154s Selecting previously unselected package libxcb-xfixes0:arm64. 154s Preparing to unpack .../242-libxcb-xfixes0_1.17.0-2build1_arm64.deb ... 154s Unpacking libxcb-xfixes0:arm64 (1.17.0-2build1) ... 154s Selecting previously unselected package libxshmfence1:arm64. 154s Preparing to unpack .../243-libxshmfence1_1.3.3-1_arm64.deb ... 154s Unpacking libxshmfence1:arm64 (1.3.3-1) ... 154s Selecting previously unselected package mesa-libgallium:arm64. 154s Preparing to unpack .../244-mesa-libgallium_25.2.6-1ubuntu1_arm64.deb ... 154s Unpacking mesa-libgallium:arm64 (25.2.6-1ubuntu1) ... 155s Selecting previously unselected package libgbm1:arm64. 155s Preparing to unpack .../245-libgbm1_25.2.6-1ubuntu1_arm64.deb ... 155s Unpacking libgbm1:arm64 (25.2.6-1ubuntu1) ... 155s Selecting previously unselected package libwayland-client0:arm64. 155s Preparing to unpack .../246-libwayland-client0_1.24.0-2_arm64.deb ... 155s Unpacking libwayland-client0:arm64 (1.24.0-2) ... 155s Selecting previously unselected package libegl-mesa0:arm64. 155s Preparing to unpack .../247-libegl-mesa0_25.2.6-1ubuntu1_arm64.deb ... 155s Unpacking libegl-mesa0:arm64 (25.2.6-1ubuntu1) ... 155s Selecting previously unselected package libgeos3.13.1:arm64. 155s Preparing to unpack .../248-libgeos3.13.1_3.13.1-1_arm64.deb ... 155s Unpacking libgeos3.13.1:arm64 (3.13.1-1) ... 155s Selecting previously unselected package libgeos-c1t64:arm64. 155s Preparing to unpack .../249-libgeos-c1t64_3.13.1-1_arm64.deb ... 155s Unpacking libgeos-c1t64:arm64 (3.13.1-1) ... 155s Selecting previously unselected package libgeotiff5:arm64. 155s Preparing to unpack .../250-libgeotiff5_1.7.4-1_arm64.deb ... 155s Unpacking libgeotiff5:arm64 (1.7.4-1) ... 155s Selecting previously unselected package libvulkan1:arm64. 155s Preparing to unpack .../251-libvulkan1_1.4.328.1-1_arm64.deb ... 155s Unpacking libvulkan1:arm64 (1.4.328.1-1) ... 155s Selecting previously unselected package libgl1-mesa-dri:arm64. 155s Preparing to unpack .../252-libgl1-mesa-dri_25.2.6-1ubuntu1_arm64.deb ... 155s Unpacking libgl1-mesa-dri:arm64 (25.2.6-1ubuntu1) ... 155s Selecting previously unselected package libxcb-glx0:arm64. 155s Preparing to unpack .../253-libxcb-glx0_1.17.0-2build1_arm64.deb ... 155s Unpacking libxcb-glx0:arm64 (1.17.0-2build1) ... 155s Selecting previously unselected package libxxf86vm1:arm64. 155s Preparing to unpack .../254-libxxf86vm1_1%3a1.1.4-2_arm64.deb ... 155s Unpacking libxxf86vm1:arm64 (1:1.1.4-2) ... 155s Selecting previously unselected package libglx-mesa0:arm64. 155s Preparing to unpack .../255-libglx-mesa0_25.2.6-1ubuntu1_arm64.deb ... 155s Unpacking libglx-mesa0:arm64 (25.2.6-1ubuntu1) ... 155s Selecting previously unselected package libgraphite2-3:arm64. 155s Preparing to unpack .../256-libgraphite2-3_1.3.14-2ubuntu1_arm64.deb ... 155s Unpacking libgraphite2-3:arm64 (1.3.14-2ubuntu1) ... 155s Selecting previously unselected package libharfbuzz0b:arm64. 155s Preparing to unpack .../257-libharfbuzz0b_12.1.0-1_arm64.deb ... 155s Unpacking libharfbuzz0b:arm64 (12.1.0-1) ... 155s Selecting previously unselected package libhdf5-310:arm64. 156s Preparing to unpack .../258-libhdf5-310_1.14.5+repack-4_arm64.deb ... 156s Unpacking libhdf5-310:arm64 (1.14.5+repack-4) ... 156s Selecting previously unselected package libhdf5-hl-310:arm64. 156s Preparing to unpack .../259-libhdf5-hl-310_1.14.5+repack-4_arm64.deb ... 156s Unpacking libhdf5-hl-310:arm64 (1.14.5+repack-4) ... 156s Selecting previously unselected package libimagequant0:arm64. 156s Preparing to unpack .../260-libimagequant0_2.18.0-1build1_arm64.deb ... 156s Unpacking libimagequant0:arm64 (2.18.0-1build1) ... 156s Selecting previously unselected package libwacom-common. 156s Preparing to unpack .../261-libwacom-common_2.16.1-1_all.deb ... 156s Unpacking libwacom-common (2.16.1-1) ... 156s Selecting previously unselected package libwacom9:arm64. 156s Preparing to unpack .../262-libwacom9_2.16.1-1_arm64.deb ... 156s Unpacking libwacom9:arm64 (2.16.1-1) ... 156s Selecting previously unselected package libinput-bin. 156s Preparing to unpack .../263-libinput-bin_1.28.1-1ubuntu2_arm64.deb ... 156s Unpacking libinput-bin (1.28.1-1ubuntu2) ... 156s Selecting previously unselected package libmtdev1t64:arm64. 156s Preparing to unpack .../264-libmtdev1t64_1.1.7-1_arm64.deb ... 156s Unpacking libmtdev1t64:arm64 (1.1.7-1) ... 156s Selecting previously unselected package libinput10:arm64. 156s Preparing to unpack .../265-libinput10_1.28.1-1ubuntu2_arm64.deb ... 156s Unpacking libinput10:arm64 (1.28.1-1ubuntu2) ... 156s Selecting previously unselected package libjs-underscore. 156s Preparing to unpack .../266-libjs-underscore_1.13.4~dfsg+~1.11.4-3_all.deb ... 156s Unpacking libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 156s Selecting previously unselected package libjs-sphinxdoc. 156s Preparing to unpack .../267-libjs-sphinxdoc_8.2.3-1ubuntu2_all.deb ... 156s Unpacking libjs-sphinxdoc (8.2.3-1ubuntu2) ... 156s Selecting previously unselected package libjs-sprintf-js. 156s Preparing to unpack .../268-libjs-sprintf-js_1.1.2+ds1+~1.1.2-1_all.deb ... 156s Unpacking libjs-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 156s Selecting previously unselected package libjson-perl. 156s Preparing to unpack .../269-libjson-perl_4.10000-1_all.deb ... 156s Unpacking libjson-perl (4.10000-1) ... 156s Selecting previously unselected package liblcms2-2:arm64. 156s Preparing to unpack .../270-liblcms2-2_2.17-1_arm64.deb ... 156s Unpacking liblcms2-2:arm64 (2.17-1) ... 156s Selecting previously unselected package liblua5.4-0:arm64. 156s Preparing to unpack .../271-liblua5.4-0_5.4.8-1_arm64.deb ... 156s Unpacking liblua5.4-0:arm64 (5.4.8-1) ... 156s Selecting previously unselected package liblzf1:arm64. 156s Preparing to unpack .../272-liblzf1_3.6-4_arm64.deb ... 156s Unpacking liblzf1:arm64 (3.6-4) ... 156s Selecting previously unselected package libmagics++-data. 156s Preparing to unpack .../273-libmagics++-data_4.16.0+really4.16.0-2_all.deb ... 156s Unpacking libmagics++-data (4.16.0+really4.16.0-2) ... 157s Selecting previously unselected package libnetcdf22:arm64. 157s Preparing to unpack .../274-libnetcdf22_1%3a4.9.3-1build1_arm64.deb ... 157s Unpacking libnetcdf22:arm64 (1:4.9.3-1build1) ... 157s Selecting previously unselected package libodc-0d:arm64. 157s Preparing to unpack .../275-libodc-0d_1.6.2-2_arm64.deb ... 157s Unpacking libodc-0d:arm64 (1.6.2-2) ... 157s Selecting previously unselected package libthai-data. 158s Preparing to unpack .../276-libthai-data_0.1.29-2build1_all.deb ... 158s Unpacking libthai-data (0.1.29-2build1) ... 158s Selecting previously unselected package libthai0:arm64. 158s Preparing to unpack .../277-libthai0_0.1.29-2build1_arm64.deb ... 158s Unpacking libthai0:arm64 (0.1.29-2build1) ... 158s Selecting previously unselected package libpango-1.0-0:arm64. 158s Preparing to unpack .../278-libpango-1.0-0_1.56.3-2_arm64.deb ... 158s Unpacking libpango-1.0-0:arm64 (1.56.3-2) ... 158s Selecting previously unselected package libpangoft2-1.0-0:arm64. 158s Preparing to unpack .../279-libpangoft2-1.0-0_1.56.3-2_arm64.deb ... 158s Unpacking libpangoft2-1.0-0:arm64 (1.56.3-2) ... 158s Selecting previously unselected package libpangocairo-1.0-0:arm64. 158s Preparing to unpack .../280-libpangocairo-1.0-0_1.56.3-2_arm64.deb ... 158s Unpacking libpangocairo-1.0-0:arm64 (1.56.3-2) ... 158s Selecting previously unselected package libpcre2-16-0:arm64. 158s Preparing to unpack .../281-libpcre2-16-0_10.46-1_arm64.deb ... 158s Unpacking libpcre2-16-0:arm64 (10.46-1) ... 158s Selecting previously unselected package libqt6core6t64:arm64. 158s Preparing to unpack .../282-libqt6core6t64_6.9.2+dfsg-3ubuntu1_arm64.deb ... 158s Unpacking libqt6core6t64:arm64 (6.9.2+dfsg-3ubuntu1) ... 158s Selecting previously unselected package libglvnd0:arm64. 158s Preparing to unpack .../283-libglvnd0_1.7.0-1build2_arm64.deb ... 158s Unpacking libglvnd0:arm64 (1.7.0-1build2) ... 158s Selecting previously unselected package libegl1:arm64. 158s Preparing to unpack .../284-libegl1_1.7.0-1build2_arm64.deb ... 158s Unpacking libegl1:arm64 (1.7.0-1build2) ... 158s Selecting previously unselected package libglx0:arm64. 158s Preparing to unpack .../285-libglx0_1.7.0-1build2_arm64.deb ... 158s Unpacking libglx0:arm64 (1.7.0-1build2) ... 158s Selecting previously unselected package libmd4c0:arm64. 158s Preparing to unpack .../286-libmd4c0_0.5.2-2_arm64.deb ... 158s Unpacking libmd4c0:arm64 (0.5.2-2) ... 158s Selecting previously unselected package libopengl0:arm64. 158s Preparing to unpack .../287-libopengl0_1.7.0-1build2_arm64.deb ... 158s Unpacking libopengl0:arm64 (1.7.0-1build2) ... 158s Selecting previously unselected package libqt6dbus6:arm64. 158s Preparing to unpack .../288-libqt6dbus6_6.9.2+dfsg-3ubuntu1_arm64.deb ... 158s Unpacking libqt6dbus6:arm64 (6.9.2+dfsg-3ubuntu1) ... 158s Selecting previously unselected package libts0t64:arm64. 158s Preparing to unpack .../289-libts0t64_1.22-1.1build1_arm64.deb ... 158s Unpacking libts0t64:arm64 (1.22-1.1build1) ... 158s Selecting previously unselected package libxcb-util1:arm64. 158s Preparing to unpack .../290-libxcb-util1_0.4.1-1_arm64.deb ... 158s Unpacking libxcb-util1:arm64 (0.4.1-1) ... 158s Selecting previously unselected package libxcb-image0:arm64. 159s Preparing to unpack .../291-libxcb-image0_0.4.0-2build1_arm64.deb ... 159s Unpacking libxcb-image0:arm64 (0.4.0-2build1) ... 159s Selecting previously unselected package libxcb-render-util0:arm64. 159s Preparing to unpack .../292-libxcb-render-util0_0.3.10-1_arm64.deb ... 159s Unpacking libxcb-render-util0:arm64 (0.3.10-1) ... 159s Selecting previously unselected package libxcb-cursor0:arm64. 159s Preparing to unpack .../293-libxcb-cursor0_0.1.5-1_arm64.deb ... 159s Unpacking libxcb-cursor0:arm64 (0.1.5-1) ... 159s Selecting previously unselected package libxcb-icccm4:arm64. 159s Preparing to unpack .../294-libxcb-icccm4_0.4.2-1_arm64.deb ... 159s Unpacking libxcb-icccm4:arm64 (0.4.2-1) ... 159s Selecting previously unselected package libxcb-keysyms1:arm64. 159s Preparing to unpack .../295-libxcb-keysyms1_0.4.1-1_arm64.deb ... 159s Unpacking libxcb-keysyms1:arm64 (0.4.1-1) ... 159s Selecting previously unselected package libxcb-shape0:arm64. 159s Preparing to unpack .../296-libxcb-shape0_1.17.0-2build1_arm64.deb ... 159s Unpacking libxcb-shape0:arm64 (1.17.0-2build1) ... 159s Selecting previously unselected package libxcb-xinput0:arm64. 159s Preparing to unpack .../297-libxcb-xinput0_1.17.0-2build1_arm64.deb ... 159s Unpacking libxcb-xinput0:arm64 (1.17.0-2build1) ... 159s Selecting previously unselected package libxcb-xkb1:arm64. 159s Preparing to unpack .../298-libxcb-xkb1_1.17.0-2build1_arm64.deb ... 159s Unpacking libxcb-xkb1:arm64 (1.17.0-2build1) ... 159s Selecting previously unselected package libxkbcommon-x11-0:arm64. 159s Preparing to unpack .../299-libxkbcommon-x11-0_1.12.3-1_arm64.deb ... 159s Unpacking libxkbcommon-x11-0:arm64 (1.12.3-1) ... 159s Selecting previously unselected package libqt6gui6:arm64. 159s Preparing to unpack .../300-libqt6gui6_6.9.2+dfsg-3ubuntu1_arm64.deb ... 159s Unpacking libqt6gui6:arm64 (6.9.2+dfsg-3ubuntu1) ... 159s Selecting previously unselected package libqt6widgets6:arm64. 159s Preparing to unpack .../301-libqt6widgets6_6.9.2+dfsg-3ubuntu1_arm64.deb ... 159s Unpacking libqt6widgets6:arm64 (6.9.2+dfsg-3ubuntu1) ... 159s Selecting previously unselected package mysql-common. 159s Preparing to unpack .../302-mysql-common_5.8+1.1.1ubuntu1_all.deb ... 159s Unpacking mysql-common (5.8+1.1.1ubuntu1) ... 159s Selecting previously unselected package libmysqlclient24:arm64. 159s Preparing to unpack .../303-libmysqlclient24_8.4.7-0ubuntu2_arm64.deb ... 159s Unpacking libmysqlclient24:arm64 (8.4.7-0ubuntu2) ... 159s Selecting previously unselected package libpq5:arm64. 159s Preparing to unpack .../304-libpq5_17.6-1build1_arm64.deb ... 159s Unpacking libpq5:arm64 (17.6-1build1) ... 160s Selecting previously unselected package libterralib3t64:arm64. 160s Preparing to unpack .../305-libterralib3t64_4.3.0+dfsg.2-12.2build2_arm64.deb ... 160s Unpacking libterralib3t64:arm64 (4.3.0+dfsg.2-12.2build2) ... 160s Selecting previously unselected package libmagplus3v5:arm64. 160s Preparing to unpack .../306-libmagplus3v5_4.16.0+really4.16.0-2_arm64.deb ... 160s Unpacking libmagplus3v5:arm64 (4.16.0+really4.16.0-2) ... 160s Selecting previously unselected package libmagics++-metview-dev:arm64. 160s Preparing to unpack .../307-libmagics++-metview-dev_4.16.0+really4.16.0-2_arm64.deb ... 160s Unpacking libmagics++-metview-dev:arm64 (4.16.0+really4.16.0-2) ... 160s Selecting previously unselected package libterralib-dev:arm64. 160s Preparing to unpack .../308-libterralib-dev_4.3.0+dfsg.2-12.2build2_arm64.deb ... 160s Unpacking libterralib-dev:arm64 (4.3.0+dfsg.2-12.2build2) ... 160s Selecting previously unselected package magics++. 160s Preparing to unpack .../309-magics++_4.16.0+really4.16.0-2_arm64.deb ... 160s Unpacking magics++ (4.16.0+really4.16.0-2) ... 160s Selecting previously unselected package odc. 160s Preparing to unpack .../310-odc_1.6.2-2_arm64.deb ... 160s Unpacking odc (1.6.2-2) ... 160s Selecting previously unselected package libodc-dev:arm64. 160s Preparing to unpack .../311-libodc-dev_1.6.2-2_arm64.deb ... 160s Unpacking libodc-dev:arm64 (1.6.2-2) ... 160s Selecting previously unselected package libmagics++-dev:arm64. 160s Preparing to unpack .../312-libmagics++-dev_4.16.0+really4.16.0-2_arm64.deb ... 160s Unpacking libmagics++-dev:arm64 (4.16.0+really4.16.0-2) ... 160s Selecting previously unselected package node-xtend. 160s Preparing to unpack .../313-node-xtend_4.0.2-3_all.deb ... 160s Unpacking node-xtend (4.0.2-3) ... 160s Selecting previously unselected package node-corepack. 160s Preparing to unpack .../314-node-corepack_0.24.0-5_all.deb ... 160s Unpacking node-corepack (0.24.0-5) ... 161s Selecting previously unselected package nodejs. 161s Preparing to unpack .../315-nodejs_20.19.4+dfsg-1_arm64.deb ... 161s Unpacking nodejs (20.19.4+dfsg-1) ... 161s Selecting previously unselected package node-acorn. 161s Preparing to unpack .../316-node-acorn_8.8.1+ds+~cs25.17.7-2_all.deb ... 161s Unpacking node-acorn (8.8.1+ds+~cs25.17.7-2) ... 161s Selecting previously unselected package node-cjs-module-lexer. 161s Preparing to unpack .../317-node-cjs-module-lexer_1.2.3+dfsg-1_all.deb ... 161s Unpacking node-cjs-module-lexer (1.2.3+dfsg-1) ... 161s Selecting previously unselected package node-balanced-match. 161s Preparing to unpack .../318-node-balanced-match_2.0.0-1_all.deb ... 161s Unpacking node-balanced-match (2.0.0-1) ... 161s Selecting previously unselected package node-brace-expansion. 161s Preparing to unpack .../319-node-brace-expansion_2.0.1+~1.1.0-2_all.deb ... 161s Unpacking node-brace-expansion (2.0.1+~1.1.0-2) ... 161s Selecting previously unselected package node-minimatch. 161s Preparing to unpack .../320-node-minimatch_9.0.3-6_all.deb ... 161s Unpacking node-minimatch (9.0.3-6) ... 161s Selecting previously unselected package node-ms. 161s Preparing to unpack .../321-node-ms_2.1.3+~cs0.7.31-3_all.deb ... 161s Unpacking node-ms (2.1.3+~cs0.7.31-3) ... 161s Selecting previously unselected package node-debug. 161s Preparing to unpack .../322-node-debug_4.4.1+~4.1.12-1_all.deb ... 161s Unpacking node-debug (4.4.1+~4.1.12-1) ... 161s Selecting previously unselected package node-lru-cache. 161s Preparing to unpack .../323-node-lru-cache_10.0.1-3_all.deb ... 161s Unpacking node-lru-cache (10.0.1-3) ... 161s Selecting previously unselected package node-semver. 161s Preparing to unpack .../324-node-semver_7.6.1+~7.5.8-2_all.deb ... 161s Unpacking node-semver (7.6.1+~7.5.8-2) ... 161s Selecting previously unselected package node-llhttp. 161s Preparing to unpack .../325-node-llhttp_9.3.3~really9.3.0+~cs12.11.8-3_all.deb ... 161s Unpacking node-llhttp (9.3.3~really9.3.0+~cs12.11.8-3) ... 161s Selecting previously unselected package node-undici. 161s Preparing to unpack .../326-node-undici_7.16.0+dfsg+~cs3.2.0-2_all.deb ... 161s Unpacking node-undici (7.16.0+dfsg+~cs3.2.0-2) ... 161s Selecting previously unselected package libnode115:arm64. 161s Preparing to unpack .../327-libnode115_20.19.4+dfsg-1_arm64.deb ... 161s Unpacking libnode115:arm64 (20.19.4+dfsg-1) ... 162s Selecting previously unselected package libnorm1t64:arm64. 162s Preparing to unpack .../328-libnorm1t64_1.5.9+dfsg-4_arm64.deb ... 162s Unpacking libnorm1t64:arm64 (1.5.9+dfsg-4) ... 162s Selecting previously unselected package libpgm-5.3-0t64:arm64. 162s Preparing to unpack .../329-libpgm-5.3-0t64_5.3.128~dfsg-2.1build1_arm64.deb ... 162s Unpacking libpgm-5.3-0t64:arm64 (5.3.128~dfsg-2.1build1) ... 162s Selecting previously unselected package libpython3.14-stdlib:arm64. 162s Preparing to unpack .../330-libpython3.14-stdlib_3.14.0-4_arm64.deb ... 162s Unpacking libpython3.14-stdlib:arm64 (3.14.0-4) ... 162s Selecting previously unselected package libraqm0:arm64. 162s Preparing to unpack .../331-libraqm0_0.10.3-1_arm64.deb ... 162s Unpacking libraqm0:arm64 (0.10.3-1) ... 162s Selecting previously unselected package libsodium23:arm64. 162s Preparing to unpack .../332-libsodium23_1.0.18-1build3_arm64.deb ... 162s Unpacking libsodium23:arm64 (1.0.18-1build3) ... 162s Selecting previously unselected package libwebpdemux2:arm64. 162s Preparing to unpack .../333-libwebpdemux2_1.5.0-0.1_arm64.deb ... 162s Unpacking libwebpdemux2:arm64 (1.5.0-0.1) ... 162s Selecting previously unselected package libwebpmux3:arm64. 162s Preparing to unpack .../334-libwebpmux3_1.5.0-0.1_arm64.deb ... 162s Unpacking libwebpmux3:arm64 (1.5.0-0.1) ... 162s Selecting previously unselected package libxslt1.1:arm64. 162s Preparing to unpack .../335-libxslt1.1_1.1.43-0.3_arm64.deb ... 162s Unpacking libxslt1.1:arm64 (1.1.43-0.3) ... 162s Selecting previously unselected package libzmq5:arm64. 162s Preparing to unpack .../336-libzmq5_4.3.5-1build2_arm64.deb ... 162s Unpacking libzmq5:arm64 (4.3.5-1build2) ... 162s Selecting previously unselected package libzopfli1. 162s Preparing to unpack .../337-libzopfli1_1.0.3-3_arm64.deb ... 162s Unpacking libzopfli1 (1.0.3-3) ... 162s Selecting previously unselected package python3-mypy-extensions. 162s Preparing to unpack .../338-python3-mypy-extensions_1.1.0-1_all.deb ... 162s Unpacking python3-mypy-extensions (1.1.0-1) ... 163s Selecting previously unselected package python3-psutil. 163s Preparing to unpack .../339-python3-psutil_7.1.0-1ubuntu1_arm64.deb ... 163s Unpacking python3-psutil (7.1.0-1ubuntu1) ... 163s Selecting previously unselected package python3-mypy. 163s Preparing to unpack .../340-python3-mypy_1.15.0-5_arm64.deb ... 163s Unpacking python3-mypy (1.15.0-5) ... 163s Selecting previously unselected package mypy. 163s Preparing to unpack .../341-mypy_1.15.0-5_all.deb ... 163s Unpacking mypy (1.15.0-5) ... 163s Selecting previously unselected package node-esprima. 163s Preparing to unpack .../342-node-esprima_4.0.1+ds+~4.0.3-2_all.deb ... 163s Unpacking node-esprima (4.0.1+ds+~4.0.3-2) ... 163s Selecting previously unselected package node-fortawesome-fontawesome-free. 163s Preparing to unpack .../343-node-fortawesome-fontawesome-free_6.7.2+ds1-1_all.deb ... 163s Unpacking node-fortawesome-fontawesome-free (6.7.2+ds1-1) ... 163s Selecting previously unselected package node-sprintf-js. 163s Preparing to unpack .../344-node-sprintf-js_1.1.2+ds1+~1.1.2-1_all.deb ... 163s Unpacking node-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 163s Selecting previously unselected package node-argparse. 163s Preparing to unpack .../345-node-argparse_2.0.1-2_all.deb ... 163s Unpacking node-argparse (2.0.1-2) ... 164s Selecting previously unselected package node-js-yaml. 164s Preparing to unpack .../346-node-js-yaml_4.1.0+dfsg+~4.0.5-7_all.deb ... 164s Unpacking node-js-yaml (4.1.0+dfsg+~4.0.5-7) ... 164s Selecting previously unselected package pandoc-data. 164s Preparing to unpack .../347-pandoc-data_3.1.11.1-3build1_all.deb ... 164s Unpacking pandoc-data (3.1.11.1-3build1) ... 164s Selecting previously unselected package pandoc. 164s Preparing to unpack .../348-pandoc_3.1.11.1+ds-4_arm64.deb ... 164s Unpacking pandoc (3.1.11.1+ds-4) ... 165s Selecting previously unselected package pybuild-plugin-autopkgtest. 165s Preparing to unpack .../349-pybuild-plugin-autopkgtest_6.20250414_all.deb ... 165s Unpacking pybuild-plugin-autopkgtest (6.20250414) ... 165s Selecting previously unselected package python3-pyproject-hooks. 165s Preparing to unpack .../350-python3-pyproject-hooks_1.2.0-1_all.deb ... 165s Unpacking python3-pyproject-hooks (1.2.0-1) ... 165s Selecting previously unselected package python3-wheel. 165s Preparing to unpack .../351-python3-wheel_0.46.1-2_all.deb ... 165s Unpacking python3-wheel (0.46.1-2) ... 165s Selecting previously unselected package python3-build. 165s Preparing to unpack .../352-python3-build_1.2.2-4_all.deb ... 165s Unpacking python3-build (1.2.2-4) ... 165s Selecting previously unselected package python3-installer. 165s Preparing to unpack .../353-python3-installer_0.7.0+dfsg1-3_all.deb ... 165s Unpacking python3-installer (0.7.0+dfsg1-3) ... 165s Selecting previously unselected package pybuild-plugin-pyproject. 165s Preparing to unpack .../354-pybuild-plugin-pyproject_6.20250414_all.deb ... 165s Unpacking pybuild-plugin-pyproject (6.20250414) ... 165s Selecting previously unselected package python-cartopy-data. 165s Preparing to unpack .../355-python-cartopy-data_0.25.0+dfsg-1_all.deb ... 165s Unpacking python-cartopy-data (0.25.0+dfsg-1) ... 165s Selecting previously unselected package libjs-mathjax. 165s Preparing to unpack .../356-libjs-mathjax_2.7.9+dfsg-1_all.deb ... 165s Unpacking libjs-mathjax (2.7.9+dfsg-1) ... 166s Selecting previously unselected package python-dask-doc. 166s Preparing to unpack .../357-python-dask-doc_2024.12.1+dfsg-2_all.deb ... 166s Unpacking python-dask-doc (2024.12.1+dfsg-2) ... 166s Selecting previously unselected package python-matplotlib-data. 166s Preparing to unpack .../358-python-matplotlib-data_3.10.7+dfsg1-1_all.deb ... 166s Unpacking python-matplotlib-data (3.10.7+dfsg1-1) ... 166s Selecting previously unselected package python-pandas-doc. 166s Preparing to unpack .../359-python-pandas-doc_2.3.3+dfsg-1ubuntu1_all.deb ... 166s Unpacking python-pandas-doc (2.3.3+dfsg-1ubuntu1) ... 168s Selecting previously unselected package python-tinycss2-common. 168s Preparing to unpack .../360-python-tinycss2-common_1.4.0-2_all.deb ... 168s Unpacking python-tinycss2-common (1.4.0-2) ... 168s Selecting previously unselected package libjs-requirejs. 168s Preparing to unpack .../361-libjs-requirejs_2.3.7+ds+~2.1.37-1_all.deb ... 168s Unpacking libjs-requirejs (2.3.7+ds+~2.1.37-1) ... 168s Selecting previously unselected package python-xarray-doc. 168s Preparing to unpack .../362-python-xarray-doc_2025.03.1-8_all.deb ... 168s Unpacking python-xarray-doc (2025.03.1-8) ... 168s Selecting previously unselected package python3-accessible-pygments. 168s Preparing to unpack .../363-python3-accessible-pygments_0.0.5-2_all.deb ... 168s Unpacking python3-accessible-pygments (0.0.5-2) ... 168s Selecting previously unselected package python3.14. 168s Preparing to unpack .../364-python3.14_3.14.0-4_arm64.deb ... 168s Unpacking python3.14 (3.14.0-4) ... 168s Selecting previously unselected package python3-all. 168s Preparing to unpack .../365-python3-all_3.13.7-2_arm64.deb ... 168s Unpacking python3-all (3.13.7-2) ... 168s Selecting previously unselected package python3-defusedxml. 168s Preparing to unpack .../366-python3-defusedxml_0.7.1-3_all.deb ... 168s Unpacking python3-defusedxml (0.7.1-3) ... 168s Selecting previously unselected package sphinx-common. 168s Preparing to unpack .../367-sphinx-common_8.2.3-1ubuntu2_all.deb ... 168s Unpacking sphinx-common (8.2.3-1ubuntu2) ... 168s Selecting previously unselected package python3-alabaster. 168s Preparing to unpack .../368-python3-alabaster_0.7.16-0.1_all.deb ... 168s Unpacking python3-alabaster (0.7.16-0.1) ... 168s Selecting previously unselected package python3-roman. 168s Preparing to unpack .../369-python3-roman_5.1-1_all.deb ... 168s Unpacking python3-roman (5.1-1) ... 169s Selecting previously unselected package python3-docutils. 169s Preparing to unpack .../370-python3-docutils_0.21.2+dfsg-2_all.deb ... 169s Unpacking python3-docutils (0.21.2+dfsg-2) ... 169s Selecting previously unselected package python3-imagesize. 169s Preparing to unpack .../371-python3-imagesize_1.4.1-1_all.deb ... 169s Unpacking python3-imagesize (1.4.1-1) ... 169s Selecting previously unselected package python3-snowballstemmer. 169s Preparing to unpack .../372-python3-snowballstemmer_3.0.1-1_all.deb ... 169s Unpacking python3-snowballstemmer (3.0.1-1) ... 169s Selecting previously unselected package python3-sphinx. 169s Preparing to unpack .../373-python3-sphinx_8.2.3-1ubuntu2_all.deb ... 169s Unpacking python3-sphinx (8.2.3-1ubuntu2) ... 169s Selecting previously unselected package python3-autodocsumm. 169s Preparing to unpack .../374-python3-autodocsumm_0.2.14-2_all.deb ... 169s Unpacking python3-autodocsumm (0.2.14-2) ... 169s Selecting previously unselected package python3-webencodings. 169s Preparing to unpack .../375-python3-webencodings_0.5.1-5_all.deb ... 169s Unpacking python3-webencodings (0.5.1-5) ... 169s Selecting previously unselected package python3-html5lib. 169s Preparing to unpack .../376-python3-html5lib_1.2-2_all.deb ... 169s Unpacking python3-html5lib (1.2-2) ... 169s Selecting previously unselected package python3-bleach. 169s Preparing to unpack .../377-python3-bleach_6.2.0-1_all.deb ... 169s Unpacking python3-bleach (6.2.0-1) ... 169s Selecting previously unselected package python3-bottleneck. 169s Preparing to unpack .../378-python3-bottleneck_1.4.2+ds1-2build2_arm64.deb ... 169s Unpacking python3-bottleneck (1.4.2+ds1-2build2) ... 169s Selecting previously unselected package python3-brotli. 169s Preparing to unpack .../379-python3-brotli_1.1.0-2build6_arm64.deb ... 169s Unpacking python3-brotli (1.1.0-2build6) ... 169s Selecting previously unselected package python3-soupsieve. 169s Preparing to unpack .../380-python3-soupsieve_2.7-2_all.deb ... 169s Unpacking python3-soupsieve (2.7-2) ... 169s Selecting previously unselected package python3-bs4. 169s Preparing to unpack .../381-python3-bs4_4.13.4-3_all.deb ... 169s Unpacking python3-bs4 (4.13.4-3) ... 169s Selecting previously unselected package python3-pil:arm64. 169s Preparing to unpack .../382-python3-pil_11.3.0-1ubuntu2_arm64.deb ... 169s Unpacking python3-pil:arm64 (11.3.0-1ubuntu2) ... 169s Selecting previously unselected package python3.14-tk. 170s Preparing to unpack .../383-python3.14-tk_3.14.0-4_arm64.deb ... 170s Unpacking python3.14-tk (3.14.0-4) ... 170s Selecting previously unselected package python3.13-tk. 170s Preparing to unpack .../384-python3.13-tk_3.13.9-1_arm64.deb ... 170s Unpacking python3.13-tk (3.13.9-1) ... 170s Selecting previously unselected package python3-tk:arm64. 170s Preparing to unpack .../385-python3-tk_3.13.9-1_arm64.deb ... 170s Unpacking python3-tk:arm64 (3.13.9-1) ... 170s Selecting previously unselected package python3-pil.imagetk:arm64. 170s Preparing to unpack .../386-python3-pil.imagetk_11.3.0-1ubuntu2_arm64.deb ... 170s Unpacking python3-pil.imagetk:arm64 (11.3.0-1ubuntu2) ... 170s Selecting previously unselected package python3-contourpy. 170s Preparing to unpack .../387-python3-contourpy_1.3.1-2_arm64.deb ... 170s Unpacking python3-contourpy (1.3.1-2) ... 170s Selecting previously unselected package python3-cycler. 170s Preparing to unpack .../388-python3-cycler_0.12.1-2_all.deb ... 170s Unpacking python3-cycler (0.12.1-2) ... 170s Selecting previously unselected package python3-platformdirs. 170s Preparing to unpack .../389-python3-platformdirs_4.3.7-1_all.deb ... 170s Unpacking python3-platformdirs (4.3.7-1) ... 170s Selecting previously unselected package python3-fs. 170s Preparing to unpack .../390-python3-fs_2.4.16-9ubuntu1_all.deb ... 170s Unpacking python3-fs (2.4.16-9ubuntu1) ... 170s Selecting previously unselected package python3-lxml:arm64. 170s Preparing to unpack .../391-python3-lxml_6.0.2-1_arm64.deb ... 170s Unpacking python3-lxml:arm64 (6.0.2-1) ... 170s Selecting previously unselected package python3-lz4. 170s Preparing to unpack .../392-python3-lz4_4.4.4+dfsg-3_arm64.deb ... 170s Unpacking python3-lz4 (4.4.4+dfsg-3) ... 170s Selecting previously unselected package python3-scipy. 170s Preparing to unpack .../393-python3-scipy_1.15.3-1ubuntu1_arm64.deb ... 170s Unpacking python3-scipy (1.15.3-1ubuntu1) ... 171s Selecting previously unselected package python3-mpmath. 171s Preparing to unpack .../394-python3-mpmath_1.3.0-2_all.deb ... 171s Unpacking python3-mpmath (1.3.0-2) ... 171s Selecting previously unselected package python3-sympy. 171s Preparing to unpack .../395-python3-sympy_1.14.0-2_all.deb ... 171s Unpacking python3-sympy (1.14.0-2) ... 171s Selecting previously unselected package python3-ufolib2. 171s Preparing to unpack .../396-python3-ufolib2_0.17.1+dfsg1-1_all.deb ... 171s Unpacking python3-ufolib2 (0.17.1+dfsg1-1) ... 171s Selecting previously unselected package python3-zopfli. 171s Preparing to unpack .../397-python3-zopfli_0.4.0-1_arm64.deb ... 171s Unpacking python3-zopfli (0.4.0-1) ... 171s Selecting previously unselected package unicode-data. 171s Preparing to unpack .../398-unicode-data_16.0.0-1_all.deb ... 171s Unpacking unicode-data (16.0.0-1) ... 172s Selecting previously unselected package python3-fonttools. 172s Preparing to unpack .../399-python3-fonttools_4.57.0-2build1_arm64.deb ... 172s Unpacking python3-fonttools (4.57.0-2build1) ... 172s Selecting previously unselected package python3-kiwisolver. 172s Preparing to unpack .../400-python3-kiwisolver_1.4.10~rc0-1_arm64.deb ... 172s Unpacking python3-kiwisolver (1.4.10~rc0-1) ... 172s Selecting previously unselected package python3-matplotlib. 172s Preparing to unpack .../401-python3-matplotlib_3.10.7+dfsg1-1_arm64.deb ... 172s Unpacking python3-matplotlib (3.10.7+dfsg1-1) ... 172s Selecting previously unselected package python3-pyproj. 172s Preparing to unpack .../402-python3-pyproj_3.7.2-1_arm64.deb ... 172s Unpacking python3-pyproj (3.7.2-1) ... 172s Selecting previously unselected package python3-pyshp. 172s Preparing to unpack .../403-python3-pyshp_2.3.1-3_all.deb ... 172s Unpacking python3-pyshp (2.3.1-3) ... 172s Selecting previously unselected package python3-shapely. 172s Preparing to unpack .../404-python3-shapely_2.1.2-1_arm64.deb ... 172s Unpacking python3-shapely (2.1.2-1) ... 172s Selecting previously unselected package python3-cartopy. 172s Preparing to unpack .../405-python3-cartopy_0.25.0+dfsg-1_arm64.deb ... 172s Unpacking python3-cartopy (0.25.0+dfsg-1) ... 173s Selecting previously unselected package python3-ply. 173s Preparing to unpack .../406-python3-ply_3.11-9_all.deb ... 173s Unpacking python3-ply (3.11-9) ... 173s Selecting previously unselected package python3-pycparser. 173s Preparing to unpack .../407-python3-pycparser_2.23-1_all.deb ... 173s Unpacking python3-pycparser (2.23-1) ... 173s Selecting previously unselected package python3-cffi. 173s Preparing to unpack .../408-python3-cffi_2.0.0-2_all.deb ... 173s Unpacking python3-cffi (2.0.0-2) ... 173s Selecting previously unselected package python3-click. 173s Preparing to unpack .../409-python3-click_8.2.0+0.really.8.1.8-1_all.deb ... 173s Unpacking python3-click (8.2.0+0.really.8.1.8-1) ... 173s Selecting previously unselected package python3-findlibs. 173s Preparing to unpack .../410-python3-findlibs_0.0.5-1build1_arm64.deb ... 173s Unpacking python3-findlibs (0.0.5-1build1) ... 173s Selecting previously unselected package python3-ecmwflibs. 173s Preparing to unpack .../411-python3-ecmwflibs_2%3a0.6.3-2build2_arm64.deb ... 173s Unpacking python3-ecmwflibs (2:0.6.3-2build2) ... 173s Selecting previously unselected package python3-eccodes. 173s Preparing to unpack .../412-python3-eccodes_2%3a2.43.0-1_arm64.deb ... 173s Unpacking python3-eccodes (2:2.43.0-1) ... 173s Selecting previously unselected package python3-pytz. 173s Preparing to unpack .../413-python3-pytz_2025.2-4_all.deb ... 173s Unpacking python3-pytz (2025.2-4) ... 173s Selecting previously unselected package python3-pandas-lib:arm64. 173s Preparing to unpack .../414-python3-pandas-lib_2.3.3+dfsg-1ubuntu1_arm64.deb ... 173s Unpacking python3-pandas-lib:arm64 (2.3.3+dfsg-1ubuntu1) ... 173s Selecting previously unselected package python3-pandas. 173s Preparing to unpack .../415-python3-pandas_2.3.3+dfsg-1ubuntu1_all.deb ... 173s Unpacking python3-pandas (2.3.3+dfsg-1ubuntu1) ... 174s Selecting previously unselected package python3-xarray. 174s Preparing to unpack .../416-python3-xarray_2025.03.1-8_all.deb ... 174s Unpacking python3-xarray (2025.03.1-8) ... 174s Selecting previously unselected package python3-cfgrib. 174s Preparing to unpack .../417-python3-cfgrib_0.9.15.1-1_arm64.deb ... 174s Unpacking python3-cfgrib (0.9.15.1-1) ... 174s Selecting previously unselected package python3-cftime. 174s Preparing to unpack .../418-python3-cftime_1.6.5-1_arm64.deb ... 174s Unpacking python3-cftime (1.6.5-1) ... 174s Selecting previously unselected package python3-cloudpickle. 174s Preparing to unpack .../419-python3-cloudpickle_3.1.1-1_all.deb ... 174s Unpacking python3-cloudpickle (3.1.1-1) ... 174s Selecting previously unselected package python3-comm. 174s Preparing to unpack .../420-python3-comm_0.2.1-1_all.deb ... 174s Unpacking python3-comm (0.2.1-1) ... 174s Selecting previously unselected package python3-coverage. 174s Preparing to unpack .../421-python3-coverage_7.8.2+dfsg1-1_arm64.deb ... 174s Unpacking python3-coverage (7.8.2+dfsg1-1) ... 174s Selecting previously unselected package python3-crc32c. 174s Preparing to unpack .../422-python3-crc32c_2.7.1-1build1_arm64.deb ... 174s Unpacking python3-crc32c (2.7.1-1build1) ... 174s Selecting previously unselected package python3-fsspec. 174s Preparing to unpack .../423-python3-fsspec_2025.3.2-1ubuntu1_all.deb ... 174s Unpacking python3-fsspec (2025.3.2-1ubuntu1) ... 174s Selecting previously unselected package python3-toolz. 174s Preparing to unpack .../424-python3-toolz_1.0.0-2_all.deb ... 174s Unpacking python3-toolz (1.0.0-2) ... 174s Selecting previously unselected package python3-locket. 174s Preparing to unpack .../425-python3-locket_1.0.0-2_all.deb ... 174s Unpacking python3-locket (1.0.0-2) ... 174s Selecting previously unselected package python3-partd. 174s Preparing to unpack .../426-python3-partd_1.4.2-1_all.deb ... 174s Unpacking python3-partd (1.4.2-1) ... 174s Selecting previously unselected package python3-dask. 174s Preparing to unpack .../427-python3-dask_2024.12.1+dfsg-2_all.deb ... 174s Unpacking python3-dask (2024.12.1+dfsg-2) ... 174s Selecting previously unselected package python3-debugpy. 175s Preparing to unpack .../428-python3-debugpy_1.8.12+ds-1ubuntu1_arm64.deb ... 175s Unpacking python3-debugpy (1.8.12+ds-1ubuntu1) ... 175s Selecting previously unselected package python3.13-doc. 175s Preparing to unpack .../429-python3.13-doc_3.13.9-1_all.deb ... 175s Unpacking python3.13-doc (3.13.9-1) ... 175s Selecting previously unselected package python3-doc. 175s Preparing to unpack .../430-python3-doc_3.13.7-2_all.deb ... 175s Unpacking python3-doc (3.13.7-2) ... 175s Selecting previously unselected package python3-donfig. 175s Preparing to unpack .../431-python3-donfig_0.8.1+dfsg-3_all.deb ... 175s Unpacking python3-donfig (0.8.1+dfsg-3) ... 175s Selecting previously unselected package python3-execnet. 175s Preparing to unpack .../432-python3-execnet_2.1.1-1_all.deb ... 175s Unpacking python3-execnet (2.1.1-1) ... 175s Selecting previously unselected package python3-fastjsonschema. 175s Preparing to unpack .../433-python3-fastjsonschema_2.21.1-1_all.deb ... 175s Unpacking python3-fastjsonschema (2.21.1-1) ... 175s Selecting previously unselected package python3-flexcache. 175s Preparing to unpack .../434-python3-flexcache_0.3-2_all.deb ... 175s Unpacking python3-flexcache (0.3-2) ... 175s Selecting previously unselected package python3-flexparser. 175s Preparing to unpack .../435-python3-flexparser_0.4-1_all.deb ... 175s Unpacking python3-flexparser (0.4-1) ... 175s Selecting previously unselected package python3-h5py-serial. 175s Preparing to unpack .../436-python3-h5py-serial_3.13.0-1ubuntu1_arm64.deb ... 175s Unpacking python3-h5py-serial (3.13.0-1ubuntu1) ... 176s Selecting previously unselected package python3-h5py. 176s Preparing to unpack .../437-python3-h5py_3.13.0-1ubuntu1_all.deb ... 176s Unpacking python3-h5py (3.13.0-1ubuntu1) ... 176s Selecting previously unselected package python3-h5netcdf. 176s Preparing to unpack .../438-python3-h5netcdf_1.6.1-1_all.deb ... 176s Unpacking python3-h5netcdf (1.6.1-1) ... 176s Selecting previously unselected package python3-sortedcontainers. 176s Preparing to unpack .../439-python3-sortedcontainers_2.4.0-2_all.deb ... 176s Unpacking python3-sortedcontainers (2.4.0-2) ... 176s Selecting previously unselected package python3-hypothesis. 176s Preparing to unpack .../440-python3-hypothesis_6.130.5-2_all.deb ... 176s Unpacking python3-hypothesis (6.130.5-2) ... 176s Selecting previously unselected package python3-iniconfig. 176s Preparing to unpack .../441-python3-iniconfig_2.1.0-1_all.deb ... 176s Unpacking python3-iniconfig (2.1.0-1) ... 176s Selecting previously unselected package python3-jupyter-core. 176s Preparing to unpack .../442-python3-jupyter-core_5.7.2-5_all.deb ... 176s Unpacking python3-jupyter-core (5.7.2-5) ... 176s Selecting previously unselected package python3-tornado. 176s Preparing to unpack .../443-python3-tornado_6.5.2-3_arm64.deb ... 176s Unpacking python3-tornado (6.5.2-3) ... 176s Selecting previously unselected package python3-zmq. 176s Preparing to unpack .../444-python3-zmq_27.1.0-1_arm64.deb ... 176s Unpacking python3-zmq (27.1.0-1) ... 176s Selecting previously unselected package python3-jupyter-client. 176s Preparing to unpack .../445-python3-jupyter-client_8.6.3-3_all.deb ... 176s Unpacking python3-jupyter-client (8.6.3-3) ... 176s Selecting previously unselected package python3-nest-asyncio. 176s Preparing to unpack .../446-python3-nest-asyncio_1.5.4-1_all.deb ... 176s Unpacking python3-nest-asyncio (1.5.4-1) ... 176s Selecting previously unselected package python3-ipykernel. 176s Preparing to unpack .../447-python3-ipykernel_6.29.5-2_all.deb ... 176s Unpacking python3-ipykernel (6.29.5-2) ... 176s Selecting previously unselected package python3-jupyter-console. 176s Preparing to unpack .../448-python3-jupyter-console_6.6.3-2_all.deb ... 176s Unpacking python3-jupyter-console (6.6.3-2) ... 176s Selecting previously unselected package python3-jupyterlab-pygments. 176s Preparing to unpack .../449-python3-jupyterlab-pygments_0.2.2-3_all.deb ... 176s Unpacking python3-jupyterlab-pygments (0.2.2-3) ... 177s Selecting previously unselected package python3-mistune. 177s Preparing to unpack .../450-python3-mistune_3.1.4-1_all.deb ... 177s Unpacking python3-mistune (3.1.4-1) ... 177s Selecting previously unselected package python3-nbformat. 177s Preparing to unpack .../451-python3-nbformat_5.9.1-1_all.deb ... 177s Unpacking python3-nbformat (5.9.1-1) ... 177s Selecting previously unselected package python3-nbclient. 177s Preparing to unpack .../452-python3-nbclient_0.8.0-2_all.deb ... 177s Unpacking python3-nbclient (0.8.0-2) ... 177s Selecting previously unselected package python3-tinycss2. 177s Preparing to unpack .../453-python3-tinycss2_1.4.0-2_all.deb ... 177s Unpacking python3-tinycss2 (1.4.0-2) ... 177s Selecting previously unselected package python3-pandocfilters. 177s Preparing to unpack .../454-python3-pandocfilters_1.5.1-1_all.deb ... 177s Unpacking python3-pandocfilters (1.5.1-1) ... 177s Selecting previously unselected package python3-nbconvert. 177s Preparing to unpack .../455-python3-nbconvert_7.16.6-1_all.deb ... 177s Unpacking python3-nbconvert (7.16.6-1) ... 177s Selecting previously unselected package python3-nbsphinx. 177s Preparing to unpack .../456-python3-nbsphinx_0.9.5+ds-1_all.deb ... 177s Unpacking python3-nbsphinx (0.9.5+ds-1) ... 177s Selecting previously unselected package python3-netcdf4. 177s Preparing to unpack .../457-python3-netcdf4_1.7.2-1build4_arm64.deb ... 177s Unpacking python3-netcdf4 (1.7.2-1build4) ... 177s Selecting previously unselected package python3-pydata-sphinx-theme. 177s Preparing to unpack .../458-python3-pydata-sphinx-theme_0.16.1+dfsg-3_all.deb ... 177s Unpacking python3-pydata-sphinx-theme (0.16.1+dfsg-3) ... 177s Selecting previously unselected package python3-numcodecs. 177s Preparing to unpack .../459-python3-numcodecs_0.16.3+ds-1_arm64.deb ... 177s Unpacking python3-numcodecs (0.16.3+ds-1) ... 177s Selecting previously unselected package python3-numpydoc. 177s Preparing to unpack .../460-python3-numpydoc_1.9.0-1_all.deb ... 177s Unpacking python3-numpydoc (1.9.0-1) ... 177s Selecting previously unselected package python3-pickleshare. 177s Preparing to unpack .../461-python3-pickleshare_0.7.5-5_all.deb ... 177s Unpacking python3-pickleshare (0.7.5-5) ... 177s Selecting previously unselected package python3-pint. 177s Preparing to unpack .../462-python3-pint_0.24.4-2_all.deb ... 177s Unpacking python3-pint (0.24.4-2) ... 178s Selecting previously unselected package python3-pip. 178s Preparing to unpack .../463-python3-pip_25.1.1+dfsg-1ubuntu2_all.deb ... 178s Unpacking python3-pip (25.1.1+dfsg-1ubuntu2) ... 178s Selecting previously unselected package python3-pluggy. 178s Preparing to unpack .../464-python3-pluggy_1.6.0-1_all.deb ... 178s Unpacking python3-pluggy (1.6.0-1) ... 178s Selecting previously unselected package python3-pooch. 178s Preparing to unpack .../465-python3-pooch_1.8.2-1_all.deb ... 178s Unpacking python3-pooch (1.8.2-1) ... 178s Selecting previously unselected package python3-pytest. 178s Preparing to unpack .../466-python3-pytest_8.3.5-2_all.deb ... 178s Unpacking python3-pytest (8.3.5-2) ... 178s Selecting previously unselected package python3-regex. 178s Preparing to unpack .../467-python3-regex_0.1.20250918-1_arm64.deb ... 178s Unpacking python3-regex (0.1.20250918-1) ... 178s Selecting previously unselected package python3-tomlkit. 178s Preparing to unpack .../468-python3-tomlkit_0.13.3-2_all.deb ... 178s Unpacking python3-tomlkit (0.13.3-2) ... 178s Selecting previously unselected package python3-pytest-mypy. 178s Preparing to unpack .../469-python3-pytest-mypy_3.2.0-2_all.deb ... 178s Unpacking python3-pytest-mypy (3.2.0-2) ... 178s Selecting previously unselected package python3-pytest-xdist. 178s Preparing to unpack .../470-python3-pytest-xdist_3.8.0-2_all.deb ... 178s Unpacking python3-pytest-xdist (3.8.0-2) ... 178s Selecting previously unselected package python3-seaborn. 178s Preparing to unpack .../471-python3-seaborn_0.13.2-5_all.deb ... 178s Unpacking python3-seaborn (0.13.2-5) ... 178s Selecting previously unselected package python3-setuptools-scm. 178s Preparing to unpack .../472-python3-setuptools-scm_8.2.1-3_all.deb ... 178s Unpacking python3-setuptools-scm (8.2.1-3) ... 178s Selecting previously unselected package python3-sphinx-book-theme. 178s Preparing to unpack .../473-python3-sphinx-book-theme_1.1.4-2_all.deb ... 178s Unpacking python3-sphinx-book-theme (1.1.4-2) ... 178s Selecting previously unselected package python3-sphinx-copybutton. 178s Preparing to unpack .../474-python3-sphinx-copybutton_0.5.2-3_all.deb ... 178s Unpacking python3-sphinx-copybutton (0.5.2-3) ... 178s Selecting previously unselected package python3-sphinx-design. 179s Preparing to unpack .../475-python3-sphinx-design_0.6.1-2_all.deb ... 179s Unpacking python3-sphinx-design (0.6.1-2) ... 179s Selecting previously unselected package python3-sphinx-gallery. 179s Preparing to unpack .../476-python3-sphinx-gallery_0.17.1-1_all.deb ... 179s Unpacking python3-sphinx-gallery (0.17.1-1) ... 179s Selecting previously unselected package python3-sphinx-inline-tabs. 179s Preparing to unpack .../477-python3-sphinx-inline-tabs_2023.4.21-3_all.deb ... 179s Unpacking python3-sphinx-inline-tabs (2023.4.21-3) ... 179s Selecting previously unselected package python3-sphinx-remove-toctrees. 179s Preparing to unpack .../478-python3-sphinx-remove-toctrees_1.0.0-1_all.deb ... 179s Unpacking python3-sphinx-remove-toctrees (1.0.0-1) ... 179s Selecting previously unselected package sphinx-rtd-theme-common. 179s Preparing to unpack .../479-sphinx-rtd-theme-common_3.0.2+dfsg-3_all.deb ... 179s Unpacking sphinx-rtd-theme-common (3.0.2+dfsg-3) ... 179s Selecting previously unselected package python3-sphinxcontrib.jquery. 179s Preparing to unpack .../480-python3-sphinxcontrib.jquery_4.1-6_all.deb ... 179s Unpacking python3-sphinxcontrib.jquery (4.1-6) ... 179s Selecting previously unselected package python3-sphinx-rtd-theme. 179s Preparing to unpack .../481-python3-sphinx-rtd-theme_3.0.2+dfsg-3_all.deb ... 179s Unpacking python3-sphinx-rtd-theme (3.0.2+dfsg-3) ... 179s Selecting previously unselected package python3-sphinxcontrib-mermaid. 179s Preparing to unpack .../482-python3-sphinxcontrib-mermaid_1.0.0-1_all.deb ... 179s Unpacking python3-sphinxcontrib-mermaid (1.0.0-1) ... 179s Selecting previously unselected package python3-sphinxext-opengraph. 179s Preparing to unpack .../483-python3-sphinxext-opengraph_0.12.0-1_all.deb ... 179s Unpacking python3-sphinxext-opengraph (0.12.0-1) ... 179s Selecting previously unselected package python3-sphinxext-rediraffe. 179s Preparing to unpack .../484-python3-sphinxext-rediraffe_0.3.0-1_all.deb ... 179s Unpacking python3-sphinxext-rediraffe (0.3.0-1) ... 179s Selecting previously unselected package python3-zarr. 179s Preparing to unpack .../485-python3-zarr_3.1.3-1_all.deb ... 179s Unpacking python3-zarr (3.1.3-1) ... 179s Selecting previously unselected package tzdata-legacy. 179s Preparing to unpack .../486-tzdata-legacy_2025b-5ubuntu1_all.deb ... 179s Unpacking tzdata-legacy (2025b-5ubuntu1) ... 180s Selecting previously unselected package python-hypothesis-doc. 180s Preparing to unpack .../487-python-hypothesis-doc_6.130.5-2_all.deb ... 180s Unpacking python-hypothesis-doc (6.130.5-2) ... 180s Selecting previously unselected package python-scipy-doc. 180s Preparing to unpack .../488-python-scipy-doc_1.15.3-1ubuntu1_all.deb ... 180s Unpacking python-scipy-doc (1.15.3-1ubuntu1) ... 180s Setting up dh-python (6.20250414) ... 180s Setting up libgraphite2-3:arm64 (1.3.14-2ubuntu1) ... 180s Setting up libgnutls-openssl27t64:arm64 (3.8.9-3ubuntu2) ... 180s Setting up libxcb-dri3-0:arm64 (1.17.0-2build1) ... 180s Setting up liblcms2-2:arm64 (2.17-1) ... 180s Setting up python3-iniconfig (2.1.0-1) ... 180s Setting up libpixman-1-0:arm64 (0.46.4-1) ... 180s Setting up python3-tornado (6.5.2-3) ... 181s Setting up libnorm1t64:arm64 (1.5.9+dfsg-4) ... 181s Setting up libsharpyuv0:arm64 (1.5.0-0.1) ... 181s Setting up libx11-xcb1:arm64 (2:1.8.12-1build1) ... 181s Setting up libpciaccess0:arm64 (0.18.1-1ubuntu2) ... 181s Setting up mysql-common (5.8+1.1.1ubuntu1) ... 181s update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode 181s Setting up python3-pure-eval (0.2.3-1) ... 182s Setting up libdouble-conversion3:arm64 (3.3.1-2) ... 182s Setting up node-lru-cache (10.0.1-3) ... 182s Setting up fonts-lato (2.015-1) ... 182s Setting up libjs-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 182s Setting up fonts-mathjax (2.7.9+dfsg-1) ... 182s Setting up libsodium23:arm64 (1.0.18-1build3) ... 182s Setting up libxcb-xfixes0:arm64 (1.17.0-2build1) ... 182s Setting up libzstd-dev:arm64 (1.5.7+dfsg-2) ... 182s Setting up liblerc4:arm64 (4.0.0+ds-5ubuntu1) ... 182s Setting up proj-data (9.7.0-1) ... 182s Setting up libjs-mathjax (2.7.9+dfsg-1) ... 182s Setting up libxcb-xinput0:arm64 (1.17.0-2build1) ... 182s Setting up libxrender1:arm64 (1:0.9.12-1) ... 182s Setting up libdatrie1:arm64 (0.2.13-4) ... 182s Setting up python3-parso (0.8.5-1) ... 182s Setting up libgeos3.13.1:arm64 (3.13.1-1) ... 182s Setting up gcc-14-base:arm64 (14.3.0-10ubuntu1) ... 182s Setting up python3-lz4 (4.4.4+dfsg-3) ... 182s Setting up libxcb-render0:arm64 (1.17.0-2build1) ... 182s Setting up python3-defusedxml (0.7.1-3) ... 182s Setting up libarchive-zip-perl (1.68-1) ... 182s Setting up python3-asttokens (3.0.0-2) ... 183s Setting up libevent-pthreads-2.1-7t64:arm64 (2.1.12-stable-10build1) ... 183s Setting up libglvnd0:arm64 (1.7.0-1build2) ... 183s Setting up python3-alabaster (0.7.16-0.1) ... 183s Setting up libgeos-c1t64:arm64 (3.13.1-1) ... 183s Setting up fonts-lyx (2.4.4-2) ... 183s Setting up python3-mypy-extensions (1.1.0-1) ... 183s Setting up libts0t64:arm64 (1.22-1.1build1) ... 183s Setting up libijs-0.35:arm64 (0.35-16) ... 183s Setting up libxcb-glx0:arm64 (1.17.0-2build1) ... 183s Setting up libdebhelper-perl (13.24.2ubuntu1) ... 183s Setting up libgs-common (10.05.0dfsg1-0ubuntu4) ... 183s Setting up python3-fsspec (2025.3.2-1ubuntu1) ... 184s Setting up python3-ply (3.11-9) ... 184s Setting up libpython3.14-minimal:arm64 (3.14.0-4) ... 184s Setting up libevent-openssl-2.1-7t64:arm64 (2.1.12-stable-10build1) ... 184s Setting up libxcb-keysyms1:arm64 (0.4.1-1) ... 184s Setting up libxcb-shape0:arm64 (1.17.0-2build1) ... 184s Setting up x11-common (1:7.7+24ubuntu1) ... 185s Setting up libpq5:arm64 (17.6-1build1) ... 185s Setting up libibumad3:arm64 (56.1-1ubuntu1) ... 185s Setting up libdeflate0:arm64 (1.23-2) ... 185s Setting up libeccodes-data (2.41.0-1) ... 185s Setting up m4 (1.4.20-2) ... 185s Setting up libevent-2.1-7t64:arm64 (2.1.12-stable-10build1) ... 185s Setting up libqhull-r8.0:arm64 (2020.2-7) ... 185s Setting up libxcb-render-util0:arm64 (0.3.10-1) ... 185s Setting up python3-coverage (7.8.2+dfsg1-1) ... 185s Setting up python3-pyshp (2.3.1-3) ... 185s Setting up node-cjs-module-lexer (1.2.3+dfsg-1) ... 185s Setting up libdxflib3:arm64 (3.26.4-2) ... 185s Setting up python3-pytz (2025.2-4) ... 186s Setting up libxcb-shm0:arm64 (1.17.0-2build1) ... 186s Setting up libibmad5:arm64 (56.1-1ubuntu1) ... 186s Setting up libxcb-icccm4:arm64 (0.4.2-1) ... 186s Setting up python3-sortedcontainers (2.4.0-2) ... 186s Setting up node-fortawesome-fontawesome-free (6.7.2+ds1-1) ... 186s Setting up libboost-iostreams1.88.0:arm64 (1.88.0-1.4ubuntu2) ... 186s Setting up python3-pandocfilters (1.5.1-1) ... 186s Setting up libgomp1:arm64 (15.2.0-7ubuntu1) ... 186s Setting up python3-click (8.2.0+0.really.8.1.8-1) ... 186s Setting up libjs-requirejs (2.3.7+ds+~2.1.37-1) ... 186s Setting up fonts-open-sans (1.11-2) ... 186s Setting up libmysqlclient24:arm64 (8.4.7-0ubuntu2) ... 187s Setting up python3-wheel (0.46.1-2) ... 187s Setting up libjbig0:arm64 (2.1-6.1ubuntu2) ... 187s Setting up python3-webencodings (0.5.1-5) ... 187s Setting up libpcre2-16-0:arm64 (10.46-1) ... 187s Setting up python3-setuptools-scm (8.2.1-3) ... 187s Setting up libaec0:arm64 (1.1.4-2) ... 187s Setting up python3-platformdirs (4.3.7-1) ... 187s Setting up python3-psutil (7.1.0-1ubuntu1) ... 188s Setting up libsource-highlight-common (3.1.9-4.3build1) ... 188s Setting up tzdata-legacy (2025b-5ubuntu1) ... 188s Setting up libopengl0:arm64 (1.7.0-1build2) ... 188s Setting up libmagics++-data (4.16.0+really4.16.0-2) ... 188s Setting up python3-pycparser (2.23-1) ... 188s Setting up libxcb-util1:arm64 (0.4.1-1) ... 188s Setting up libpsl-dev:arm64 (0.21.2-1.1build1) ... 188s Setting up libxxf86vm1:arm64 (1:1.1.4-2) ... 188s Setting up python3-cloudpickle (3.1.1-1) ... 188s Setting up libsnappy1v5:arm64 (1.2.2-2) ... 188s Setting up poppler-data (0.4.12-1) ... 189s Setting up libxcb-xkb1:arm64 (1.17.0-2build1) ... 189s Setting up librsync2t64:arm64 (2.3.4-1.1ubuntu2) ... 189s Setting up libxcb-image0:arm64 (0.4.0-2build1) ... 189s Setting up libnuma-dev:arm64 (2.0.19-1) ... 189s Setting up python3-fs (2.4.16-9ubuntu1) ... 189s Setting up libxnvctrl0:arm64 (510.47.03-0ubuntu4) ... 189s Setting up libxcb-present0:arm64 (1.17.0-2build1) ... 189s Setting up unicode-data (16.0.0-1) ... 189s Setting up python3-jupyterlab-pygments (0.2.2-3) ... 189s Setting up libjemalloc-dev (5.3.0-3build1) ... 189s Setting up python3-roman (5.1-1) ... 189s Setting up libpgm-5.3-0t64:arm64 (5.3.128~dfsg-2.1build1) ... 189s Setting up python3-decorator (5.2.1-2) ... 190s Setting up libfontenc1:arm64 (1:1.1.8-1build1) ... 190s Setting up autotools-dev (20240727.1) ... 190s Setting up libblas3:arm64 (3.12.1-7) ... 190s update-alternatives: using /usr/lib/aarch64-linux-gnu/blas/libblas.so.3 to provide /usr/lib/aarch64-linux-gnu/libblas.so.3 (libblas.so.3-aarch64-linux-gnu) in auto mode 190s Setting up libboost-thread1.88.0:arm64 (1.88.0-1.4ubuntu2) ... 190s Setting up libunbound8:arm64 (1.22.0-2ubuntu4) ... 190s Setting up libpkgconf3:arm64 (1.8.1-4build1) ... 190s Setting up libgmpxx4ldbl:arm64 (2:6.3.0+dfsg-5ubuntu1) ... 190s Setting up python3-flexparser (0.4-1) ... 190s Setting up python3-wcwidth (0.2.13+dfsg1-1) ... 190s Setting up python3-pyproject-hooks (1.2.0-1) ... 190s Setting up node-sprintf-js (1.1.2+ds1+~1.1.2-1) ... 190s Setting up libzopfli1 (1.0.3-3) ... 190s Setting up libgnutls-dane0t64:arm64 (3.8.9-3ubuntu2) ... 190s Setting up python3-accessible-pygments (0.0.5-2) ... 191s Setting up python3-typeshed (0.0~git20241223.ea91db2-4) ... 191s Setting up libxcb-sync1:arm64 (1.17.0-2build1) ... 191s Setting up libjbig2dec0:arm64 (0.20-1build3) ... 191s Setting up python3-executing (2.2.0-0.2) ... 191s Setting up python3-snowballstemmer (3.0.1-1) ... 191s Setting up node-balanced-match (2.0.0-1) ... 191s Setting up python-cartopy-data (0.25.0+dfsg-1) ... 191s Setting up python3-pooch (1.8.2-1) ... 192s Setting up libgssrpc4t64:arm64 (1.21.3-5ubuntu2) ... 192s Setting up node-brace-expansion (2.0.1+~1.1.0-2) ... 192s Setting up libldap-dev:arm64 (2.6.10+dfsg-1ubuntu2) ... 192s Setting up libllvm21:arm64 (1:21.1.2-2ubuntu6) ... 192s Setting up python3-nest-asyncio (1.5.4-1) ... 192s Setting up libxcb-cursor0:arm64 (0.1.5-1) ... 192s Setting up python3-brotli (1.1.0-2build6) ... 192s Setting up libavahi-common-data:arm64 (0.8-16ubuntu3) ... 192s Setting up liblzf1:arm64 (3.6-4) ... 192s Setting up xfonts-encodings (1:1.0.5-0ubuntu2) ... 192s Setting up python3-cycler (0.12.1-2) ... 192s Setting up libimagequant0:arm64 (2.18.0-1build1) ... 192s Setting up comerr-dev:arm64 (2.1-1.47.2-3ubuntu2) ... 192s Setting up libxkbcommon-x11-0:arm64 (1.12.3-1) ... 192s Setting up fonts-dejavu-mono (2.37-8) ... 192s Setting up libssl-dev:arm64 (3.5.3-1ubuntu2) ... 192s Setting up python3-kiwisolver (1.4.10~rc0-1) ... 192s Setting up libhwloc15:arm64 (2.12.2-1) ... 192s Setting up libcares2:arm64 (1.34.5-1) ... 192s Setting up libmpc3:arm64 (1.3.1-2) ... 192s Setting up python3-numpy-dev:arm64 (1:2.3.4+ds-3ubuntu1) ... 192s Setting up libidn12:arm64 (1.43-2) ... 192s Setting up python3-mypy (1.15.0-5) ... 195s Setting up libtcl8.6:arm64 (8.6.17+dfsg-1) ... 195s Setting up autopoint (0.23.2-1) ... 195s Setting up fonts-dejavu-core (2.37-8) ... 195s Setting up libqhullcpp8.0:arm64 (2020.2-7) ... 195s Setting up pkgconf-bin (1.8.1-4build1) ... 195s Setting up python3-pip (25.1.1+dfsg-1ubuntu2) ... 197s Setting up libjpeg-turbo8:arm64 (2.1.5-4ubuntu2) ... 197s Setting up python3-regex (0.1.20250918-1) ... 197s Setting up python3-html5lib (1.2-2) ... 198s Setting up libltdl7:arm64 (2.5.4-7) ... 198s Setting up libidn2-dev:arm64 (2.3.8-4) ... 198s Setting up libbabeltrace1:arm64 (1.5.11-4build3) ... 198s Setting up python3-pickleshare (0.7.5-5) ... 198s Setting up python3-crc32c (2.7.1-1build1) ... 198s Setting up python3-installer (0.7.0+dfsg1-3) ... 198s Setting up libgfortran5:arm64 (15.2.0-7ubuntu1) ... 198s Setting up libvulkan1:arm64 (1.4.328.1-1) ... 198s Setting up autoconf (2.72-3.1ubuntu1) ... 198s Setting up libxxhash-dev:arm64 (0.8.3-2) ... 198s Setting up python3-pluggy (1.6.0-1) ... 198s Setting up libevent-extra-2.1-7t64:arm64 (2.1.12-stable-10build1) ... 198s Setting up libwebp7:arm64 (1.5.0-0.1) ... 198s Setting up libubsan1:arm64 (15.2.0-7ubuntu1) ... 198s Setting up python3-fastjsonschema (2.21.1-1) ... 199s Setting up zlib1g-dev:arm64 (1:1.3.dfsg+really1.3.1-1ubuntu2) ... 199s Setting up fonts-dejavu-extra (2.37-8) ... 199s Setting up dwz (0.16-2) ... 199s Setting up libnl-3-dev:arm64 (3.11.0-2) ... 199s Setting up libmtdev1t64:arm64 (1.1.7-1) ... 199s Setting up ocl-icd-libopencl1:arm64 (2.3.4-1) ... 199s Setting up libxshmfence1:arm64 (1.3.3-1) ... 199s Setting up libhwasan0:arm64 (15.2.0-7ubuntu1) ... 199s Setting up libxcb-randr0:arm64 (1.17.0-2build1) ... 199s Setting up libamd-comgr3:arm64 (7.0.2+dfsg-1) ... 199s Setting up python3-traitlets (5.14.3+really5.14.3-1) ... 199s Setting up libasan8:arm64 (15.2.0-7ubuntu1) ... 199s Setting up python-tinycss2-common (1.4.0-2) ... 199s Setting up libjson-perl (4.10000-1) ... 199s Setting up libxslt1.1:arm64 (1.1.43-0.3) ... 199s Setting up libblosc1:arm64 (1.21.5+ds-2) ... 199s Setting up openmpi-common (5.0.8-8ubuntu1) ... 199s Setting up debugedit (1:5.2-3) ... 199s Setting up libmd4c0:arm64 (0.5.2-2) ... 199s Setting up mypy (1.15.0-5) ... 199s Setting up librdmacm1t64:arm64 (56.1-1ubuntu1) ... 199s Setting up liblua5.4-0:arm64 (5.4.8-1) ... 199s Setting up libopenjp2-7:arm64 (2.5.3-2.1) ... 199s Setting up python3-toolz (1.0.0-2) ... 199s Setting up python3-findlibs (0.0.5-1build1) ... 199s Setting up libharfbuzz0b:arm64 (12.1.0-1) ... 199s Setting up libthai-data (0.1.29-2build1) ... 199s Setting up python3-flexcache (0.3-2) ... 200s Setting up sgml-base (1.31+nmu1) ... 200s Setting up python3-donfig (0.8.1+dfsg-3) ... 200s Setting up libxss1:arm64 (1:1.2.3-1build3) ... 200s Setting up node-minimatch (9.0.3-6) ... 200s Setting up libpaper2:arm64 (2.2.5-0.3) ... 200s Setting up pandoc-data (3.1.11.1-3build1) ... 200s Setting up libtsan2:arm64 (15.2.0-7ubuntu1) ... 200s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 200s Setting up python3-mpmath (1.3.0-2) ... 201s Setting up node-xtend (4.0.2-3) ... 201s Setting up libisl23:arm64 (0.27-1) ... 201s Setting up python3-build (1.2.2-4) ... 201s Setting up python3-execnet (2.1.1-1) ... 202s Setting up python-matplotlib-data (3.10.7+dfsg1-1) ... 202s Setting up libtasn1-6-dev:arm64 (4.20.0-2build1) ... 202s Setting up python3-tomlkit (0.13.3-2) ... 202s Setting up libwebpmux3:arm64 (1.5.0-0.1) ... 202s Setting up python3-locket (1.0.0-2) ... 202s Setting up python3-mistune (3.1.4-1) ... 202s Setting up python3-stack-data (0.6.3-1) ... 202s Setting up python3-soupsieve (2.7-2) ... 203s Setting up fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 203s Setting up sphinx-rtd-theme-common (3.0.2+dfsg-3) ... 203s Setting up python3.14-minimal (3.14.0-4) ... 204s Setting up libcc1-0:arm64 (15.2.0-7ubuntu1) ... 204s Setting up libbrotli-dev:arm64 (1.1.0-2build6) ... 204s Setting up python3-jupyter-core (5.7.2-5) ... 204s Setting up liblsan0:arm64 (15.2.0-7ubuntu1) ... 204s Setting up libhsakmt1:arm64 (6.4.3+dfsg-3) ... 204s Setting up libp11-kit-dev:arm64 (0.25.9-2) ... 204s Setting up libsz2:arm64 (1.1.4-2) ... 204s Setting up libitm1:arm64 (15.2.0-7ubuntu1) ... 204s Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 204s Setting up libkadm5clnt-mit12:arm64 (1.21.3-5ubuntu2) ... 204s Setting up python3-imagesize (1.4.1-1) ... 204s Setting up libwacom-common (2.16.1-1) ... 204s Setting up libbz2-dev:arm64 (1.0.8-6build1) ... 204s Setting up libwayland-client0:arm64 (1.24.0-2) ... 204s Setting up libjpeg8:arm64 (8c-2ubuntu11) ... 204s Setting up automake (1:1.18.1-2) ... 204s update-alternatives: using /usr/bin/automake-1.18 to provide /usr/bin/automake (automake) in auto mode 204s Setting up python3-prompt-toolkit (3.0.52-1) ... 205s Setting up libb2-1:arm64 (0.98.1-1.1build1) ... 205s Setting up libfile-stripnondeterminism-perl (1.15.0-1) ... 205s Setting up python3-partd (1.4.2-1) ... 205s Setting up libfabric1:arm64 (2.1.0-1.1) ... 205s Setting up python3-sympy (1.14.0-2) ... 218s /usr/lib/python3/dist-packages/sympy/testing/runtests.py:283: SyntaxWarning: 'return' in a 'finally' block 218s return p.returncode 218s Setting up cpp-15-aarch64-linux-gnu (15.2.0-7ubuntu1) ... 218s Setting up libice6:arm64 (2:1.1.1-1) ... 218s Setting up libqt6core6t64:arm64 (6.9.2+dfsg-3ubuntu1) ... 218s Setting up mesa-libgallium:arm64 (25.2.6-1ubuntu1) ... 218s Setting up libjpeg-turbo8-dev:arm64 (2.1.5-4ubuntu2) ... 218s Setting up librados2 (19.2.3-0ubuntu2) ... 218s Setting up liblapack3:arm64 (3.12.1-7) ... 218s update-alternatives: using /usr/lib/aarch64-linux-gnu/lapack/liblapack.so.3 to provide /usr/lib/aarch64-linux-gnu/liblapack.so.3 (liblapack.so.3-aarch64-linux-gnu) in auto mode 218s Setting up gettext (0.23.2-1) ... 218s Setting up python3-tinycss2 (1.4.0-2) ... 219s Setting up libopenblas0-pthread:arm64 (0.3.30+ds-3) ... 219s update-alternatives: using /usr/lib/aarch64-linux-gnu/openblas-pthread/libblas.so.3 to provide /usr/lib/aarch64-linux-gnu/libblas.so.3 (libblas.so.3-aarch64-linux-gnu) in auto mode 219s update-alternatives: using /usr/lib/aarch64-linux-gnu/openblas-pthread/liblapack.so.3 to provide /usr/lib/aarch64-linux-gnu/liblapack.so.3 (liblapack.so.3-aarch64-linux-gnu) in auto mode 219s update-alternatives: using /usr/lib/aarch64-linux-gnu/openblas-pthread/libopenblas.so.0 to provide /usr/lib/aarch64-linux-gnu/libopenblas.so.0 (libopenblas.so.0-aarch64-linux-gnu) in auto mode 219s Setting up libgcc-15-dev:arm64 (15.2.0-7ubuntu1) ... 219s Setting up libgmp-dev:arm64 (2:6.3.0+dfsg-5ubuntu1) ... 219s Setting up libzmq5:arm64 (4.3.5-1build2) ... 219s Setting up nettle-dev:arm64 (3.10.2-1) ... 219s Setting up python3-jedi (0.19.1+ds1-1) ... 219s Setting up libkdb5-10t64:arm64 (1.21.3-5ubuntu2) ... 219s Setting up libgbm1:arm64 (25.2.6-1ubuntu1) ... 219s Setting up libpython3.14-stdlib:arm64 (3.14.0-4) ... 219s Setting up libwacom9:arm64 (2.16.1-1) ... 219s Setting up pybuild-plugin-pyproject (6.20250414) ... 219s Setting up fontconfig-config (2.15.0-2.3ubuntu1) ... 219s Setting up python3-pytest (8.3.5-2) ... 220s Setting up libwebpdemux2:arm64 (1.5.0-0.1) ... 220s Setting up python3-hypothesis (6.130.5-2) ... 221s Setting up python3-cffi (2.0.0-2) ... 221s Setting up libsnappy-dev:arm64 (1.2.2-2) ... 221s Setting up libgl1-mesa-dri:arm64 (25.2.6-1ubuntu1) ... 221s Setting up libpng-dev:arm64 (1.6.50-1) ... 221s Setting up libaec-dev:arm64 (1.1.4-2) ... 221s Setting up libavahi-common3:arm64 (0.8-16ubuntu3) ... 221s Setting up python3-dask (2024.12.1+dfsg-2) ... 224s Setting up libsource-highlight4t64:arm64 (3.1.9-4.3build1) ... 224s Setting up python3-nbformat (5.9.1-1) ... 224s Setting up xfonts-utils (1:7.7+7) ... 224s Setting up libhwloc-plugins:arm64 (2.12.2-1) ... 224s Setting up libgfortran-15-dev:arm64 (15.2.0-7ubuntu1) ... 224s Setting up python3-bs4 (4.13.4-3) ... 225s Setting up python3-zopfli (0.4.0-1) ... 225s Setting up pkgconf:arm64 (1.8.1-4build1) ... 225s Setting up libinput-bin (1.28.1-1ubuntu2) ... 225s Setting up intltool-debian (0.35.0+20060710.6) ... 225s Setting up python3-bleach (6.2.0-1) ... 225s Setting up python3-matplotlib-inline (0.1.7-1) ... 225s Setting up python3-comm (0.2.1-1) ... 225s Setting up libnl-route-3-dev:arm64 (3.11.0-2) ... 225s Setting up python3-pint (0.24.4-2) ... 226s Setting up python3.13-doc (3.13.9-1) ... 226s Setting up libltdl-dev:arm64 (2.5.4-7) ... 226s Setting up libthai0:arm64 (0.1.29-2build1) ... 226s Setting up cpp-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 226s Setting up libegl-mesa0:arm64 (25.2.6-1ubuntu1) ... 226s Setting up gdb (16.3-1ubuntu2) ... 226s Setting up libstdc++-15-dev:arm64 (15.2.0-7ubuntu1) ... 226s Setting up libjs-jquery-ui (1.13.2+dfsg-1) ... 226s Setting up pandoc (3.1.11.1+ds-4) ... 226s Setting up python3-ipython (8.35.0-2) ... 227s /usr/lib/python3/dist-packages/IPython/core/interactiveshell.py:3141: SyntaxWarning: 'return' in a 'finally' block 227s return result 227s Setting up python3-zmq (27.1.0-1) ... 228s Setting up libraqm0:arm64 (0.10.3-1) ... 228s Setting up python-scipy-doc (1.15.3-1ubuntu1) ... 228s Setting up libevent-dev (2.1.12-stable-10build1) ... 228s Setting up libeigen3-dev (3.4.0-5) ... 228s Setting up liblz4-dev:arm64 (1.10.0-6) ... 228s Setting up libeccodes0:arm64 (2.41.0-1) ... 228s Setting up libssh2-1-dev:arm64 (1.11.1-1build1) ... 228s Setting up python3-numpy (1:2.3.4+ds-3ubuntu1) ... 231s Setting up libjs-sphinxdoc (8.2.3-1ubuntu2) ... 231s Setting up dh-strip-nondeterminism (1.15.0-1) ... 231s Setting up libhdf5-310:arm64 (1.14.5+repack-4) ... 231s Setting up libopenblas0:arm64 (0.3.30+ds-3) ... 231s Setting up cpp-14-aarch64-linux-gnu (14.3.0-10ubuntu1) ... 231s Setting up cpp-15 (15.2.0-7ubuntu1) ... 231s Setting up python3-lxml:arm64 (6.0.2-1) ... 232s Setting up libtiff6:arm64 (4.7.0-3ubuntu3) ... 232s Setting up libhsa-runtime64-1:arm64 (6.4.3+dfsg-3) ... 232s Setting up cpp (4:15.2.0-4ubuntu1) ... 232s Setting up xml-core (0.19) ... 232s Setting up libkadm5srv-mit12:arm64 (1.21.3-5ubuntu2) ... 232s Setting up libegl1:arm64 (1.7.0-1build2) ... 232s Setting up python3-pytest-mypy (3.2.0-2) ... 232s Setting up python3-jupyter-client (8.6.3-3) ... 232s Setting up python3-contourpy (1.3.1-2) ... 233s Setting up ipython3 (8.35.0-2) ... 233s Setting up libhwloc-dev:arm64 (2.12.2-1) ... 233s Setting up libfontconfig1:arm64 (2.15.0-2.3ubuntu1) ... 233s Setting up python3.14 (3.14.0-4) ... 234s Setting up libgcc-14-dev:arm64 (14.3.0-10ubuntu1) ... 234s Setting up libjpeg8-dev:arm64 (8c-2ubuntu11) ... 234s Setting up libsm6:arm64 (2:1.2.6-1) ... 234s Setting up libavahi-client3:arm64 (0.8-16ubuntu3) ... 234s Setting up python3-doc (3.13.7-2) ... 234s Setting up libqt6dbus6:arm64 (6.9.2+dfsg-3ubuntu1) ... 234s Setting up krb5-multidev:arm64 (1.21.3-5ubuntu2) ... 234s Setting up libopenblas-pthread-dev:arm64 (0.3.30+ds-3) ... 234s update-alternatives: using /usr/lib/aarch64-linux-gnu/openblas-pthread/libblas.so to provide /usr/lib/aarch64-linux-gnu/libblas.so (libblas.so-aarch64-linux-gnu) in auto mode 234s update-alternatives: using /usr/lib/aarch64-linux-gnu/openblas-pthread/liblapack.so to provide /usr/lib/aarch64-linux-gnu/liblapack.so (liblapack.so-aarch64-linux-gnu) in auto mode 234s update-alternatives: using /usr/lib/aarch64-linux-gnu/openblas-pthread/libopenblas.so to provide /usr/lib/aarch64-linux-gnu/libopenblas.so (libopenblas.so-aarch64-linux-gnu) in auto mode 234s Setting up libgfortran-14-dev:arm64 (14.3.0-10ubuntu1) ... 234s Setting up libgnutls28-dev:arm64 (3.8.9-3ubuntu2) ... 234s Setting up libinput10:arm64 (1.28.1-1ubuntu2) ... 234s Setting up libnghttp2-dev:arm64 (1.64.0-1.1ubuntu1) ... 234s Setting up libhdf5-hl-310:arm64 (1.14.5+repack-4) ... 234s Setting up fontconfig (2.15.0-2.3ubuntu1) ... 236s Regenerating fonts cache... done. 236s Setting up python3-shapely (2.1.2-1) ... 237s Setting up libxft2:arm64 (2.3.6-1build1) ... 237s Setting up libglx-mesa0:arm64 (25.2.6-1ubuntu1) ... 237s Setting up python-xarray-doc (2025.03.1-8) ... 237s Setting up gcc-15-aarch64-linux-gnu (15.2.0-7ubuntu1) ... 237s Setting up python3-scipy (1.15.3-1ubuntu1) ... 242s /usr/lib/python3/dist-packages/scipy/optimize/_optimize.py:921: SyntaxWarning: 'break' in a 'finally' block 242s break 244s Setting up python3-pytest-xdist (3.8.0-2) ... 244s Setting up libglx0:arm64 (1.7.0-1build2) ... 244s Setting up python-hypothesis-doc (6.130.5-2) ... 245s Setting up libproj25:arm64 (9.7.0-1) ... 245s Setting up python-pandas-doc (2.3.3+dfsg-1ubuntu1) ... 245s Setting up po-debconf (1.0.21+nmu1) ... 245s Setting up libtk8.6:arm64 (8.6.17-1) ... 245s Setting up python3-pandas-lib:arm64 (2.3.3+dfsg-1ubuntu1) ... 245s Setting up libpango-1.0-0:arm64 (1.56.3-2) ... 245s Setting up libnetcdf22:arm64 (1:4.9.3-1build1) ... 245s Setting up libjpeg-dev:arm64 (8c-2ubuntu11) ... 245s Setting up python3-h5py-serial (3.13.0-1ubuntu1) ... 245s Setting up python3-all (3.13.7-2) ... 245s Setting up fonts-urw-base35 (20200910-8) ... 245s Setting up python3-debugpy (1.8.12+ds-1ubuntu1) ... 246s Setting up libibverbs-dev:arm64 (56.1-1ubuntu1) ... 246s Setting up python3-pyproj (3.7.2-1) ... 247s Setting up libcairo2:arm64 (1.18.4-1build1) ... 247s Setting up python3.13-tk (3.13.9-1) ... 247s Setting up libgeotiff5:arm64 (1.7.4-1) ... 247s Setting up python3-nbclient (0.8.0-2) ... 247s Setting up libkrb5-dev:arm64 (1.21.3-5ubuntu2) ... 247s Setting up python3-pil:arm64 (11.3.0-1ubuntu2) ... 248s Setting up gcc-15 (15.2.0-7ubuntu1) ... 248s Setting up libopenblas-dev:arm64 (0.3.30+ds-3) ... 248s Setting up libqt6gui6:arm64 (6.9.2+dfsg-3ubuntu1) ... 248s Setting up python3-pandas (2.3.3+dfsg-1ubuntu1) ... 258s Setting up gfortran-15-aarch64-linux-gnu (15.2.0-7ubuntu1) ... 258s Setting up g++-15-aarch64-linux-gnu (15.2.0-7ubuntu1) ... 258s Setting up sphinx-common (8.2.3-1ubuntu2) ... 258s Setting up libamdhip64-6:arm64 (6.4.3-3) ... 258s Setting up libxt6t64:arm64 (1:1.2.1-1.3) ... 258s Setting up librtmp-dev:arm64 (2.4+20151223.gitfa8646d.1-3) ... 258s Setting up python3-ipykernel (6.29.5-2) ... 258s Setting up python3-h5py (3.13.0-1ubuntu1) ... 258s Setting up python3-bottleneck (1.4.2+ds1-2build2) ... 259s Setting up python3-cftime (1.6.5-1) ... 259s Setting up cpp-14 (14.3.0-10ubuntu1) ... 259s Setting up python3-nbconvert (7.16.6-1) ... 259s Setting up gcc-14-aarch64-linux-gnu (14.3.0-10ubuntu1) ... 259s Setting up libpangoft2-1.0-0:arm64 (1.56.3-2) ... 259s Setting up g++-15 (15.2.0-7ubuntu1) ... 259s Setting up libcups2t64:arm64 (2.4.12-0ubuntu3) ... 259s Setting up python3-netcdf4 (1.7.2-1build4) ... 259s Setting up gfortran-15 (15.2.0-7ubuntu1) ... 259s Setting up libpangocairo-1.0-0:arm64 (1.56.3-2) ... 259s Setting up libgs10-common (10.05.0dfsg1-0ubuntu4) ... 259s Setting up gcc-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 259s Setting up libterralib3t64:arm64 (4.3.0+dfsg.2-12.2build2) ... 259s Setting up tk8.6-blt2.5 (2.5.3+dfsg-8) ... 259s Setting up libucx0:arm64 (1.19.0+ds-1build1) ... 259s Setting up python3.14-tk (3.14.0-4) ... 259s Setting up libtool (2.5.4-7) ... 259s Setting up blt (2.5.3+dfsg-8) ... 259s Setting up python3-xarray (2025.03.1-8) ... 262s Setting up python3-tk:arm64 (3.13.9-1) ... 262s Setting up libcurl4-gnutls-dev:arm64 (8.14.1-2ubuntu1) ... 262s Setting up python3-jupyter-console (6.6.3-2) ... 262s Setting up gcc (4:15.2.0-4ubuntu1) ... 262s Setting up gcc-14 (14.3.0-10ubuntu1) ... 262s Setting up libqt6widgets6:arm64 (6.9.2+dfsg-3ubuntu1) ... 262s Setting up dh-autoreconf (21) ... 263s Setting up python3-h5netcdf (1.6.1-1) ... 263s Setting up libterralib-dev:arm64 (4.3.0+dfsg.2-12.2build2) ... 263s Setting up python3-pil.imagetk:arm64 (11.3.0-1ubuntu2) ... 263s Setting up gfortran-14-aarch64-linux-gnu (14.3.0-10ubuntu1) ... 263s Setting up g++-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 263s Setting up gfortran-14 (14.3.0-10ubuntu1) ... 263s Setting up libgs10:arm64 (10.05.0dfsg1-0ubuntu4) ... 263s Setting up libopenmpi40:arm64 (5.0.8-8ubuntu1) ... 263s Setting up debhelper (13.24.2ubuntu1) ... 263s Setting up ghostscript (10.05.0dfsg1-0ubuntu4) ... 263s Setting up libeccodes-dev:arm64 (2.41.0-1) ... 263s Setting up g++ (4:15.2.0-4ubuntu1) ... 263s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 263s Setting up build-essential (12.12ubuntu1) ... 263s Setting up libeckit0d:arm64 (1.32.3-1) ... 263s Setting up openmpi-bin (5.0.8-8ubuntu1) ... 263s update-alternatives: using /usr/bin/mpirun.openmpi to provide /usr/bin/mpirun (mpirun) in auto mode 263s update-alternatives: warning: skip creation of /usr/share/man/man1/mpiexec.1.gz because associated file /usr/share/man/man1/mpiexec.openmpi.1.gz (of link group mpirun) doesn't exist 263s update-alternatives: using /usr/bin/mpicc.openmpi to provide /usr/bin/mpicc (mpi) in auto mode 263s Setting up pybuild-plugin-autopkgtest (6.20250414) ... 263s Setting up libeckit-utils (1.32.3-1) ... 263s Setting up libodc-0d:arm64 (1.6.2-2) ... 263s Setting up libopenmpi-dev:arm64 (5.0.8-8ubuntu1) ... 263s update-alternatives: using /usr/lib/aarch64-linux-gnu/openmpi/include to provide /usr/include/aarch64-linux-gnu/mpi (mpi-aarch64-linux-gnu) in auto mode 263s Setting up odc (1.6.2-2) ... 263s Setting up libmagplus3v5:arm64 (4.16.0+really4.16.0-2) ... 263s Setting up mpi-default-dev (1.19) ... 263s Setting up magics++ (4.16.0+really4.16.0-2) ... 263s Setting up libeckit-dev:arm64 (1.32.3-1) ... 263s Setting up libmagics++-metview-dev:arm64 (4.16.0+really4.16.0-2) ... 263s Setting up libodc-dev:arm64 (1.6.2-2) ... 263s Setting up libmagics++-dev:arm64 (4.16.0+really4.16.0-2) ... 263s Setting up python3-ecmwflibs (2:0.6.3-2build2) ... 263s Setting up python3-eccodes (2:2.43.0-1) ... 263s Setting up python3-cfgrib (0.9.15.1-1) ... 264s Setting up node-ms (2.1.3+~cs0.7.31-3) ... 264s Setting up node-semver (7.6.1+~7.5.8-2) ... 264s Setting up node-corepack (0.24.0-5) ... 264s Setting up node-debug (4.4.1+~4.1.12-1) ... 264s Setting up node-llhttp (9.3.3~really9.3.0+~cs12.11.8-3) ... 264s Setting up python3-fonttools (4.57.0-2build1) ... 266s Setting up python3-ufolib2 (0.17.1+dfsg1-1) ... 266s Setting up node-acorn (8.8.1+ds+~cs25.17.7-2) ... 266s Setting up node-undici (7.16.0+dfsg+~cs3.2.0-2) ... 266s Setting up libnode115:arm64 (20.19.4+dfsg-1) ... 266s Setting up python3-matplotlib (3.10.7+dfsg1-1) ... 269s Setting up python3-cartopy (0.25.0+dfsg-1) ... 270s Setting up python3-seaborn (0.13.2-5) ... 270s Setting up nodejs (20.19.4+dfsg-1) ... 270s update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode 270s Setting up node-argparse (2.0.1-2) ... 270s Setting up node-esprima (4.0.1+ds+~4.0.3-2) ... 270s Setting up node-js-yaml (4.1.0+dfsg+~4.0.5-7) ... 270s Setting up python-dask-doc (2024.12.1+dfsg-2) ... 270s Processing triggers for install-info (7.2-5) ... 271s Processing triggers for libc-bin (2.42-2ubuntu2) ... 271s Processing triggers for systemd (257.9-0ubuntu2) ... 271s Processing triggers for man-db (2.13.1-1) ... 273s Processing triggers for udev (257.9-0ubuntu2) ... 273s Processing triggers for sgml-base (1.31+nmu1) ... 273s Setting up docutils-common (0.21.2+dfsg-2) ... 273s Processing triggers for sgml-base (1.31+nmu1) ... 273s Setting up python3-docutils (0.21.2+dfsg-2) ... 274s Setting up python3-sphinx (8.2.3-1ubuntu2) ... 276s Setting up python3-sphinx-gallery (0.17.1-1) ... 276s Setting up python3-sphinx-copybutton (0.5.2-3) ... 276s Setting up python3-sphinx-design (0.6.1-2) ... 277s Setting up python3-nbsphinx (0.9.5+ds-1) ... 277s Setting up python3-sphinxext-rediraffe (0.3.0-1) ... 277s Setting up python3-sphinxcontrib-mermaid (1.0.0-1) ... 277s Setting up python3-sphinxcontrib.jquery (4.1-6) ... 278s Setting up python3-numpydoc (1.9.0-1) ... 278s Setting up python3-pydata-sphinx-theme (0.16.1+dfsg-3) ... 278s Setting up python3-sphinxext-opengraph (0.12.0-1) ... 278s Setting up python3-autodocsumm (0.2.14-2) ... 279s Setting up python3-sphinx-remove-toctrees (1.0.0-1) ... 279s Setting up python3-sphinx-inline-tabs (2023.4.21-3) ... 279s Setting up python3-sphinx-book-theme (1.1.4-2) ... 279s Setting up python3-sphinx-rtd-theme (3.0.2+dfsg-3) ... 279s Setting up python3-numcodecs (0.16.3+ds-1) ... 280s Setting up python3-zarr (3.1.3-1) ... 282s autopkgtest [12:15:05]: test pybuild-autopkgtest: pybuild-autopkgtest 282s autopkgtest [12:15:05]: test pybuild-autopkgtest: [----------------------- 282s pybuild-autopkgtest 282s I: pybuild base:311: cd /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build; python3.14 -m pytest --deselect=tests/test_weighted.py::test_weighted_operations_keep_attr --deselect=tests/test_variable.py::TestVariable::test_reduce_keepdims --deselect=tests/test_backends.py::test_zarr_region_chunk_partial_offset --deselect=tests/test_backends.py::test_chunk_encoding_with_dask --pyargs xarray 295s ============================= test session starts ============================== 295s platform linux -- Python 3.14.0, pytest-8.3.5, pluggy-1.6.0 295s rootdir: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build 295s configfile: pyproject.toml 295s plugins: typeguard-4.4.2, hypothesis-6.130.5, mypy-plugins-3.2.0, zarr-3.1.3, xdist-3.8.0 295s collected 21888 items / 51 deselected / 4 skipped / 21837 selected 295s 296s tests/test_accessor_dt.py .............................................. [ 0%] 297s ........................................................................ [ 0%] 297s ........................................................................ [ 0%] 298s ........................................................................ [ 1%] 299s ........................................................................ [ 1%] 300s .................... [ 1%] 300s tests/test_accessor_str.py ............................................. [ 1%] 300s ........................................................................ [ 2%] 300s ........................................................................ [ 2%] 300s ...................................... [ 2%] 300s tests/test_assertions.py .............................. [ 2%] 300s tests/test_backends.py .ssssssssssssssssssssssssssssssssssssssssssssssss [ 3%] 300s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 3%] 300s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 3%] 302s ssssssssssssssssssssssss.................s...............XxXsXsssss..... [ 4%] 308s ..s..................Fs........s.s.................ss................... [ 4%] 313s ..........................................................s............. [ 4%] 320s ..XxXsXsssss.......s..................Fs........s.s.................ss.. [ 5%] 328s ........................................................................ [ 5%] 336s ...s...............XxXsXsssss.......s..................Fs........s.s.... [ 5%] 342s .............ss......................................................... [ 5%] 354s .....FFF.......s..............FFFFF...F.....Fs....FFFFFFFFF..xxxsxsssssF [ 6%] 370s FFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ssFFFFFFFFFFFFFFFFF [ 6%] 389s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF...F.....Fs....FFFFF [ 6%] 406s FFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ss [ 7%] 429s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF... [ 7%] 447s F.....Fs....FFFFFFFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss. [ 7%] 467s FFFF...F....F..ssFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.F [ 8%] 479s F.FFF...FFFFFFFFFF.s..FF.F.F.FFFFFs..................s...............XxX [ 8%] 481s sXXxXsX.......s.s................................s...............XxXsXXx [ 8%] 483s XsX.......s.s...............ss.................s...............XxXsXXxXs [ 9%] 483s X.......s.s................F.sssssssssssssssssssssssssssssssssssssssssss [ 9%] 483s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 9%] 498s sssssssssssssssssssssss.FFFFFFFFFFFFFFFsFFFFFFFFFFFFF.FxxxsxxxxsxFFFFFFF [ 10%] 503s sFs.FFFFFFFFFFF.FF...Fssssssssssssssssssssssssssssssssssssssssssssssssss [ 10%] 503s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 10%] 503s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 11%] 503s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 11%] 503s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 11%] 504s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssFF [ 12%] 512s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFssssssssssssssssssssssssssssssssss [ 12%] 515s sssssssssssssssssssssssssssssssss.sxsFFFF.F.s..s..s..s.sss.FFsFFFFFFFFFF [ 12%] 528s FFFFFFFFFFFFFFFFFFFFFFxxxFFFFFFFFFFFFFFFFFFFF....ssFFFFFFFFFFFFs.sssssss [ 13%] 528s s [ 13%] 529s tests/test_backends_api.py s....................... [ 13%] 529s tests/test_backends_common.py ... [ 13%] 532s tests/test_backends_datatree.py sssssssssssssssss.F.FFF.F.......F.F.F.F. [ 13%] 533s F.F.F.F...... [ 13%] 537s tests/test_backends_file_manager.py ............................... [ 13%] 537s tests/test_backends_locks.py . [ 13%] 537s tests/test_backends_lru_cache.py ........ [ 13%] 540s tests/test_calendar_ops.py ........................... [ 13%] 540s tests/test_cftime_offsets.py ........................................... [ 14%] 540s ........................................................................ [ 14%] 540s ........................................................................ [ 14%] 540s ........................................................................ [ 15%] 540s ........................................................................ [ 15%] 541s ........................................................................ [ 15%] 541s ........................................................................ [ 16%] 541s ........................................................................ [ 16%] 541s ........................................................................ [ 16%] 541s ........................................................................ [ 17%] 541s ........................................................................ [ 17%] 541s ........................................................................ [ 17%] 541s ........................................................................ [ 18%] 541s ........................................................................ [ 18%] 541s ........................................................................ [ 18%] 541s ........................................................................ [ 19%] 541s ........................................................................ [ 19%] 541s ........................................................................ [ 19%] 541s ........................................................................ [ 20%] 542s ........................................................................ [ 20%] 542s ........................................................................ [ 20%] 542s ........................................................................ [ 21%] 542s ........................................................................ [ 21%] 542s ........................................................................ [ 21%] 542s ........................................................................ [ 22%] 542s ........................................................................ [ 22%] 542s ........................................................................ [ 22%] 542s ........................................................................ [ 23%] 542s ........................................................................ [ 23%] 542s ........................................................................ [ 23%] 542s ........................................................................ [ 24%] 543s ........................................................................ [ 24%] 543s ........................................................................ [ 24%] 543s ........................................................................ [ 24%] 543s ........................................................................ [ 25%] 543s ........................................................................ [ 25%] 543s ........................................................................ [ 25%] 543s ........................................................................ [ 26%] 543s ........................................................................ [ 26%] 543s .............ssssssssssssssssssssssssssssssssssssssssssssssssssssssss... [ 26%] 543s .ssss....ssss....ssss....ssss.................................. [ 27%] 543s tests/test_cftimeindex.py .............................................. [ 27%] 543s ........................................................................ [ 27%] 544s ........................................................................ [ 28%] 544s ........................................................................ [ 28%] 544s ........................................................................ [ 28%] 544s ........................................................................ [ 29%] 544s ........................................................................ [ 29%] 545s ........................................................................ [ 29%] 545s ........................................................................ [ 30%] 545s ........................................................................ [ 30%] 545s ........................................................................ [ 30%] 545s ........................................................................ [ 31%] 545s ...........................................x............................ [ 31%] 546s ........................................................................ [ 31%] 546s ................................................ [ 31%] 546s tests/test_cftimeindex_resample.py ..................................... [ 32%] 547s ........................................................................ [ 32%] 548s ........................................................................ [ 32%] 548s ........................................................................ [ 33%] 549s ........................................................................ [ 33%] 550s ........................................................................ [ 33%] 551s ........................................................................ [ 34%] 551s ................................................ [ 34%] 551s tests/test_coarsen.py .................................................. [ 34%] 552s ........................................................................ [ 34%] 553s ..........s.......s.......s.......s.......s.......s.......s.......s..... [ 35%] 553s .... [ 35%] 553s tests/test_coding.py ............................... [ 35%] 553s tests/test_coding_strings.py ....................... [ 35%] 553s tests/test_coding_times.py ............................................. [ 35%] 554s ........................................................................ [ 36%] 554s ........................................................................ [ 36%] 554s ........................................................................ [ 36%] 554s ........................................................................ [ 37%] 555s ........................................................................ [ 37%] 555s ........................................................................ [ 37%] 555s ........................................................................ [ 38%] 555s ........................................................................ [ 38%] 555s ........................................................................ [ 38%] 556s ...................s..................................................XX [ 39%] 556s X....................................................................... [ 39%] 556s ........................................................................ [ 39%] 556s ......................................ssssssss......s......s......s..... [ 39%] 557s .s......s............................................................... [ 40%] 558s .......................................................... [ 40%] 558s tests/test_combine.py .......................................x.......... [ 40%] 559s ...................................................... [ 41%] 559s tests/test_computation.py .............................................. [ 41%] 560s ........................................................................ [ 41%] 563s ........................................................................ [ 41%] 566s ........................................................................ [ 42%] 567s ..................................XxXx. [ 42%] 567s tests/test_concat.py ................................................... [ 42%] 568s ................................................. [ 42%] 568s tests/test_conventions.py .................................sssssssssssss [ 43%] 568s ssssssssssssssssssssssssssssssssssssssssssssssssssssss........ [ 43%] 568s tests/test_coordinate_transform.py ............ [ 43%] 568s tests/test_coordinates.py ...................... [ 43%] 570s tests/test_dask.py ..................................................... [ 43%] 585s ..........XXx.X......................................................... [ 44%] 586s .......................................................F................ [ 44%] 587s ...................... [ 44%] 587s tests/test_dataarray.py ................................................ [ 44%] 588s ........................................................................ [ 45%] 588s ........................................................................ [ 45%] 589s ........................................................................ [ 45%] 590s s...ss......................................Xx.......................... [ 46%] 591s ..........................ss....ss...................................... [ 46%] 594s ............x.....................................x.......x............. [ 46%] 595s ................sssssssssssss.................ss...... [ 47%] 668s tests/test_dataarray_typing.yml .............. [ 47%] 670s tests/test_dataset.py .................................................. [ 47%] 671s ........................................................................ [ 47%] 672s ......Xx...................................................s............ [ 47%] 672s ..............................................s......................... [ 48%] 673s ........................................................................ [ 48%] 674s ...............................................................ss....ss. [ 48%] 676s ......................................................................ss [ 49%] 676s ... [ 49%] 726s tests/test_dataset_typing.yml .............. [ 49%] 727s tests/test_datatree.py ............................xx..........x......x. [ 49%] 727s ........................................................................ [ 49%] 727s ........x.......... [ 49%] 727s tests/test_datatree_mapping.py .............x........ [ 50%] 777s tests/test_datatree_typing.yml .............. [ 50%] 777s tests/test_deprecation_helpers.py .. [ 50%] 777s tests/test_dtypes.py ................................................... [ 50%] 777s ...sss... [ 50%] 777s tests/test_duck_array_ops.py ......s...........s.................XX..... [ 50%] 778s ................XX.....................XX.....................XX..s..... [ 50%] 779s ..................................ss..............ss..............ss.... [ 51%] 780s ..ss......ss..............ss............................................ [ 51%] 782s ..........ss......ss..............................ss..............ss.... [ 51%] 784s ..........ss......ss......ss..............ss............................ [ 52%] 786s ..........................ss......ss................ssssssssss.......... [ 52%] 787s ssssssssss..........ssssssssss..........ssssssssss..........ssssss...... [ 52%] 788s ........ssssss..............ssssss..............ssssss..............ssss [ 53%] 788s sssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s. [ 53%] 788s s.s.sssssss.s.s.s.s.s.s.sssssss.s.s.s.s.s.s.sssssss.s.s.s.s.s.s.sssssss. [ 53%] 790s s.s.s.s.s.s............................................................. [ 54%] 791s ........................................................................ [ 54%] 792s ........................................................................ [ 54%] 793s ........................................................................ [ 55%] 794s ........................................................................ [ 55%] 795s ........................................................................ [ 55%] 799s ........................................................ [ 56%] 799s tests/test_duck_array_wrapping.py s.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.sxss.s [ 56%] 800s .ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.s.ssXsxss.sxss.sxss.sxss.s.ss.s.s [ 56%] 800s sxsxssxsxssxsxss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.sxssxsxss.s.ss.s.ss. [ 57%] 801s sxss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ssXsxss.s.ss.sxss.sx [ 57%] 801s ss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss [ 57%] 801s .s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ssxs [ 57%] 802s xss.s.ss.s.ss.s.ssxs.ss.s.ssxsxss.s.ss.s.ss.s.ssxsxss.s.ss.s.ss.s.ss.s.s [ 58%] 802s s.s.ss.s.ss.s.ss.s.s [ 58%] 802s tests/test_error_messages.py .. [ 58%] 802s tests/test_extensions.py .... [ 58%] 802s tests/test_formatting.py .....................................s......... [ 58%] 802s ..... [ 58%] 802s tests/test_formatting_html.py ........................ [ 58%] 805s tests/test_groupby.py ......................s........................... [ 59%] 806s ...............................ss....................................... [ 59%] 807s ........................................................................ [ 59%] 809s .............................................................sssssssss.. [ 60%] 810s ..s..............sssssssssss............. [ 60%] 810s tests/test_hashable.py ........ [ 60%] 810s tests/test_indexes.py .................................................. [ 60%] 810s ........................ [ 60%] 810s tests/test_indexing.py ................................................. [ 60%] 811s ........................................................................ [ 61%] 811s ............... [ 61%] 821s tests/test_interp.py ................................................... [ 61%] 829s .x...................................................................... [ 61%] 847s ................................................................sss..sss [ 62%] 867s ..sss..sss..sss..sss..sss..sss............... [ 62%] 867s tests/test_merge.py .................................................... [ 62%] 867s ... [ 62%] 870s tests/test_missing.py .................................................. [ 62%] 871s ..................s...........................................x.. [ 63%] 871s tests/test_namedarray.py ....x...........................s.............. [ 63%] 871s .. [ 63%] 871s tests/test_nputils.py .. [ 63%] 871s tests/test_options.py ................... [ 63%] 872s tests/test_pandas_to_xarray.py xxxxxxxxxxxxxxxxxxxxxxxsxxxxxx........... [ 63%] 872s ....................... [ 63%] 872s tests/test_parallelcompat.py ............... [ 63%] 874s tests/test_plot.py ..................................................... [ 63%] 876s ........................................................................ [ 64%] 881s ........................................................................ [ 64%] 886s ...............................................s........................ [ 64%] 891s .............X.......................................................x.. [ 65%] 913s ss.ssss................................................................. [ 65%] 916s .......sss.............................................................. [ 65%] 917s .......................................... [ 66%] 917s tests/test_plugins.py ...........F. [ 66%] 918s tests/test_print_versions.py . [ 66%] 924s tests/test_rolling.py .................................................. [ 66%] 927s ........................................................................ [ 66%] 930s ........................................................................ [ 67%] 932s ........................................................................ [ 67%] 936s ........................................................................ [ 67%] 939s ........................................................................ [ 68%] 939s ........................................................................ [ 68%] 940s ........................................................................ [ 68%] 940s ........................................................................ [ 69%] 941s ........................................................................ [ 69%] 943s ........................................................................ [ 69%] 949s ........................................................................ [ 70%] 953s ........................................................................ [ 70%] 958s ........................................................................ [ 70%] 958s ........................................................................ [ 71%] 959s ........................................................................ [ 71%] 959s ........................................................................ [ 71%] 960s ........................................................................ [ 72%] 964s ........................................................................ [ 72%] 968s ........................................................................ [ 72%] 972s ........................................................................ [ 73%] 974s ........................................................................ [ 73%] 974s ........................................................................ [ 73%] 975s ........................................................................ [ 74%] 977s ........................................................................ [ 74%] 982s ........................................................................ [ 74%] 987s ........................................................................ [ 75%] 991s ........................................................................ [ 75%] 994s ........................................................................ [ 75%] 994s ........................................................................ [ 76%] 994s ........................................................................ [ 76%] 1001s ........................................................................ [ 76%] 1004s ...........ssssssssssssssssssssssssssssssssssssssssss................... [ 77%] 1005s ........................................................................ [ 77%] 1005s ........................................................................ [ 77%] 1006s ........................................................................ [ 78%] 1006s ........................................................................ [ 78%] 1007s ........................................................................ [ 78%] 1008s ........................................................ssssssssssssssss [ 78%] 1008s ........................................................................ [ 79%] 1009s ........................................................................ [ 79%] 1010s ........................................................................ [ 79%] 1011s ........................................................................ [ 80%] 1015s ........................................................................ [ 80%] 1020s ........................................................................ [ 80%] 1025s ssssssssssssssss........................................................ [ 81%] 1031s ........................................................................ [ 81%] 1037s ........................................................................ [ 81%] 1043s ........................................................................ [ 82%] 1050s ........................................................................ [ 82%] 1050s ........sss [ 82%] 1068s tests/test_strategies.py ..................... [ 82%] 1068s tests/test_treenode.py .................................. [ 82%] 1071s tests/test_tutorial.py xxss [ 82%] 1071s tests/test_typed_ops.py ..... [ 82%] 1071s tests/test_ufuncs.py ................................................... [ 83%] 1071s .......................................................................x [ 83%] 1071s .. [ 83%] 1072s tests/test_units.py .s..s..s..s......sssssxxxxx.....sssss.xxxx.....sssss [ 83%] 1076s xxxxx.....sssss.xxxx.....sssssxxxxx.....sssss.xxxx.....sssssxxxxx.....ss [ 84%] 1077s sss.xxxx.........sssss..........sssss..........sssss..........sssss..... [ 84%] 1078s .....sssss..........sssss..........sssss..........sssss..........sssss.. [ 84%] 1078s ........sssss..........sssss..........sssss......s..s..s..s..s..s..s..s. [ 85%] 1080s .sx.sx.sx.sx............................................................ [ 85%] 1080s ........................................................................ [ 85%] 1080s ...................ssssssssss..........ssssssssss....................... [ 86%] 1080s ........................................................................ [ 86%] 1080s ...................................ss..XX............ss..XX............. [ 86%] 1080s ........................................................................ [ 87%] 1081s .....................s..s..ss....ss......ss..s.......................ss. [ 87%] 1081s .s...................................................................... [ 87%] 1089s ....x....x......................xxxxx.....xxxxx.x.x.x.x.x.x.x.x.x.x..... [ 88%] 1090s .xxxx................................................................... [ 88%] 1091s ...............x...............sssss.....sssssssssssssss.....sssss.....s [ 88%] 1091s ssssssssssssss.....sssss..........sssss..................s..s..s..s.ssss [ 89%] 1091s ss.s..s..s..s..s..s..s..s.ssssss.s..s..s..s...........ssssssssssssssssss [ 89%] 1091s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 89%] 1094s ........................................................xx..xx..ssssssss [ 90%] 1096s ssssssssssssxx..xx..ssssssssssssssssssss......ss....s......s..s.s.s.s.s. [ 90%] 1097s s...ss....ss....ss....ss....ss....ss....ss....ss...s..s..s.xs.sss.s..s.. [ 90%] 1097s s..s.xs.sss.s.....ss....ss....ss....ss....ss....ss....ss....ss.......sss [ 91%] 1098s ss..........sssss.......ss....ss........................................ [ 91%] 1099s ....................xxxx................................................ [ 91%] 1101s ..................................xx.....sssss.....sssss.....sssss.....s [ 92%] 1101s ssssssssssssss.....sssss.....sssssssssssssss.....sssss.....sssss........ [ 92%] 1102s .......sss...sssxx....s......s......ssssssssssssssssssssssssssssssssssss [ 92%] 1102s ssssssssssssssssssssssssssssssssssssssssssssssssssssss...sss......sss... [ 93%] 1104s ..................................................xx..xx..ssssssssssssss [ 93%] 1106s ssssssxx..xx..ssssssssssssssssssss............ssssssssssss.............. [ 93%] 1108s ..........ssssssssssss...............xx.ssssss...Xx....xx.ssssss...Xx..s [ 93%] 1109s ..s...........ssssssssss....................ssssssssss.................. [ 94%] 1109s s.....ssssssssssssss........s.............s.....ssssssssssssss........s. [ 94%] 1111s .........sssss..........sssss.......x.x.x.... [ 94%] 1111s tests/test_utils.py .................................................... [ 95%] 1111s .............. [ 95%] 1111s tests/test_variable.py ................................................. [ 95%] 1111s ........................................................................ [ 95%] 1111s ........................................................................ [ 96%] 1112s ........................................................................ [ 96%] 1113s ........................................................................ [ 96%] 1123s .................ssss...............x.xX.......xX.......xx.......xx..... [ 97%] 1123s ..xx.......s............................................................ [ 97%] 1124s ........................ssssssssssssssssssssssssssssssssssssssssssssssss [ 97%] 1124s sssssss..........................ssss....................... [ 97%] 1125s tests/test_weighted.py ................................................. [ 98%] 1125s ........................................................ssssssssssssssss [ 98%] 1125s ssssssssssssssssssssssssssssssssssssssssssssssssssssssss................ [ 98%] 1128s ........................................................................ [ 99%] 1129s ........................................................................ [ 99%] 1132s ........................................................................ [ 99%] 1134s ................................... [100%] 1134s 1134s =================================== FAILURES =================================== 1134s _________________ TestZarrDictStore.test_non_existent_store[2] _________________ 1134s 1134s self = 1134s 1134s def test_non_existent_store(self) -> None: 1134s with pytest.raises( 1134s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1134s ): 1134s > xr.open_zarr(f"{uuid.uuid4()}") 1134s 1134s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1134s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1134s ds = open_dataset( 1134s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1134s backend_ds = backend.open_dataset( 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1134s store = ZarrStore.open_group( 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1134s ) = _get_open_params( 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1134s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1134s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1134s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1134s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1134s raise return_result 1134s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1134s return await coro 1134s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1134s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1134s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1134s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1134s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1134s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1134s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1134s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1134s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1134s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1134s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1134s await store._open() 1134s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1134s 1134s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/49d457c9-85c8-4867-b820-1eb2f95f8f04') 1134s 1134s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1134s if not self.read_only: 1134s self.root.mkdir(parents=True, exist_ok=True) 1134s 1134s if not self.root.exists(): 1134s > raise FileNotFoundError(f"{self.root} does not exist") 1134s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/49d457c9-85c8-4867-b820-1eb2f95f8f04 does not exist 1134s 1134s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1134s 1134s During handling of the above exception, another exception occurred: 1134s 1134s self = 1134s 1134s def test_non_existent_store(self) -> None: 1134s > with pytest.raises( 1134s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1134s ): 1134s E AssertionError: Regex pattern did not match. 1134s E Regex: '(No such file or directory|Unable to find group)' 1134s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/49d457c9-85c8-4867-b820-1eb2f95f8f04 does not exist' 1134s 1134s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1134s ______________ TestZarrDirectoryStore.test_non_existent_store[2] _______________ 1134s 1134s self = 1134s 1134s def test_non_existent_store(self) -> None: 1134s with pytest.raises( 1134s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1134s ): 1134s > xr.open_zarr(f"{uuid.uuid4()}") 1134s 1134s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1134s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1134s ds = open_dataset( 1134s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1134s backend_ds = backend.open_dataset( 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1134s store = ZarrStore.open_group( 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1134s ) = _get_open_params( 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1134s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1134s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1134s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1134s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1134s raise return_result 1134s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1134s return await coro 1134s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1134s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1134s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1134s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1134s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1134s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1134s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1134s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1134s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1134s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1134s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1134s await store._open() 1134s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1134s 1134s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/2c263d94-1720-44c9-a5f3-d9edab6346c2') 1134s 1134s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1134s if not self.read_only: 1134s self.root.mkdir(parents=True, exist_ok=True) 1134s 1134s if not self.root.exists(): 1134s > raise FileNotFoundError(f"{self.root} does not exist") 1134s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/2c263d94-1720-44c9-a5f3-d9edab6346c2 does not exist 1134s 1134s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1134s 1134s During handling of the above exception, another exception occurred: 1134s 1134s self = 1134s 1134s def test_non_existent_store(self) -> None: 1134s > with pytest.raises( 1134s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1134s ): 1134s E AssertionError: Regex pattern did not match. 1134s E Regex: '(No such file or directory|Unable to find group)' 1134s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/2c263d94-1720-44c9-a5f3-d9edab6346c2 does not exist' 1134s 1134s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1134s ________________ TestZarrWriteEmpty.test_non_existent_store[2] _________________ 1134s 1134s self = 1134s 1134s def test_non_existent_store(self) -> None: 1134s with pytest.raises( 1134s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1134s ): 1134s > xr.open_zarr(f"{uuid.uuid4()}") 1134s 1134s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1134s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1134s ds = open_dataset( 1134s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1134s backend_ds = backend.open_dataset( 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1134s store = ZarrStore.open_group( 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1134s ) = _get_open_params( 1134s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1134s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1134s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1134s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1134s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1134s raise return_result 1134s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1134s return await coro 1134s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1134s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1134s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1134s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1134s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1134s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1134s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1134s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1134s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1134s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1134s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1134s await store._open() 1134s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1134s 1134s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/3f4933f2-c276-4822-8e65-0f02b143f457') 1134s 1134s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1134s if not self.read_only: 1134s self.root.mkdir(parents=True, exist_ok=True) 1134s 1134s if not self.root.exists(): 1134s > raise FileNotFoundError(f"{self.root} does not exist") 1134s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/3f4933f2-c276-4822-8e65-0f02b143f457 does not exist 1134s 1134s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1134s 1134s During handling of the above exception, another exception occurred: 1134s 1134s self = 1134s 1134s def test_non_existent_store(self) -> None: 1134s > with pytest.raises( 1134s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1134s ): 1134s E AssertionError: Regex pattern did not match. 1134s E Regex: '(No such file or directory|Unable to find group)' 1134s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/3f4933f2-c276-4822-8e65-0f02b143f457 does not exist' 1134s 1134s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1134s _______________ TestZarrWriteEmpty.test_write_empty[2-True-True] _______________ 1134s 1134s self = 1134s consolidated = True, write_empty = True 1134s 1134s @pytest.mark.parametrize("consolidated", [True, False, None]) 1134s @pytest.mark.parametrize("write_empty", [True, False, None]) 1134s def test_write_empty( 1134s self, 1134s consolidated: bool | None, 1134s write_empty: bool | None, 1134s ) -> None: 1134s def assert_expected_files(expected: list[str], store: str) -> None: 1134s """Convenience for comparing with actual files written""" 1134s ls = [] 1134s test_root = os.path.join(store, "test") 1134s for root, _, files in os.walk(test_root): 1134s ls.extend( 1134s [ 1134s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1134s for f in files 1134s ] 1134s ) 1134s 1134s assert set(expected) == set( 1134s [ 1134s file.lstrip("c/") 1134s for file in ls 1134s if (file not in (".zattrs", ".zarray", "zarr.json")) 1134s ] 1134s ) 1134s 1134s # The zarr format is set by the `default_zarr_format` 1134s # pytest fixture that acts on a superclass 1134s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1134s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1134s expected = ["0.1.0"] 1134s else: 1134s expected = [ 1134s "0.0.0", 1134s "0.0.1", 1134s "0.1.0", 1134s "0.1.1", 1134s ] 1134s 1134s if zarr_format_3: 1134s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1134s # transform to the path style of zarr 3 1134s # e.g. 0/0/1 1134s expected = [e.replace(".", "/") for e in expected] 1134s else: 1134s # use nan for default fill_value behaviour 1134s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1134s 1134s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1134s 1134s if has_dask: 1134s ds["test"] = ds["test"].chunk(1) 1134s encoding = None 1134s else: 1134s encoding = {"test": {"chunks": (1, 1, 1)}} 1134s 1134s with self.temp_dir() as (d, store): 1134s ds.to_zarr( 1134s store, 1134s mode="w", 1134s encoding=encoding, 1134s write_empty_chunks=write_empty, 1134s ) 1134s 1134s # check expected files after a write 1134s assert_expected_files(expected, store) 1134s 1134s with self.roundtrip_dir( 1134s ds, 1134s store, 1134s save_kwargs={ 1134s "mode": "a", 1134s "append_dim": "Z", 1134s "write_empty_chunks": write_empty, 1134s }, 1134s ) as a_ds: 1134s expected_ds = xr.concat([ds, ds], dim="Z") 1134s 1134s assert_identical(a_ds, expected_ds.compute()) 1134s # add the new files we expect to be created by the append 1134s # that was performed by the roundtrip_dir 1134s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1134s expected.append("1.1.0") 1134s else: 1134s if not has_zarr_v3: 1134s # TODO: remove zarr3 if once zarr issue is fixed 1134s # https://github.com/zarr-developers/zarr-python/issues/2931 1134s expected.extend( 1134s [ 1134s "1.1.0", 1134s "1.0.0", 1134s "1.0.1", 1134s "1.1.1", 1134s ] 1134s ) 1134s else: 1134s expected.append("1.1.0") 1134s if zarr_format_3: 1134s expected = [e.replace(".", "/") for e in expected] 1134s > assert_expected_files(expected, store) 1134s 1134s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1134s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1134s 1134s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1134s store = '/tmp/tmpw4s8jq0g/test.zarr' 1134s 1134s def assert_expected_files(expected: list[str], store: str) -> None: 1134s """Convenience for comparing with actual files written""" 1134s ls = [] 1134s test_root = os.path.join(store, "test") 1134s for root, _, files in os.walk(test_root): 1134s ls.extend( 1134s [ 1134s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1134s for f in files 1134s ] 1134s ) 1134s 1134s > assert set(expected) == set( 1134s [ 1134s file.lstrip("c/") 1134s for file in ls 1134s if (file not in (".zattrs", ".zarray", "zarr.json")) 1134s ] 1134s ) 1134s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1134s E 1134s E Extra items in the right set: 1134s E '1.0.1' 1134s E '1.1.1' 1134s E '1.0.0' 1134s E Use -v to get more diff 1134s 1134s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1134s ______________ TestZarrWriteEmpty.test_write_empty[2-True-False] _______________ 1134s 1134s self = 1134s consolidated = False, write_empty = True 1134s 1134s @pytest.mark.parametrize("consolidated", [True, False, None]) 1134s @pytest.mark.parametrize("write_empty", [True, False, None]) 1134s def test_write_empty( 1134s self, 1134s consolidated: bool | None, 1134s write_empty: bool | None, 1134s ) -> None: 1134s def assert_expected_files(expected: list[str], store: str) -> None: 1134s """Convenience for comparing with actual files written""" 1134s ls = [] 1134s test_root = os.path.join(store, "test") 1134s for root, _, files in os.walk(test_root): 1134s ls.extend( 1134s [ 1134s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1134s for f in files 1134s ] 1134s ) 1134s 1134s assert set(expected) == set( 1134s [ 1134s file.lstrip("c/") 1134s for file in ls 1134s if (file not in (".zattrs", ".zarray", "zarr.json")) 1134s ] 1134s ) 1134s 1134s # The zarr format is set by the `default_zarr_format` 1134s # pytest fixture that acts on a superclass 1134s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1134s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1134s expected = ["0.1.0"] 1134s else: 1134s expected = [ 1134s "0.0.0", 1134s "0.0.1", 1134s "0.1.0", 1134s "0.1.1", 1134s ] 1134s 1134s if zarr_format_3: 1134s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1134s # transform to the path style of zarr 3 1134s # e.g. 0/0/1 1134s expected = [e.replace(".", "/") for e in expected] 1134s else: 1134s # use nan for default fill_value behaviour 1134s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1134s 1134s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1134s 1134s if has_dask: 1134s ds["test"] = ds["test"].chunk(1) 1134s encoding = None 1134s else: 1134s encoding = {"test": {"chunks": (1, 1, 1)}} 1134s 1134s with self.temp_dir() as (d, store): 1134s ds.to_zarr( 1134s store, 1134s mode="w", 1134s encoding=encoding, 1134s write_empty_chunks=write_empty, 1134s ) 1134s 1134s # check expected files after a write 1134s assert_expected_files(expected, store) 1134s 1134s with self.roundtrip_dir( 1134s ds, 1134s store, 1134s save_kwargs={ 1134s "mode": "a", 1134s "append_dim": "Z", 1134s "write_empty_chunks": write_empty, 1134s }, 1134s ) as a_ds: 1134s expected_ds = xr.concat([ds, ds], dim="Z") 1134s 1134s assert_identical(a_ds, expected_ds.compute()) 1134s # add the new files we expect to be created by the append 1134s # that was performed by the roundtrip_dir 1134s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1134s expected.append("1.1.0") 1134s else: 1134s if not has_zarr_v3: 1134s # TODO: remove zarr3 if once zarr issue is fixed 1134s # https://github.com/zarr-developers/zarr-python/issues/2931 1134s expected.extend( 1134s [ 1134s "1.1.0", 1134s "1.0.0", 1134s "1.0.1", 1134s "1.1.1", 1134s ] 1134s ) 1134s else: 1134s expected.append("1.1.0") 1134s if zarr_format_3: 1134s expected = [e.replace(".", "/") for e in expected] 1134s > assert_expected_files(expected, store) 1134s 1134s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1134s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1134s 1134s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1134s store = '/tmp/tmpv64cx2e3/test.zarr' 1134s 1134s def assert_expected_files(expected: list[str], store: str) -> None: 1134s """Convenience for comparing with actual files written""" 1134s ls = [] 1134s test_root = os.path.join(store, "test") 1134s for root, _, files in os.walk(test_root): 1134s ls.extend( 1134s [ 1134s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1134s for f in files 1134s ] 1134s ) 1134s 1134s > assert set(expected) == set( 1134s [ 1134s file.lstrip("c/") 1134s for file in ls 1134s if (file not in (".zattrs", ".zarray", "zarr.json")) 1134s ] 1134s ) 1134s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1134s E 1134s E Extra items in the right set: 1134s E '1.0.1' 1134s E '1.1.1' 1134s E '1.0.0' 1134s E Use -v to get more diff 1134s 1134s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1134s _______________ TestZarrWriteEmpty.test_write_empty[2-True-None] _______________ 1134s 1134s self = 1134s consolidated = None, write_empty = True 1134s 1134s @pytest.mark.parametrize("consolidated", [True, False, None]) 1134s @pytest.mark.parametrize("write_empty", [True, False, None]) 1134s def test_write_empty( 1134s self, 1134s consolidated: bool | None, 1134s write_empty: bool | None, 1134s ) -> None: 1134s def assert_expected_files(expected: list[str], store: str) -> None: 1134s """Convenience for comparing with actual files written""" 1134s ls = [] 1134s test_root = os.path.join(store, "test") 1134s for root, _, files in os.walk(test_root): 1134s ls.extend( 1134s [ 1134s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1134s for f in files 1134s ] 1134s ) 1134s 1134s assert set(expected) == set( 1134s [ 1134s file.lstrip("c/") 1134s for file in ls 1134s if (file not in (".zattrs", ".zarray", "zarr.json")) 1134s ] 1134s ) 1134s 1134s # The zarr format is set by the `default_zarr_format` 1134s # pytest fixture that acts on a superclass 1134s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1134s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1134s expected = ["0.1.0"] 1134s else: 1134s expected = [ 1134s "0.0.0", 1134s "0.0.1", 1134s "0.1.0", 1134s "0.1.1", 1134s ] 1134s 1134s if zarr_format_3: 1134s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1134s # transform to the path style of zarr 3 1134s # e.g. 0/0/1 1134s expected = [e.replace(".", "/") for e in expected] 1134s else: 1134s # use nan for default fill_value behaviour 1134s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1134s 1134s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1134s 1134s if has_dask: 1134s ds["test"] = ds["test"].chunk(1) 1134s encoding = None 1134s else: 1134s encoding = {"test": {"chunks": (1, 1, 1)}} 1134s 1134s with self.temp_dir() as (d, store): 1134s ds.to_zarr( 1134s store, 1134s mode="w", 1134s encoding=encoding, 1134s write_empty_chunks=write_empty, 1134s ) 1134s 1134s # check expected files after a write 1134s assert_expected_files(expected, store) 1134s 1134s with self.roundtrip_dir( 1134s ds, 1134s store, 1134s save_kwargs={ 1134s "mode": "a", 1134s "append_dim": "Z", 1134s "write_empty_chunks": write_empty, 1134s }, 1134s ) as a_ds: 1134s expected_ds = xr.concat([ds, ds], dim="Z") 1134s 1135s assert_identical(a_ds, expected_ds.compute()) 1135s # add the new files we expect to be created by the append 1135s # that was performed by the roundtrip_dir 1135s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1135s expected.append("1.1.0") 1135s else: 1135s if not has_zarr_v3: 1135s # TODO: remove zarr3 if once zarr issue is fixed 1135s # https://github.com/zarr-developers/zarr-python/issues/2931 1135s expected.extend( 1135s [ 1135s "1.1.0", 1135s "1.0.0", 1135s "1.0.1", 1135s "1.1.1", 1135s ] 1135s ) 1135s else: 1135s expected.append("1.1.0") 1135s if zarr_format_3: 1135s expected = [e.replace(".", "/") for e in expected] 1135s > assert_expected_files(expected, store) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1135s store = '/tmp/tmp1gmndix1/test.zarr' 1135s 1135s def assert_expected_files(expected: list[str], store: str) -> None: 1135s """Convenience for comparing with actual files written""" 1135s ls = [] 1135s test_root = os.path.join(store, "test") 1135s for root, _, files in os.walk(test_root): 1135s ls.extend( 1135s [ 1135s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1135s for f in files 1135s ] 1135s ) 1135s 1135s > assert set(expected) == set( 1135s [ 1135s file.lstrip("c/") 1135s for file in ls 1135s if (file not in (".zattrs", ".zarray", "zarr.json")) 1135s ] 1135s ) 1135s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1135s E 1135s E Extra items in the right set: 1135s E '1.0.1' 1135s E '1.1.1' 1135s E '1.0.0' 1135s E Use -v to get more diff 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1135s _____________ TestZarrDictStore.test_zero_dimensional_variable[3] ______________ 1135s 1135s self = 1135s 1135s def test_zero_dimensional_variable(self) -> None: 1135s expected = create_test_data() 1135s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1135s expected["bytes_var"] = ([], b"foobar") 1135s expected["string_var"] = ([], "foobar") 1135s > with self.roundtrip(expected) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ____________________ TestZarrDictStore.test_write_store[3] _____________________ 1135s 1135s self = 1135s 1135s def test_write_store(self) -> None: 1135s expected = create_test_data() 1135s with self.create_store() as store: 1135s expected.dump_to_store(store) 1135s # we need to cf decode the store because it has time and 1135s # non-dimension coordinates 1135s > with xr.decode_cf(store) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1135s vars, attrs = obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'var1' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________________ TestZarrDictStore.test_roundtrip_test_data[3] _________________ 1135s 1135s self = 1135s 1135s def test_roundtrip_test_data(self) -> None: 1135s expected = create_test_data() 1135s > with self.roundtrip(expected) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________________________ TestZarrDictStore.test_load[3] ________________________ 1135s 1135s self = 1135s 1135s def test_load(self) -> None: 1135s expected = create_test_data() 1135s 1135s @contextlib.contextmanager 1135s def assert_loads(vars=None): 1135s if vars is None: 1135s vars = expected 1135s with self.roundtrip(expected) as actual: 1135s for k, v in actual.variables.items(): 1135s # IndexVariables are eagerly loaded into memory 1135s assert v._in_memory == (k in actual.dims) 1135s yield actual 1135s for k, v in actual.variables.items(): 1135s if k in vars: 1135s assert v._in_memory 1135s assert_identical(expected, actual) 1135s 1135s with pytest.raises(AssertionError): 1135s # make sure the contextmanager works! 1135s > with assert_loads() as ds: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1135s with self.roundtrip(expected) as actual: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s __________________ TestZarrDictStore.test_dataset_compute[3] ___________________ 1135s 1135s self = 1135s 1135s def test_dataset_compute(self) -> None: 1135s expected = create_test_data() 1135s 1135s > with self.roundtrip(expected) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _______________ TestZarrDictStore.test_roundtrip_object_dtype[3] _______________ 1135s 1135s self = 1135s 1135s def test_roundtrip_object_dtype(self) -> None: 1135s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1135s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1135s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1135s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1135s strings = np.array(["ab", "cdef", "g"], dtype=object) 1135s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1135s all_nans = np.array([np.nan, np.nan], dtype=object) 1135s original = Dataset( 1135s { 1135s "floats": ("a", floats), 1135s "floats_nans": ("a", floats_nans), 1135s "bytes": ("b", bytes_), 1135s "bytes_nans": ("b", bytes_nans), 1135s "strings": ("b", strings), 1135s "strings_nans": ("b", strings_nans), 1135s "all_nans": ("c", all_nans), 1135s "nan": ([], np.nan), 1135s } 1135s ) 1135s expected = original.copy(deep=True) 1135s > with self.roundtrip(original) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'nan' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _______________ TestZarrDictStore.test_roundtrip_float64_data[3] _______________ 1135s 1135s self = 1135s 1135s def test_roundtrip_float64_data(self) -> None: 1135s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1135s > with self.roundtrip(expected) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________________ TestZarrDictStore.test_orthogonal_indexing[3] _________________ 1135s 1135s self = 1135s 1135s def test_orthogonal_indexing(self) -> None: 1135s in_memory = create_test_data() 1135s > with self.roundtrip(in_memory) as on_disk: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________________ TestZarrDictStore.test_vectorized_indexing[3] _________________ 1135s 1135s self = 1135s 1135s def test_vectorized_indexing(self) -> None: 1135s in_memory = create_test_data() 1135s > with self.roundtrip(in_memory) as on_disk: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_vectorized_indexing_negative_step[3] __________ 1135s 1135s self = 1135s 1135s def test_vectorized_indexing_negative_step(self) -> None: 1135s # use dask explicitly when present 1135s open_kwargs: dict[str, Any] | None 1135s if has_dask: 1135s open_kwargs = {"chunks": {}} 1135s else: 1135s open_kwargs = None 1135s in_memory = create_test_data() 1135s 1135s def multiple_indexing(indexers): 1135s # make sure a sequence of lazy indexings certainly works. 1135s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1135s actual = on_disk["var3"] 1135s expected = in_memory["var3"] 1135s for ind in indexers: 1135s actual = actual.isel(ind) 1135s expected = expected.isel(ind) 1135s # make sure the array is not yet loaded into memory 1135s assert not actual.variable._in_memory 1135s assert_identical(expected, actual.load()) 1135s 1135s # with negative step slice. 1135s indexers = [ 1135s { 1135s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1135s "dim3": slice(-1, 1, -1), 1135s } 1135s ] 1135s > multiple_indexing(indexers) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1135s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ______________ TestZarrDictStore.test_outer_indexing_reversed[3] _______________ 1135s 1135s self = 1135s 1135s def test_outer_indexing_reversed(self) -> None: 1135s # regression test for GH6560 1135s ds = xr.Dataset( 1135s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1135s ) 1135s 1135s > with self.roundtrip(ds) as on_disk: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'z' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ___________________ TestZarrDictStore.test_isel_dataarray[3] ___________________ 1135s 1135s self = 1135s 1135s def test_isel_dataarray(self) -> None: 1135s # Make sure isel works lazily. GH:issue:1688 1135s in_memory = create_test_data() 1135s > with self.roundtrip(in_memory) as on_disk: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _____________ TestZarrDictStore.test_array_type_after_indexing[3] ______________ 1135s 1135s self = 1135s 1135s def test_array_type_after_indexing(self) -> None: 1135s in_memory = create_test_data() 1135s > with self.roundtrip(in_memory) as on_disk: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _______________________ TestZarrDictStore.test_dropna[3] _______________________ 1135s 1135s self = 1135s 1135s def test_dropna(self) -> None: 1135s # regression test for GH:issue:1694 1135s a = np.random.randn(4, 3) 1135s a[1, 1] = np.nan 1135s in_memory = xr.Dataset( 1135s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1135s ) 1135s 1135s assert_identical( 1135s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1135s ) 1135s 1135s > with self.roundtrip(in_memory) as on_disk: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'a' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________________ TestZarrDictStore.test_ondisk_after_print[3] _________________ 1135s 1135s self = 1135s 1135s def test_ondisk_after_print(self) -> None: 1135s """Make sure print does not load file into memory""" 1135s in_memory = create_test_data() 1135s > with self.roundtrip(in_memory) as on_disk: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s __________ TestZarrDictStore.test_roundtrip_bytes_with_fill_value[3] ___________ 1135s 1135s self = 1135s 1135s def test_roundtrip_bytes_with_fill_value(self) -> None: 1135s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1135s encoding = {"_FillValue": b"X", "dtype": "S1"} 1135s original = Dataset({"x": ("t", values, {}, encoding)}) 1135s expected = original.copy(deep=True) 1135s > with self.roundtrip(original) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value0-False] ________ 1135s 1135s self = 1135s fill_value = np.int8(-1), exp_fill_warning = False 1135s 1135s @pytest.mark.parametrize( 1135s ("fill_value", "exp_fill_warning"), 1135s [ 1135s (np.int8(-1), False), 1135s (np.uint8(255), True), 1135s (-1, False), 1135s (255, True), 1135s ], 1135s ) 1135s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1135s @contextlib.contextmanager 1135s def _roundtrip_with_warnings(*args, **kwargs): 1135s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1135s if exp_fill_warning and is_np2: 1135s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1135s SerializationWarning, 1135s match="_FillValue attribute can't be represented", 1135s ) 1135s else: 1135s warn_checker = contextlib.nullcontext() 1135s with warn_checker: 1135s with self.roundtrip(*args, **kwargs) as actual: 1135s yield actual 1135s 1135s # regression/numpy2 test for 1135s encoding = { 1135s "_FillValue": fill_value, 1135s "_Unsigned": "true", 1135s "dtype": "i1", 1135s } 1135s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1135s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1135s 1135s attributes = { 1135s "_FillValue": fill_value, 1135s "_Unsigned": "true", 1135s } 1135s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1135s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1135s encoded = Dataset({"x": ("t", sb, attributes)}) 1135s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1135s 1135s > with _roundtrip_with_warnings(decoded) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1135s with self.roundtrip(*args, **kwargs) as actual: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Int8' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value1-True] _________ 1135s 1135s self = 1135s fill_value = np.uint8(255), exp_fill_warning = True 1135s 1135s @pytest.mark.parametrize( 1135s ("fill_value", "exp_fill_warning"), 1135s [ 1135s (np.int8(-1), False), 1135s (np.uint8(255), True), 1135s (-1, False), 1135s (255, True), 1135s ], 1135s ) 1135s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1135s @contextlib.contextmanager 1135s def _roundtrip_with_warnings(*args, **kwargs): 1135s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1135s if exp_fill_warning and is_np2: 1135s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1135s SerializationWarning, 1135s match="_FillValue attribute can't be represented", 1135s ) 1135s else: 1135s warn_checker = contextlib.nullcontext() 1135s with warn_checker: 1135s with self.roundtrip(*args, **kwargs) as actual: 1135s yield actual 1135s 1135s # regression/numpy2 test for 1135s encoding = { 1135s "_FillValue": fill_value, 1135s "_Unsigned": "true", 1135s "dtype": "i1", 1135s } 1135s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1135s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1135s 1135s attributes = { 1135s "_FillValue": fill_value, 1135s "_Unsigned": "true", 1135s } 1135s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1135s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1135s encoded = Dataset({"x": ("t", sb, attributes)}) 1135s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1135s 1135s > with _roundtrip_with_warnings(decoded) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1135s with self.roundtrip(*args, **kwargs) as actual: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Int8' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ____________ TestZarrDictStore.test_roundtrip_unsigned[3--1-False] _____________ 1135s 1135s self = 1135s fill_value = -1, exp_fill_warning = False 1135s 1135s @pytest.mark.parametrize( 1135s ("fill_value", "exp_fill_warning"), 1135s [ 1135s (np.int8(-1), False), 1135s (np.uint8(255), True), 1135s (-1, False), 1135s (255, True), 1135s ], 1135s ) 1135s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1135s @contextlib.contextmanager 1135s def _roundtrip_with_warnings(*args, **kwargs): 1135s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1135s if exp_fill_warning and is_np2: 1135s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1135s SerializationWarning, 1135s match="_FillValue attribute can't be represented", 1135s ) 1135s else: 1135s warn_checker = contextlib.nullcontext() 1135s with warn_checker: 1135s with self.roundtrip(*args, **kwargs) as actual: 1135s yield actual 1135s 1135s # regression/numpy2 test for 1135s encoding = { 1135s "_FillValue": fill_value, 1135s "_Unsigned": "true", 1135s "dtype": "i1", 1135s } 1135s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1135s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1135s 1135s attributes = { 1135s "_FillValue": fill_value, 1135s "_Unsigned": "true", 1135s } 1135s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1135s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1135s encoded = Dataset({"x": ("t", sb, attributes)}) 1135s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1135s 1135s > with _roundtrip_with_warnings(decoded) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1135s with self.roundtrip(*args, **kwargs) as actual: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Int8' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ____________ TestZarrDictStore.test_roundtrip_unsigned[3-255-True] _____________ 1135s 1135s self = 1135s fill_value = 255, exp_fill_warning = True 1135s 1135s @pytest.mark.parametrize( 1135s ("fill_value", "exp_fill_warning"), 1135s [ 1135s (np.int8(-1), False), 1135s (np.uint8(255), True), 1135s (-1, False), 1135s (255, True), 1135s ], 1135s ) 1135s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1135s @contextlib.contextmanager 1135s def _roundtrip_with_warnings(*args, **kwargs): 1135s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1135s if exp_fill_warning and is_np2: 1135s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1135s SerializationWarning, 1135s match="_FillValue attribute can't be represented", 1135s ) 1135s else: 1135s warn_checker = contextlib.nullcontext() 1135s with warn_checker: 1135s with self.roundtrip(*args, **kwargs) as actual: 1135s yield actual 1135s 1135s # regression/numpy2 test for 1135s encoding = { 1135s "_FillValue": fill_value, 1135s "_Unsigned": "true", 1135s "dtype": "i1", 1135s } 1135s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1135s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1135s 1135s attributes = { 1135s "_FillValue": fill_value, 1135s "_Unsigned": "true", 1135s } 1135s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1135s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1135s encoded = Dataset({"x": ("t", sb, attributes)}) 1135s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1135s 1135s > with _roundtrip_with_warnings(decoded) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1135s with self.roundtrip(*args, **kwargs) as actual: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Int8' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1135s 1135s self = 1135s 1135s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1135s original = self._create_cf_dataset() 1135s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = 1135s name = 'det_lim' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ____ TestZarrDictStore.test_coordinate_variables_after_dataset_roundtrip[3] ____ 1135s 1135s self = 1135s 1135s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1135s original = self._create_cf_dataset() 1135s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = 1135s name = 'det_lim' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1135s 1135s self = 1135s 1135s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1135s self, 1135s ) -> None: 1135s original = self._create_cf_dataset() 1135s # The DataArray roundtrip should have the same warnings as the 1135s # Dataset, but we already tested for those, so just go for the 1135s # new warnings. It would appear that there is no way to tell 1135s # pytest "This warning and also this warning should both be 1135s # present". 1135s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1135s # needs the to_dataset. The other backends should be fine 1135s # without it. 1135s with pytest.warns( 1135s UserWarning, 1135s match=( 1135s r"Variable\(s\) referenced in bounds not in variables: " 1135s r"\['l(at|ong)itude_bnds'\]" 1135s ), 1135s ): 1135s > with self.roundtrip( 1135s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'ln_p' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s 1135s During handling of the above exception, another exception occurred: 1135s 1135s self = 1135s 1135s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1135s self, 1135s ) -> None: 1135s original = self._create_cf_dataset() 1135s # The DataArray roundtrip should have the same warnings as the 1135s # Dataset, but we already tested for those, so just go for the 1135s # new warnings. It would appear that there is no way to tell 1135s # pytest "This warning and also this warning should both be 1135s # present". 1135s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1135s # needs the to_dataset. The other backends should be fine 1135s # without it. 1135s > with pytest.warns( 1135s UserWarning, 1135s match=( 1135s r"Variable\(s\) referenced in bounds not in variables: " 1135s r"\['l(at|ong)itude_bnds'\]" 1135s ), 1135s ): 1135s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1135s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1135s E Emitted warnings: [ ZarrUserWarning('Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future.')]. 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1135s ___________________ TestZarrDictStore.test_encoding_kwarg[3] ___________________ 1135s 1135s self = 1135s 1135s def test_encoding_kwarg(self) -> None: 1135s ds = Dataset({"x": ("y", np.arange(10.0))}) 1135s 1135s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1135s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float32' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________________ TestZarrDictStore.test_default_fill_value[3] _________________ 1135s 1135s self = 1135s 1135s def test_default_fill_value(self) -> None: 1135s # Test default encoding for float: 1135s ds = Dataset({"x": ("y", np.arange(10.0))}) 1135s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1135s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float32' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord[3] _________ 1135s 1135s self = 1135s 1135s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1135s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1135s ds.y.encoding["_FillValue"] = None 1135s > with self.roundtrip(ds) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1135s 1135s self = 1135s 1135s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1135s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1135s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1135s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________________ TestZarrDictStore.test_encoding_same_dtype[3] _________________ 1135s 1135s self = 1135s 1135s def test_encoding_same_dtype(self) -> None: 1135s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1135s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1135s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float32' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ______________ TestZarrDictStore.test_append_overwrite_values[3] _______________ 1135s 1135s self = 1135s 1135s def test_append_overwrite_values(self) -> None: 1135s # regression for GH1215 1135s data = create_test_data() 1135s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1135s self.save(data, tmp_file, mode="w") 1135s data["var2"][:] = -999 1135s data["var9"] = data["var2"] * 3 1135s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1135s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-False] ____________ 1135s 1135s self = 1135s consolidated = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s def test_roundtrip_consolidated(self, consolidated) -> None: 1135s expected = create_test_data() 1135s > with self.roundtrip( 1135s expected, 1135s save_kwargs={"consolidated": consolidated}, 1135s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'var1' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-True] _____________ 1135s 1135s self = 1135s consolidated = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s def test_roundtrip_consolidated(self, consolidated) -> None: 1135s expected = create_test_data() 1135s > with self.roundtrip( 1135s expected, 1135s save_kwargs={"consolidated": consolidated}, 1135s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-None] _____________ 1135s 1135s self = 1135s consolidated = None 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s def test_roundtrip_consolidated(self, consolidated) -> None: 1135s expected = create_test_data() 1135s > with self.roundtrip( 1135s expected, 1135s save_kwargs={"consolidated": consolidated}, 1135s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ___________ TestZarrDictStore.test_read_non_consolidated_warning[3] ____________ 1135s 1135s self = 1135s 1135s def test_read_non_consolidated_warning(self) -> None: 1135s expected = create_test_data() 1135s with self.create_zarr_target() as store: 1135s self.save( 1135s expected, store_target=store, consolidated=False, **self.version_kwargs 1135s ) 1135s with pytest.warns( 1135s RuntimeWarning, 1135s match="Failed to open Zarr store with consolidated", 1135s ): 1135s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'var1' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________________ TestZarrDictStore.test_non_existent_store[3] _________________ 1135s 1135s self = 1135s 1135s def test_non_existent_store(self) -> None: 1135s with pytest.raises( 1135s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1135s ): 1135s > xr.open_zarr(f"{uuid.uuid4()}") 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1135s store = ZarrStore.open_group( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1135s ) = _get_open_params( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1135s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1135s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1135s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1135s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1135s raise return_result 1135s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1135s return await coro 1135s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1135s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1135s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1135s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1135s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1135s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1135s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1135s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1135s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1135s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1135s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1135s await store._open() 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/9ec59834-b660-4fd0-ac41-79945a11a756') 1135s 1135s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1135s if not self.read_only: 1135s self.root.mkdir(parents=True, exist_ok=True) 1135s 1135s if not self.root.exists(): 1135s > raise FileNotFoundError(f"{self.root} does not exist") 1135s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/9ec59834-b660-4fd0-ac41-79945a11a756 does not exist 1135s 1135s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1135s 1135s During handling of the above exception, another exception occurred: 1135s 1135s self = 1135s 1135s def test_non_existent_store(self) -> None: 1135s > with pytest.raises( 1135s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1135s ): 1135s E AssertionError: Regex pattern did not match. 1135s E Regex: '(No such file or directory|Unable to find group)' 1135s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/9ec59834-b660-4fd0-ac41-79945a11a756 does not exist' 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1135s _____________________ TestZarrDictStore.test_auto_chunk[3] _____________________ 1135s 1135s self = 1135s 1135s @requires_dask 1135s def test_auto_chunk(self) -> None: 1135s original = create_test_data().chunk() 1135s 1135s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ____________________ TestZarrDictStore.test_manual_chunk[3] ____________________ 1135s 1135s self = 1135s 1135s @requires_dask 1135s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1135s def test_manual_chunk(self) -> None: 1135s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1135s 1135s # Using chunks = None should return non-chunked arrays 1135s open_kwargs: dict[str, Any] = {"chunks": None} 1135s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _______________ TestZarrDictStore.test_warning_on_bad_chunks[3] ________________ 1135s 1135s self = 1135s 1135s @requires_dask 1135s def test_warning_on_bad_chunks(self) -> None: 1135s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1135s 1135s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1135s for chunks in bad_chunks: 1135s kwargs = {"chunks": chunks} 1135s with pytest.warns(UserWarning): 1135s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ______________ TestZarrDictStore.test_write_uneven_dask_chunks[3] ______________ 1135s 1135s self = 1135s 1135s @requires_dask 1135s def test_write_uneven_dask_chunks(self) -> None: 1135s # regression for GH#2225 1135s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1135s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ___________________ TestZarrDictStore.test_chunk_encoding[3] ___________________ 1135s 1135s self = 1135s 1135s def test_chunk_encoding(self) -> None: 1135s # These datasets have no dask chunks. All chunking specified in 1135s # encoding 1135s data = create_test_data() 1135s chunks = (5, 5) 1135s data["var2"].encoding.update({"chunks": chunks}) 1135s 1135s > with self.roundtrip(data) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ___________________ TestZarrDictStore.test_shard_encoding[3] ___________________ 1135s 1135s self = 1135s 1135s def test_shard_encoding(self) -> None: 1135s # These datasets have no dask chunks. All chunking/sharding specified in 1135s # encoding 1135s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1135s data = create_test_data() 1135s chunks = (1, 1) 1135s shards = (5, 5) 1135s data["var2"].encoding.update({"chunks": chunks}) 1135s data["var2"].encoding.update({"shards": shards}) 1135s > with self.roundtrip(data) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ____________ TestZarrDictStore.test_write_persistence_modes[3-None] ____________ 1135s 1135s self = 1135s group = None 1135s 1135s @pytest.mark.parametrize("group", [None, "group1"]) 1135s def test_write_persistence_modes(self, group) -> None: 1135s original = create_test_data() 1135s 1135s # overwrite mode 1135s > with self.roundtrip( 1135s original, 1135s save_kwargs={"mode": "w", "group": group}, 1135s open_kwargs={"group": group}, 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ___________ TestZarrDictStore.test_write_persistence_modes[3-group1] ___________ 1135s 1135s self = 1135s group = 'group1' 1135s 1135s @pytest.mark.parametrize("group", [None, "group1"]) 1135s def test_write_persistence_modes(self, group) -> None: 1135s original = create_test_data() 1135s 1135s # overwrite mode 1135s > with self.roundtrip( 1135s original, 1135s save_kwargs={"mode": "w", "group": group}, 1135s open_kwargs={"group": group}, 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________________ TestZarrDictStore.test_compressor_encoding[3] _________________ 1135s 1135s self = 1135s 1135s def test_compressor_encoding(self) -> None: 1135s # specify a custom compressor 1135s original = create_test_data() 1135s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1135s encoding_key = "compressors" 1135s # all parameters need to be explicitly specified in order for the comparison to pass below 1135s encoding = { 1135s "serializer": zarr.codecs.BytesCodec(endian="little"), 1135s encoding_key: ( 1135s zarr.codecs.BloscCodec( 1135s cname="zstd", 1135s clevel=3, 1135s shuffle="shuffle", 1135s typesize=8, 1135s blocksize=0, 1135s ), 1135s ), 1135s } 1135s else: 1135s from numcodecs.blosc import Blosc 1135s 1135s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1135s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1135s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1135s 1135s save_kwargs = dict(encoding={"var1": encoding}) 1135s 1135s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _______________________ TestZarrDictStore.test_group[3] ________________________ 1135s 1135s self = 1135s 1135s def test_group(self) -> None: 1135s original = create_test_data() 1135s group = "some/random/path" 1135s > with self.roundtrip( 1135s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ____________________ TestZarrDictStore.test_append_write[3] ____________________ 1135s 1135s self = 1135s 1135s def test_append_write(self) -> None: 1135s > super().test_append_write() 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1135s with self.roundtrip_append(data) as actual: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1135s self.save(data[[key]], path, mode=mode, **save_kwargs) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1135s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _______ TestZarrDictStore.test_append_with_append_dim_not_set_raises[3] ________ 1135s 1135s self = 1135s 1135s def test_append_with_append_dim_not_set_raises(self) -> None: 1135s ds, ds_to_append, _ = create_append_test_data() 1135s with self.create_zarr_target() as store_target: 1135s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1135s with pytest.raises(ValueError, match="different dimension sizes"): 1135s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'da' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _______ TestZarrDictStore.test_append_string_length_mismatch_works[3-U] ________ 1135s 1135s self = 1135s dtype = 'U' 1135s 1135s @pytest.mark.parametrize("dtype", ["U", "S"]) 1135s def test_append_string_length_mismatch_works(self, dtype) -> None: 1135s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1135s # ...but it probably would if we used object dtype 1135s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1135s expected = xr.concat([ds, ds_to_append], dim="time") 1135s with self.create_zarr_target() as store_target: 1135s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1135s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1135s _validate_datatypes_for_zarr_append( 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s vname = 'temperature' 1135s existing_var = Size: 24B 1135s [3 values with dtype= Size: 60B 1135s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 1135s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1135s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1135s f"dataset to append has dtype {new_var.dtype}." 1135s ) 1135s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 1135s dtype = 'S' 1135s 1135s @pytest.mark.parametrize("dtype", ["U", "S"]) 1135s def test_append_string_length_mismatch_works(self, dtype) -> None: 1135s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1135s # ...but it probably would if we used object dtype 1135s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1135s expected = xr.concat([ds, ds_to_append], dim="time") 1135s with self.create_zarr_target() as store_target: 1135s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1135s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1135s _validate_datatypes_for_zarr_append( 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s vname = 'temperature' 1135s existing_var = Size: 6B 1135s [3 values with dtype=|S2] 1135s new_var = Size: 9B 1135s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1135s 1135s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1135s """If variable exists in the store, confirm dtype of the data to append is compatible with 1135s existing dtype. 1135s """ 1135s if ( 1135s np.issubdtype(new_var.dtype, np.number) 1135s or np.issubdtype(new_var.dtype, np.datetime64) 1135s or np.issubdtype(new_var.dtype, np.bool_) 1135s or new_var.dtype == object 1135s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1135s ): 1135s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1135s # new to the dataset, because in this case there is no existing var to compare it to; 1135s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1135s # we can be confident appending won't cause problems. Examples of dtypes which are not 1135s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1135s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1135s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1135s f"dataset to append has dtype {new_var.dtype}." 1135s ) 1135s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype |S2 but dataset to append has dtype |S3. 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1135s _____ TestZarrDictStore.test_check_encoding_is_consistent_after_append[3] ______ 1135s 1135s self = 1135s 1135s def test_check_encoding_is_consistent_after_append(self) -> None: 1135s ds, ds_to_append, _ = create_append_test_data() 1135s 1135s # check encoding consistency 1135s with self.create_zarr_target() as store_target: 1135s import numcodecs 1135s 1135s encoding_value: Any 1135s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1135s compressor = zarr.codecs.BloscCodec() 1135s else: 1135s compressor = numcodecs.Blosc() 1135s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1135s encoding_value = (compressor,) if has_zarr_v3 else compressor 1135s 1135s encoding = {"da": {encoding_key: encoding_value}} 1135s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1135s > original_ds = xr.open_dataset( 1135s store_target, engine="zarr", **self.version_kwargs 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'da' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ______________ TestZarrDictStore.test_append_with_new_variable[3] ______________ 1135s 1135s self = 1135s 1135s def test_append_with_new_variable(self) -> None: 1135s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1135s 1135s # check append mode for new variable 1135s with self.create_zarr_target() as store_target: 1135s combined = xr.concat([ds, ds_to_append], dim="time") 1135s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1135s assert_identical( 1135s combined, 1135s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'da' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_append_with_append_dim_no_overwrite[3] _________ 1135s 1135s self = 1135s 1135s def test_append_with_append_dim_no_overwrite(self) -> None: 1135s ds, ds_to_append, _ = create_append_test_data() 1135s with self.create_zarr_target() as store_target: 1135s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1135s original = xr.concat([ds, ds_to_append], dim="time") 1135s original2 = xr.concat([original, ds_to_append], dim="time") 1135s 1135s # overwrite a coordinate; 1135s # for mode='a-', this will not get written to the store 1135s # because it does not have the append_dim as a dim 1135s lon = ds_to_append.lon.to_numpy().copy() 1135s lon[:] = -999 1135s ds_to_append["lon"] = lon 1135s > ds_to_append.to_zarr( 1135s store_target, mode="a-", append_dim="time", **self.version_kwargs 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'da' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s __________ TestZarrDictStore.test_to_zarr_compute_false_roundtrip[3] ___________ 1135s 1135s self = 1135s 1135s @requires_dask 1135s def test_to_zarr_compute_false_roundtrip(self) -> None: 1135s from dask.delayed import Delayed 1135s 1135s original = create_test_data().chunk() 1135s 1135s with self.create_zarr_target() as store: 1135s delayed_obj = self.save(original, store, compute=False) 1135s assert isinstance(delayed_obj, Delayed) 1135s 1135s # make sure target store has not been written to yet 1135s with pytest.raises(AssertionError): 1135s > with self.open(store) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'dim2' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _______ TestZarrDictStore.test_to_zarr_append_compute_false_roundtrip[3] _______ 1135s 1135s self = 1135s 1135s @requires_dask 1135s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1135s from dask.delayed import Delayed 1135s 1135s ds, ds_to_append, _ = create_append_test_data() 1135s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1135s 1135s with pytest.warns(SerializationWarning): 1135s with self.create_zarr_target() as store: 1135s delayed_obj = self.save(ds, store, compute=False, mode="w") 1135s assert isinstance(delayed_obj, Delayed) 1135s 1135s with pytest.raises(AssertionError): 1135s > with self.open(store) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'da' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________________ TestZarrDictStore.test_save_emptydim[3-False] _________________ 1135s 1135s self = 1135s chunk = False 1135s 1135s @pytest.mark.parametrize("chunk", [False, True]) 1135s def test_save_emptydim(self, chunk) -> None: 1135s if chunk and not has_dask: 1135s pytest.skip("requires dask") 1135s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1135s if chunk: 1135s ds = ds.chunk({}) # chunk dataset to save dask array 1135s > with self.roundtrip(ds) as ds_reload: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________________ TestZarrDictStore.test_save_emptydim[3-True] _________________ 1135s 1135s self = 1135s chunk = True 1135s 1135s @pytest.mark.parametrize("chunk", [False, True]) 1135s def test_save_emptydim(self, chunk) -> None: 1135s if chunk and not has_dask: 1135s pytest.skip("requires dask") 1135s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1135s if chunk: 1135s ds = ds.chunk({}) # chunk dataset to save dask array 1135s > with self.roundtrip(ds) as ds_reload: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _____ TestZarrDictStore.test_no_warning_from_open_emptydim_with_chunks[3] ______ 1135s 1135s self = 1135s 1135s @requires_dask 1135s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1135s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1135s with assert_no_warnings(): 1135s with warnings.catch_warnings(): 1135s warnings.filterwarnings( 1135s "ignore", 1135s message=".*Zarr format 3 specification.*", 1135s category=UserWarning, 1135s ) 1135s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1135s with self.open(store_target, **open_kwargs) as ds: 1135s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1135s return next(self.gen) 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1135s with xr.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'x' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_write_region[3-False-False-False-False] ________ 1135s 1135s self = 1135s consolidated = False, compute = False, use_dask = False, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_write_region[3-False-False-False-True] _________ 1135s 1135s self = 1135s consolidated = True, compute = False, use_dask = False, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_write_region[3-False-False-False-None] _________ 1135s 1135s self = 1135s consolidated = None, compute = False, use_dask = False, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_write_region[3-False-False-True-False] _________ 1135s 1135s self = 1135s consolidated = False, compute = True, use_dask = False, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-False-False-True-True] _________ 1135s 1135s self = 1135s consolidated = True, compute = True, use_dask = False, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-False-False-True-None] _________ 1135s 1135s self = 1135s consolidated = None, compute = True, use_dask = False, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_write_region[3-False-True-False-False] _________ 1135s 1135s self = 1135s consolidated = False, compute = False, use_dask = True, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-False-True-False-True] _________ 1135s 1135s self = 1135s consolidated = True, compute = False, use_dask = True, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-False-True-False-None] _________ 1135s 1135s self = 1135s consolidated = None, compute = False, use_dask = True, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-False-True-True-False] _________ 1135s 1135s self = 1135s consolidated = False, compute = True, use_dask = True, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-False-True-True-True] __________ 1135s 1135s self = 1135s consolidated = True, compute = True, use_dask = True, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-False-True-True-None] __________ 1135s 1135s self = 1135s consolidated = None, compute = True, use_dask = True, write_empty = False 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_write_region[3-True-False-False-False] _________ 1135s 1135s self = 1135s consolidated = False, compute = False, use_dask = False, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-True-False-False-True] _________ 1135s 1135s self = 1135s consolidated = True, compute = False, use_dask = False, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-True-False-False-None] _________ 1135s 1135s self = 1135s consolidated = None, compute = False, use_dask = False, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-True-False-True-False] _________ 1135s 1135s self = 1135s consolidated = False, compute = True, use_dask = False, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-True-False-True-True] __________ 1135s 1135s self = 1135s consolidated = True, compute = True, use_dask = False, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-True-False-True-None] __________ 1135s 1135s self = 1135s consolidated = None, compute = True, use_dask = False, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-True-True-False-False] _________ 1135s 1135s self = 1135s consolidated = False, compute = False, use_dask = True, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-True-True-False-True] __________ 1135s 1135s self = 1135s consolidated = True, compute = False, use_dask = True, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-True-True-False-None] __________ 1135s 1135s self = 1135s consolidated = None, compute = False, use_dask = True, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-True-True-True-False] __________ 1135s 1135s self = 1135s consolidated = False, compute = True, use_dask = True, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s __________ TestZarrDictStore.test_write_region[3-True-True-True-True] __________ 1135s 1135s self = 1135s consolidated = True, compute = True, use_dask = True, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s __________ TestZarrDictStore.test_write_region[3-True-True-True-None] __________ 1135s 1135s self = 1135s consolidated = None, compute = True, use_dask = True, write_empty = True 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s > with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1135s ds = open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1135s backend_ds = backend.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1135s ds = store_entrypoint.open_dataset( 1135s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1135s vars, attrs = filename_or_obj.load() 1135s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1135s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1135s return Frozen(dict(*args, **kwargs)) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1135s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s ________ TestZarrDictStore.test_write_region[3-None-False-False-False] _________ 1135s 1135s self = 1135s consolidated = False, compute = False, use_dask = False, write_empty = None 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1135s if self.zarr_group.metadata.zarr_format == 3: 1135s encoding.update({"serializer": zarr_array.serializer}) 1135s else: 1135s encoding.update( 1135s { 1135s "compressor": zarr_array.compressor, 1135s "filters": zarr_array.filters, 1135s } 1135s ) 1135s 1135s if self._use_zarr_fill_value_as_mask: 1135s # Setting this attribute triggers CF decoding for missing values 1135s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1135s if zarr_array.fill_value is not None: 1135s attributes["_FillValue"] = zarr_array.fill_value 1135s elif "_FillValue" in attributes: 1135s original_zarr_dtype = zarr_array.metadata.data_type 1135s attributes["_FillValue"] = FillValueCoder.decode( 1135s > attributes["_FillValue"], original_zarr_dtype.value 1135s ) 1135s E AttributeError: 'Float64' object has no attribute 'value' 1135s 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1135s _________ TestZarrDictStore.test_write_region[3-None-False-False-True] _________ 1135s 1135s self = 1135s consolidated = True, compute = False, use_dask = False, write_empty = None 1135s 1135s @pytest.mark.parametrize("consolidated", [False, True, None]) 1135s @pytest.mark.parametrize("compute", [False, True]) 1135s @pytest.mark.parametrize("use_dask", [False, True]) 1135s @pytest.mark.parametrize("write_empty", [False, True, None]) 1135s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1135s if (use_dask or not compute) and not has_dask: 1135s pytest.skip("requires dask") 1135s 1135s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1135s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1135s 1135s if use_dask: 1135s zeros = zeros.chunk(2) 1135s nonzeros = nonzeros.chunk(2) 1135s 1135s with self.create_zarr_target() as store: 1135s zeros.to_zarr( 1135s store, 1135s consolidated=consolidated, 1135s compute=compute, 1135s encoding={"u": dict(chunks=2)}, 1135s **self.version_kwargs, 1135s ) 1135s if compute: 1135s with xr.open_zarr( 1135s store, consolidated=consolidated, **self.version_kwargs 1135s ) as actual: 1135s assert_identical(actual, zeros) 1135s for i in range(0, 10, 2): 1135s region = {"x": slice(i, i + 2)} 1135s > nonzeros.isel(region).to_zarr( 1135s store, 1135s region=region, 1135s consolidated=consolidated, 1135s write_empty_chunks=write_empty, 1135s **self.version_kwargs, 1135s ) 1135s 1135s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1135s return to_zarr( # type: ignore[call-overload,misc] 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1135s dump_to_store(dataset, zstore, writer, encoding=encoding) 1135s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1135s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1135s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1135s k: self.open_store_variable(name=k) for k in existing_variable_names 1135s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1135s 1135s self = , name = 'u' 1135s 1135s def open_store_variable(self, name): 1135s zarr_array = self.members[name] 1135s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1135s try_nczarr = self._mode == "r" 1135s dimensions, attributes = _get_zarr_dims_and_attrs( 1135s zarr_array, DIMENSION_KEY, try_nczarr 1135s ) 1135s attributes = dict(attributes) 1135s 1135s encoding = { 1135s "chunks": zarr_array.chunks, 1135s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1135s } 1135s 1135s if _zarr_v3(): 1135s encoding.update( 1135s { 1135s "compressors": zarr_array.compressors, 1135s "filters": zarr_array.filters, 1135s "shards": zarr_array.shards, 1135s } 1135s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDictStore.test_write_region[3-None-False-False-None] _________ 1136s 1136s self = 1136s consolidated = None, compute = False, use_dask = False, write_empty = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s assert_identical(actual, zeros) 1136s for i in range(0, 10, 2): 1136s region = {"x": slice(i, i + 2)} 1136s > nonzeros.isel(region).to_zarr( 1136s store, 1136s region=region, 1136s consolidated=consolidated, 1136s write_empty_chunks=write_empty, 1136s **self.version_kwargs, 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDictStore.test_write_region[3-None-False-True-False] _________ 1136s 1136s self = 1136s consolidated = False, compute = True, use_dask = False, write_empty = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDictStore.test_write_region[3-None-False-True-True] __________ 1136s 1136s self = 1136s consolidated = True, compute = True, use_dask = False, write_empty = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDictStore.test_write_region[3-None-False-True-None] __________ 1136s 1136s self = 1136s consolidated = None, compute = True, use_dask = False, write_empty = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDictStore.test_write_region[3-None-True-False-False] _________ 1136s 1136s self = 1136s consolidated = False, compute = False, use_dask = True, write_empty = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s assert_identical(actual, zeros) 1136s for i in range(0, 10, 2): 1136s region = {"x": slice(i, i + 2)} 1136s > nonzeros.isel(region).to_zarr( 1136s store, 1136s region=region, 1136s consolidated=consolidated, 1136s write_empty_chunks=write_empty, 1136s **self.version_kwargs, 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDictStore.test_write_region[3-None-True-False-True] __________ 1136s 1136s self = 1136s consolidated = True, compute = False, use_dask = True, write_empty = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s assert_identical(actual, zeros) 1136s for i in range(0, 10, 2): 1136s region = {"x": slice(i, i + 2)} 1136s > nonzeros.isel(region).to_zarr( 1136s store, 1136s region=region, 1136s consolidated=consolidated, 1136s write_empty_chunks=write_empty, 1136s **self.version_kwargs, 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDictStore.test_write_region[3-None-True-False-None] __________ 1136s 1136s self = 1136s consolidated = None, compute = False, use_dask = True, write_empty = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s assert_identical(actual, zeros) 1136s for i in range(0, 10, 2): 1136s region = {"x": slice(i, i + 2)} 1136s > nonzeros.isel(region).to_zarr( 1136s store, 1136s region=region, 1136s consolidated=consolidated, 1136s write_empty_chunks=write_empty, 1136s **self.version_kwargs, 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDictStore.test_write_region[3-None-True-True-False] __________ 1136s 1136s self = 1136s consolidated = False, compute = True, use_dask = True, write_empty = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s __________ TestZarrDictStore.test_write_region[3-None-True-True-True] __________ 1136s 1136s self = 1136s consolidated = True, compute = True, use_dask = True, write_empty = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s __________ TestZarrDictStore.test_write_region[3-None-True-True-None] __________ 1136s 1136s self = 1136s consolidated = None, compute = True, use_dask = True, write_empty = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _______________ TestZarrDictStore.test_write_region_mode[3-None] _______________ 1136s 1136s self = 1136s mode = None 1136s 1136s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1136s def test_write_region_mode(self, mode) -> None: 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr(store, **self.version_kwargs) 1136s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1136s > nonzeros.isel(region).to_zarr( 1136s store, region=region, mode=mode, **self.version_kwargs 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________________ TestZarrDictStore.test_write_region_mode[3-r+] ________________ 1136s 1136s self = 1136s mode = 'r+' 1136s 1136s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1136s def test_write_region_mode(self, mode) -> None: 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr(store, **self.version_kwargs) 1136s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1136s > nonzeros.isel(region).to_zarr( 1136s store, region=region, mode=mode, **self.version_kwargs 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________________ TestZarrDictStore.test_write_region_mode[3-a] _________________ 1136s 1136s self = 1136s mode = 'a' 1136s 1136s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1136s def test_write_region_mode(self, mode) -> None: 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr(store, **self.version_kwargs) 1136s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1136s > nonzeros.isel(region).to_zarr( 1136s store, region=region, mode=mode, **self.version_kwargs 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________ TestZarrDictStore.test_write_preexisting_override_metadata[3] _________ 1136s 1136s self = 1136s 1136s @requires_dask 1136s def test_write_preexisting_override_metadata(self) -> None: 1136s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1136s original = Dataset( 1136s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1136s attrs={"global": "original"}, 1136s ) 1136s both_modified = Dataset( 1136s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1136s attrs={"global": "modified"}, 1136s ) 1136s global_modified = Dataset( 1136s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1136s attrs={"global": "modified"}, 1136s ) 1136s only_new_data = Dataset( 1136s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1136s attrs={"global": "original"}, 1136s ) 1136s 1136s with self.create_zarr_target() as store: 1136s original.to_zarr(store, compute=False, **self.version_kwargs) 1136s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________________ TestZarrDictStore.test_encoding_chunksizes[3] _________________ 1136s 1136s self = 1136s 1136s @requires_dask 1136s def test_encoding_chunksizes(self) -> None: 1136s # regression test for GH2278 1136s # see also test_encoding_chunksizes_unlimited 1136s nx, ny, nt = 4, 4, 5 1136s original = xr.Dataset( 1136s {}, 1136s coords={ 1136s "x": np.arange(nx), 1136s "y": np.arange(ny), 1136s "t": np.arange(nt), 1136s }, 1136s ) 1136s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1136s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1136s 1136s > with self.roundtrip(original) as ds1: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'v' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDictStore.test_chunk_encoding_with_partial_dask_chunks[3] _______ 1136s 1136s self = 1136s 1136s @requires_dask 1136s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1136s original = xr.Dataset( 1136s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1136s ).chunk({"a": 3}) 1136s 1136s > with self.roundtrip( 1136s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1136s ) as ds1: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________________ TestZarrDictStore.test_open_zarr_use_cftime[3] ________________ 1136s 1136s self = 1136s 1136s @requires_cftime 1136s def test_open_zarr_use_cftime(self) -> None: 1136s ds = create_test_data() 1136s with self.create_zarr_target() as store_target: 1136s ds.to_zarr(store_target, **self.version_kwargs) 1136s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDictStore.test_write_read_select_write[3] _______________ 1136s 1136s self = 1136s 1136s def test_write_read_select_write(self) -> None: 1136s # Test for https://github.com/pydata/xarray/issues/4084 1136s ds = create_test_data() 1136s 1136s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1136s with self.create_zarr_target() as initial_store: 1136s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1136s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s __________________ TestZarrDictStore.test_attributes[3-obj1] ___________________ 1136s 1136s self = 1136s obj = Size: 8B 1136s array(nan) 1136s Attributes: 1136s good: {'key': 'value'} 1136s 1136s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1136s def test_attributes(self, obj) -> None: 1136s obj = obj.copy() 1136s 1136s obj.attrs["good"] = {"key": "value"} 1136s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1136s with self.create_zarr_target() as store_target: 1136s ds.to_zarr(store_target, **self.version_kwargs) 1136s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'foo' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s __ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 1136s 1136s self = 1136s dtype = 'datetime64[ns]' 1136s 1136s @requires_dask 1136s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1136s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1136s # Generalized from @malmans2's test in PR #8253 1136s original = create_test_data().astype(dtype).chunk(1) 1136s > with self.roundtrip( 1136s original, 1136s open_kwargs={ 1136s "chunks": {}, 1136s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1136s }, 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] __ 1136s 1136s self = 1136s dtype = 'timedelta64[ns]' 1136s 1136s @requires_dask 1136s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1136s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1136s # Generalized from @malmans2's test in PR #8253 1136s original = create_test_data().astype(dtype).chunk(1) 1136s > with self.roundtrip( 1136s original, 1136s open_kwargs={ 1136s "chunks": {}, 1136s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1136s }, 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ___________ TestZarrDictStore.test_zarr_fill_value_setting[3-float] ____________ 1136s 1136s self = 1136s dtype = 1136s 1136s @requires_dask 1136s @pytest.mark.parametrize("dtype", [int, float]) 1136s def test_zarr_fill_value_setting(self, dtype): 1136s # When zarr_format=2, _FillValue sets fill_value 1136s # When zarr_format=3, fill_value is set independently 1136s # We test this by writing a dask array with compute=False, 1136s # on read we should receive chunks filled with `fill_value` 1136s fv = -1 1136s ds = xr.Dataset( 1136s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1136s ) 1136s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1136s 1136s zarr_format_2 = ( 1136s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1136s ) or not has_zarr_v3 1136s if zarr_format_2: 1136s attr = "_FillValue" 1136s expected.foo.attrs[attr] = fv 1136s else: 1136s attr = "fill_value" 1136s if dtype is float: 1136s # for floats, Xarray inserts a default `np.nan` 1136s expected.foo.attrs["_FillValue"] = np.nan 1136s 1136s # turn off all decoding so we see what Zarr returns to us. 1136s # Since chunks, are not written, we should receive on `fill_value` 1136s open_kwargs = { 1136s "mask_and_scale": False, 1136s "consolidated": False, 1136s "use_zarr_fill_value_as_mask": False, 1136s } 1136s save_kwargs = dict(compute=False, consolidated=False) 1136s > with self.roundtrip( 1136s ds, 1136s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1136s open_kwargs=open_kwargs, 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'foo' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ___________ TestZarrDirectoryStore.test_zero_dimensional_variable[3] ___________ 1136s 1136s self = 1136s 1136s def test_zero_dimensional_variable(self) -> None: 1136s expected = create_test_data() 1136s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1136s expected["bytes_var"] = ([], b"foobar") 1136s expected["string_var"] = ([], "foobar") 1136s > with self.roundtrip(expected) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s __________________ TestZarrDirectoryStore.test_write_store[3] __________________ 1136s 1136s self = 1136s 1136s def test_write_store(self) -> None: 1136s expected = create_test_data() 1136s with self.create_store() as store: 1136s expected.dump_to_store(store) 1136s # we need to cf decode the store because it has time and 1136s # non-dimension coordinates 1136s > with xr.decode_cf(store) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1136s vars, attrs = obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDirectoryStore.test_roundtrip_test_data[3] ______________ 1136s 1136s self = 1136s 1136s def test_roundtrip_test_data(self) -> None: 1136s expected = create_test_data() 1136s > with self.roundtrip(expected) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _____________________ TestZarrDirectoryStore.test_load[3] ______________________ 1136s 1136s self = 1136s 1136s def test_load(self) -> None: 1136s expected = create_test_data() 1136s 1136s @contextlib.contextmanager 1136s def assert_loads(vars=None): 1136s if vars is None: 1136s vars = expected 1136s with self.roundtrip(expected) as actual: 1136s for k, v in actual.variables.items(): 1136s # IndexVariables are eagerly loaded into memory 1136s assert v._in_memory == (k in actual.dims) 1136s yield actual 1136s for k, v in actual.variables.items(): 1136s if k in vars: 1136s assert v._in_memory 1136s assert_identical(expected, actual) 1136s 1136s with pytest.raises(AssertionError): 1136s # make sure the contextmanager works! 1136s > with assert_loads() as ds: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1136s with self.roundtrip(expected) as actual: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________________ TestZarrDirectoryStore.test_dataset_compute[3] ________________ 1136s 1136s self = 1136s 1136s def test_dataset_compute(self) -> None: 1136s expected = create_test_data() 1136s 1136s > with self.roundtrip(expected) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ____________ TestZarrDirectoryStore.test_roundtrip_object_dtype[3] _____________ 1136s 1136s self = 1136s 1136s def test_roundtrip_object_dtype(self) -> None: 1136s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1136s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1136s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1136s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1136s strings = np.array(["ab", "cdef", "g"], dtype=object) 1136s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1136s all_nans = np.array([np.nan, np.nan], dtype=object) 1136s original = Dataset( 1136s { 1136s "floats": ("a", floats), 1136s "floats_nans": ("a", floats_nans), 1136s "bytes": ("b", bytes_), 1136s "bytes_nans": ("b", bytes_nans), 1136s "strings": ("b", strings), 1136s "strings_nans": ("b", strings_nans), 1136s "all_nans": ("c", all_nans), 1136s "nan": ([], np.nan), 1136s } 1136s ) 1136s expected = original.copy(deep=True) 1136s > with self.roundtrip(original) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'nan' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ____________ TestZarrDirectoryStore.test_roundtrip_float64_data[3] _____________ 1136s 1136s self = 1136s 1136s def test_roundtrip_float64_data(self) -> None: 1136s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1136s > with self.roundtrip(expected) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDirectoryStore.test_orthogonal_indexing[3] ______________ 1136s 1136s self = 1136s 1136s def test_orthogonal_indexing(self) -> None: 1136s in_memory = create_test_data() 1136s > with self.roundtrip(in_memory) as on_disk: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDirectoryStore.test_vectorized_indexing[3] ______________ 1136s 1136s self = 1136s 1136s def test_vectorized_indexing(self) -> None: 1136s in_memory = create_test_data() 1136s > with self.roundtrip(in_memory) as on_disk: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _______ TestZarrDirectoryStore.test_vectorized_indexing_negative_step[3] _______ 1136s 1136s self = 1136s 1136s def test_vectorized_indexing_negative_step(self) -> None: 1136s # use dask explicitly when present 1136s open_kwargs: dict[str, Any] | None 1136s if has_dask: 1136s open_kwargs = {"chunks": {}} 1136s else: 1136s open_kwargs = None 1136s in_memory = create_test_data() 1136s 1136s def multiple_indexing(indexers): 1136s # make sure a sequence of lazy indexings certainly works. 1136s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1136s actual = on_disk["var3"] 1136s expected = in_memory["var3"] 1136s for ind in indexers: 1136s actual = actual.isel(ind) 1136s expected = expected.isel(ind) 1136s # make sure the array is not yet loaded into memory 1136s assert not actual.variable._in_memory 1136s assert_identical(expected, actual.load()) 1136s 1136s # with negative step slice. 1136s indexers = [ 1136s { 1136s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1136s "dim3": slice(-1, 1, -1), 1136s } 1136s ] 1136s > multiple_indexing(indexers) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1136s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ____________ TestZarrDirectoryStore.test_outer_indexing_reversed[3] ____________ 1136s 1136s self = 1136s 1136s def test_outer_indexing_reversed(self) -> None: 1136s # regression test for GH6560 1136s ds = xr.Dataset( 1136s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1136s ) 1136s 1136s > with self.roundtrip(ds) as on_disk: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'z' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________________ TestZarrDirectoryStore.test_isel_dataarray[3] _________________ 1136s 1136s self = 1136s 1136s def test_isel_dataarray(self) -> None: 1136s # Make sure isel works lazily. GH:issue:1688 1136s in_memory = create_test_data() 1136s > with self.roundtrip(in_memory) as on_disk: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ___________ TestZarrDirectoryStore.test_array_type_after_indexing[3] ___________ 1136s 1136s self = 1136s 1136s def test_array_type_after_indexing(self) -> None: 1136s in_memory = create_test_data() 1136s > with self.roundtrip(in_memory) as on_disk: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ____________________ TestZarrDirectoryStore.test_dropna[3] _____________________ 1136s 1136s self = 1136s 1136s def test_dropna(self) -> None: 1136s # regression test for GH:issue:1694 1136s a = np.random.randn(4, 3) 1136s a[1, 1] = np.nan 1136s in_memory = xr.Dataset( 1136s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1136s ) 1136s 1136s assert_identical( 1136s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1136s ) 1136s 1136s > with self.roundtrip(in_memory) as on_disk: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'a' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDirectoryStore.test_ondisk_after_print[3] _______________ 1136s 1136s self = 1136s 1136s def test_ondisk_after_print(self) -> None: 1136s """Make sure print does not load file into memory""" 1136s in_memory = create_test_data() 1136s > with self.roundtrip(in_memory) as on_disk: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________ TestZarrDirectoryStore.test_roundtrip_bytes_with_fill_value[3] ________ 1136s 1136s self = 1136s 1136s def test_roundtrip_bytes_with_fill_value(self) -> None: 1136s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1136s encoding = {"_FillValue": b"X", "dtype": "S1"} 1136s original = Dataset({"x": ("t", values, {}, encoding)}) 1136s expected = original.copy(deep=True) 1136s > with self.roundtrip(original) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _____ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value0-False] ______ 1136s 1136s self = 1136s fill_value = np.int8(-1), exp_fill_warning = False 1136s 1136s @pytest.mark.parametrize( 1136s ("fill_value", "exp_fill_warning"), 1136s [ 1136s (np.int8(-1), False), 1136s (np.uint8(255), True), 1136s (-1, False), 1136s (255, True), 1136s ], 1136s ) 1136s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1136s @contextlib.contextmanager 1136s def _roundtrip_with_warnings(*args, **kwargs): 1136s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1136s if exp_fill_warning and is_np2: 1136s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1136s SerializationWarning, 1136s match="_FillValue attribute can't be represented", 1136s ) 1136s else: 1136s warn_checker = contextlib.nullcontext() 1136s with warn_checker: 1136s with self.roundtrip(*args, **kwargs) as actual: 1136s yield actual 1136s 1136s # regression/numpy2 test for 1136s encoding = { 1136s "_FillValue": fill_value, 1136s "_Unsigned": "true", 1136s "dtype": "i1", 1136s } 1136s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1136s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1136s 1136s attributes = { 1136s "_FillValue": fill_value, 1136s "_Unsigned": "true", 1136s } 1136s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1136s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1136s encoded = Dataset({"x": ("t", sb, attributes)}) 1136s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1136s 1136s > with _roundtrip_with_warnings(decoded) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1136s with self.roundtrip(*args, **kwargs) as actual: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Int8' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value1-True] ______ 1136s 1136s self = 1136s fill_value = np.uint8(255), exp_fill_warning = True 1136s 1136s @pytest.mark.parametrize( 1136s ("fill_value", "exp_fill_warning"), 1136s [ 1136s (np.int8(-1), False), 1136s (np.uint8(255), True), 1136s (-1, False), 1136s (255, True), 1136s ], 1136s ) 1136s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1136s @contextlib.contextmanager 1136s def _roundtrip_with_warnings(*args, **kwargs): 1136s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1136s if exp_fill_warning and is_np2: 1136s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1136s SerializationWarning, 1136s match="_FillValue attribute can't be represented", 1136s ) 1136s else: 1136s warn_checker = contextlib.nullcontext() 1136s with warn_checker: 1136s with self.roundtrip(*args, **kwargs) as actual: 1136s yield actual 1136s 1136s # regression/numpy2 test for 1136s encoding = { 1136s "_FillValue": fill_value, 1136s "_Unsigned": "true", 1136s "dtype": "i1", 1136s } 1136s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1136s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1136s 1136s attributes = { 1136s "_FillValue": fill_value, 1136s "_Unsigned": "true", 1136s } 1136s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1136s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1136s encoded = Dataset({"x": ("t", sb, attributes)}) 1136s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1136s 1136s > with _roundtrip_with_warnings(decoded) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1136s with self.roundtrip(*args, **kwargs) as actual: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Int8' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3--1-False] __________ 1136s 1136s self = 1136s fill_value = -1, exp_fill_warning = False 1136s 1136s @pytest.mark.parametrize( 1136s ("fill_value", "exp_fill_warning"), 1136s [ 1136s (np.int8(-1), False), 1136s (np.uint8(255), True), 1136s (-1, False), 1136s (255, True), 1136s ], 1136s ) 1136s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1136s @contextlib.contextmanager 1136s def _roundtrip_with_warnings(*args, **kwargs): 1136s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1136s if exp_fill_warning and is_np2: 1136s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1136s SerializationWarning, 1136s match="_FillValue attribute can't be represented", 1136s ) 1136s else: 1136s warn_checker = contextlib.nullcontext() 1136s with warn_checker: 1136s with self.roundtrip(*args, **kwargs) as actual: 1136s yield actual 1136s 1136s # regression/numpy2 test for 1136s encoding = { 1136s "_FillValue": fill_value, 1136s "_Unsigned": "true", 1136s "dtype": "i1", 1136s } 1136s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1136s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1136s 1136s attributes = { 1136s "_FillValue": fill_value, 1136s "_Unsigned": "true", 1136s } 1136s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1136s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1136s encoded = Dataset({"x": ("t", sb, attributes)}) 1136s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1136s 1136s > with _roundtrip_with_warnings(decoded) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1136s with self.roundtrip(*args, **kwargs) as actual: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Int8' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3-255-True] __________ 1136s 1136s self = 1136s fill_value = 255, exp_fill_warning = True 1136s 1136s @pytest.mark.parametrize( 1136s ("fill_value", "exp_fill_warning"), 1136s [ 1136s (np.int8(-1), False), 1136s (np.uint8(255), True), 1136s (-1, False), 1136s (255, True), 1136s ], 1136s ) 1136s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1136s @contextlib.contextmanager 1136s def _roundtrip_with_warnings(*args, **kwargs): 1136s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1136s if exp_fill_warning and is_np2: 1136s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1136s SerializationWarning, 1136s match="_FillValue attribute can't be represented", 1136s ) 1136s else: 1136s warn_checker = contextlib.nullcontext() 1136s with warn_checker: 1136s with self.roundtrip(*args, **kwargs) as actual: 1136s yield actual 1136s 1136s # regression/numpy2 test for 1136s encoding = { 1136s "_FillValue": fill_value, 1136s "_Unsigned": "true", 1136s "dtype": "i1", 1136s } 1136s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1136s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1136s 1136s attributes = { 1136s "_FillValue": fill_value, 1136s "_Unsigned": "true", 1136s } 1136s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1136s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1136s encoded = Dataset({"x": ("t", sb, attributes)}) 1136s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1136s 1136s > with _roundtrip_with_warnings(decoded) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1136s with self.roundtrip(*args, **kwargs) as actual: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Int8' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1136s 1136s self = 1136s 1136s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1136s original = self._create_cf_dataset() 1136s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = 1136s name = 'det_lim' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _ TestZarrDirectoryStore.test_coordinate_variables_after_dataset_roundtrip[3] __ 1136s 1136s self = 1136s 1136s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1136s original = self._create_cf_dataset() 1136s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = 1136s name = 'det_lim' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1136s 1136s self = 1136s 1136s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1136s self, 1136s ) -> None: 1136s original = self._create_cf_dataset() 1136s # The DataArray roundtrip should have the same warnings as the 1136s # Dataset, but we already tested for those, so just go for the 1136s # new warnings. It would appear that there is no way to tell 1136s # pytest "This warning and also this warning should both be 1136s # present". 1136s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1136s # needs the to_dataset. The other backends should be fine 1136s # without it. 1136s with pytest.warns( 1136s UserWarning, 1136s match=( 1136s r"Variable\(s\) referenced in bounds not in variables: " 1136s r"\['l(at|ong)itude_bnds'\]" 1136s ), 1136s ): 1136s > with self.roundtrip( 1136s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'ln_p' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s 1136s During handling of the above exception, another exception occurred: 1136s 1136s self = 1136s 1136s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1136s self, 1136s ) -> None: 1136s original = self._create_cf_dataset() 1136s # The DataArray roundtrip should have the same warnings as the 1136s # Dataset, but we already tested for those, so just go for the 1136s # new warnings. It would appear that there is no way to tell 1136s # pytest "This warning and also this warning should both be 1136s # present". 1136s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1136s # needs the to_dataset. The other backends should be fine 1136s # without it. 1136s > with pytest.warns( 1136s UserWarning, 1136s match=( 1136s r"Variable\(s\) referenced in bounds not in variables: " 1136s r"\['l(at|ong)itude_bnds'\]" 1136s ), 1136s ): 1136s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1136s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1136s E Emitted warnings: [ ZarrUserWarning('Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future.')]. 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1136s ________________ TestZarrDirectoryStore.test_encoding_kwarg[3] _________________ 1136s 1136s self = 1136s 1136s def test_encoding_kwarg(self) -> None: 1136s ds = Dataset({"x": ("y", np.arange(10.0))}) 1136s 1136s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1136s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float32' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDirectoryStore.test_default_fill_value[3] _______________ 1136s 1136s self = 1136s 1136s def test_default_fill_value(self) -> None: 1136s # Test default encoding for float: 1136s ds = Dataset({"x": ("y", np.arange(10.0))}) 1136s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1136s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float32' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord[3] ______ 1136s 1136s self = 1136s 1136s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1136s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1136s ds.y.encoding["_FillValue"] = None 1136s > with self.roundtrip(ds) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1136s 1136s self = 1136s 1136s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1136s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1136s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1136s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDirectoryStore.test_encoding_same_dtype[3] ______________ 1136s 1136s self = 1136s 1136s def test_encoding_same_dtype(self) -> None: 1136s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1136s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1136s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float32' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ____________ TestZarrDirectoryStore.test_append_overwrite_values[3] ____________ 1136s 1136s self = 1136s 1136s def test_append_overwrite_values(self) -> None: 1136s # regression for GH1215 1136s data = create_test_data() 1136s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1136s self.save(data, tmp_file, mode="w") 1136s data["var2"][:] = -999 1136s data["var9"] = data["var2"] * 3 1136s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1136s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-False] __________ 1136s 1136s self = 1136s consolidated = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s def test_roundtrip_consolidated(self, consolidated) -> None: 1136s expected = create_test_data() 1136s > with self.roundtrip( 1136s expected, 1136s save_kwargs={"consolidated": consolidated}, 1136s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-True] __________ 1136s 1136s self = 1136s consolidated = True 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s def test_roundtrip_consolidated(self, consolidated) -> None: 1136s expected = create_test_data() 1136s > with self.roundtrip( 1136s expected, 1136s save_kwargs={"consolidated": consolidated}, 1136s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-None] __________ 1136s 1136s self = 1136s consolidated = None 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s def test_roundtrip_consolidated(self, consolidated) -> None: 1136s expected = create_test_data() 1136s > with self.roundtrip( 1136s expected, 1136s save_kwargs={"consolidated": consolidated}, 1136s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDirectoryStore.test_read_non_consolidated_warning[3] _________ 1136s 1136s self = 1136s 1136s def test_read_non_consolidated_warning(self) -> None: 1136s expected = create_test_data() 1136s with self.create_zarr_target() as store: 1136s self.save( 1136s expected, store_target=store, consolidated=False, **self.version_kwargs 1136s ) 1136s with pytest.warns( 1136s RuntimeWarning, 1136s match="Failed to open Zarr store with consolidated", 1136s ): 1136s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDirectoryStore.test_non_existent_store[3] _______________ 1136s 1136s self = 1136s 1136s def test_non_existent_store(self) -> None: 1136s with pytest.raises( 1136s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1136s ): 1136s > xr.open_zarr(f"{uuid.uuid4()}") 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1136s store = ZarrStore.open_group( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1136s ) = _get_open_params( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1136s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1136s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1136s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1136s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1136s raise return_result 1136s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1136s return await coro 1136s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1136s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1136s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1136s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1136s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1136s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1136s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1136s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1136s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1136s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1136s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1136s await store._open() 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/a509e581-c399-44cd-9667-83dff029d8f7') 1136s 1136s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1136s if not self.read_only: 1136s self.root.mkdir(parents=True, exist_ok=True) 1136s 1136s if not self.root.exists(): 1136s > raise FileNotFoundError(f"{self.root} does not exist") 1136s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/a509e581-c399-44cd-9667-83dff029d8f7 does not exist 1136s 1136s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1136s 1136s During handling of the above exception, another exception occurred: 1136s 1136s self = 1136s 1136s def test_non_existent_store(self) -> None: 1136s > with pytest.raises( 1136s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1136s ): 1136s E AssertionError: Regex pattern did not match. 1136s E Regex: '(No such file or directory|Unable to find group)' 1136s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/a509e581-c399-44cd-9667-83dff029d8f7 does not exist' 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1136s __________________ TestZarrDirectoryStore.test_auto_chunk[3] ___________________ 1136s 1136s self = 1136s 1136s @requires_dask 1136s def test_auto_chunk(self) -> None: 1136s original = create_test_data().chunk() 1136s 1136s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________________ TestZarrDirectoryStore.test_manual_chunk[3] __________________ 1136s 1136s self = 1136s 1136s @requires_dask 1136s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1136s def test_manual_chunk(self) -> None: 1136s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1136s 1136s # Using chunks = None should return non-chunked arrays 1136s open_kwargs: dict[str, Any] = {"chunks": None} 1136s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _____________ TestZarrDirectoryStore.test_warning_on_bad_chunks[3] _____________ 1136s 1136s self = 1136s 1136s @requires_dask 1136s def test_warning_on_bad_chunks(self) -> None: 1136s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1136s 1136s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1136s for chunks in bad_chunks: 1136s kwargs = {"chunks": chunks} 1136s with pytest.warns(UserWarning): 1136s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ___________ TestZarrDirectoryStore.test_write_uneven_dask_chunks[3] ____________ 1136s 1136s self = 1136s 1136s @requires_dask 1136s def test_write_uneven_dask_chunks(self) -> None: 1136s # regression for GH#2225 1136s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1136s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________________ TestZarrDirectoryStore.test_chunk_encoding[3] _________________ 1136s 1136s self = 1136s 1136s def test_chunk_encoding(self) -> None: 1136s # These datasets have no dask chunks. All chunking specified in 1136s # encoding 1136s data = create_test_data() 1136s chunks = (5, 5) 1136s data["var2"].encoding.update({"chunks": chunks}) 1136s 1136s > with self.roundtrip(data) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________________ TestZarrDirectoryStore.test_shard_encoding[3] _________________ 1136s 1136s self = 1136s 1136s def test_shard_encoding(self) -> None: 1136s # These datasets have no dask chunks. All chunking/sharding specified in 1136s # encoding 1136s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1136s data = create_test_data() 1136s chunks = (1, 1) 1136s shards = (5, 5) 1136s data["var2"].encoding.update({"chunks": chunks}) 1136s data["var2"].encoding.update({"shards": shards}) 1136s > with self.roundtrip(data) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________ TestZarrDirectoryStore.test_write_persistence_modes[3-None] __________ 1136s 1136s self = 1136s group = None 1136s 1136s @pytest.mark.parametrize("group", [None, "group1"]) 1136s def test_write_persistence_modes(self, group) -> None: 1136s original = create_test_data() 1136s 1136s # overwrite mode 1136s > with self.roundtrip( 1136s original, 1136s save_kwargs={"mode": "w", "group": group}, 1136s open_kwargs={"group": group}, 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________ TestZarrDirectoryStore.test_write_persistence_modes[3-group1] _________ 1136s 1136s self = 1136s group = 'group1' 1136s 1136s @pytest.mark.parametrize("group", [None, "group1"]) 1136s def test_write_persistence_modes(self, group) -> None: 1136s original = create_test_data() 1136s 1136s # overwrite mode 1136s > with self.roundtrip( 1136s original, 1136s save_kwargs={"mode": "w", "group": group}, 1136s open_kwargs={"group": group}, 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDirectoryStore.test_compressor_encoding[3] ______________ 1136s 1136s self = 1136s 1136s def test_compressor_encoding(self) -> None: 1136s # specify a custom compressor 1136s original = create_test_data() 1136s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1136s encoding_key = "compressors" 1136s # all parameters need to be explicitly specified in order for the comparison to pass below 1136s encoding = { 1136s "serializer": zarr.codecs.BytesCodec(endian="little"), 1136s encoding_key: ( 1136s zarr.codecs.BloscCodec( 1136s cname="zstd", 1136s clevel=3, 1136s shuffle="shuffle", 1136s typesize=8, 1136s blocksize=0, 1136s ), 1136s ), 1136s } 1136s else: 1136s from numcodecs.blosc import Blosc 1136s 1136s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1136s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1136s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1136s 1136s save_kwargs = dict(encoding={"var1": encoding}) 1136s 1136s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _____________________ TestZarrDirectoryStore.test_group[3] _____________________ 1136s 1136s self = 1136s 1136s def test_group(self) -> None: 1136s original = create_test_data() 1136s group = "some/random/path" 1136s > with self.roundtrip( 1136s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _________________ TestZarrDirectoryStore.test_append_write[3] __________________ 1136s 1136s self = 1136s 1136s def test_append_write(self) -> None: 1136s > super().test_append_write() 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1136s with self.roundtrip_append(data) as actual: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1136s self.save(data[[key]], path, mode=mode, **save_kwargs) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1136s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _____ TestZarrDirectoryStore.test_append_with_append_dim_not_set_raises[3] _____ 1136s 1136s self = 1136s 1136s def test_append_with_append_dim_not_set_raises(self) -> None: 1136s ds, ds_to_append, _ = create_append_test_data() 1136s with self.create_zarr_target() as store_target: 1136s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1136s with pytest.raises(ValueError, match="different dimension sizes"): 1136s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'da' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _____ TestZarrDirectoryStore.test_append_string_length_mismatch_works[3-U] _____ 1136s 1136s self = 1136s dtype = 'U' 1136s 1136s @pytest.mark.parametrize("dtype", ["U", "S"]) 1136s def test_append_string_length_mismatch_works(self, dtype) -> None: 1136s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1136s # ...but it probably would if we used object dtype 1136s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1136s expected = xr.concat([ds, ds_to_append], dim="time") 1136s with self.create_zarr_target() as store_target: 1136s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1136s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1136s _validate_datatypes_for_zarr_append( 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s vname = 'temperature' 1136s existing_var = Size: 24B 1136s [3 values with dtype= Size: 60B 1136s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 1136s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1136s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1136s f"dataset to append has dtype {new_var.dtype}." 1136s ) 1136s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 1136s dtype = 'S' 1136s 1136s @pytest.mark.parametrize("dtype", ["U", "S"]) 1136s def test_append_string_length_mismatch_works(self, dtype) -> None: 1136s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1136s # ...but it probably would if we used object dtype 1136s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1136s expected = xr.concat([ds, ds_to_append], dim="time") 1136s with self.create_zarr_target() as store_target: 1136s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1136s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1136s _validate_datatypes_for_zarr_append( 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s vname = 'temperature' 1136s existing_var = Size: 6B 1136s [3 values with dtype=|S2] 1136s new_var = Size: 9B 1136s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1136s 1136s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1136s """If variable exists in the store, confirm dtype of the data to append is compatible with 1136s existing dtype. 1136s """ 1136s if ( 1136s np.issubdtype(new_var.dtype, np.number) 1136s or np.issubdtype(new_var.dtype, np.datetime64) 1136s or np.issubdtype(new_var.dtype, np.bool_) 1136s or new_var.dtype == object 1136s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1136s ): 1136s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1136s # new to the dataset, because in this case there is no existing var to compare it to; 1136s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1136s # we can be confident appending won't cause problems. Examples of dtypes which are not 1136s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1136s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1136s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1136s f"dataset to append has dtype {new_var.dtype}." 1136s ) 1136s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype |S2 but dataset to append has dtype |S3. 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1136s ___ TestZarrDirectoryStore.test_check_encoding_is_consistent_after_append[3] ___ 1136s 1136s self = 1136s 1136s def test_check_encoding_is_consistent_after_append(self) -> None: 1136s ds, ds_to_append, _ = create_append_test_data() 1136s 1136s # check encoding consistency 1136s with self.create_zarr_target() as store_target: 1136s import numcodecs 1136s 1136s encoding_value: Any 1136s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1136s compressor = zarr.codecs.BloscCodec() 1136s else: 1136s compressor = numcodecs.Blosc() 1136s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1136s encoding_value = (compressor,) if has_zarr_v3 else compressor 1136s 1136s encoding = {"da": {encoding_key: encoding_value}} 1136s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1136s > original_ds = xr.open_dataset( 1136s store_target, engine="zarr", **self.version_kwargs 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'da' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ___________ TestZarrDirectoryStore.test_append_with_new_variable[3] ____________ 1136s 1136s self = 1136s 1136s def test_append_with_new_variable(self) -> None: 1136s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1136s 1136s # check append mode for new variable 1136s with self.create_zarr_target() as store_target: 1136s combined = xr.concat([ds, ds_to_append], dim="time") 1136s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1136s assert_identical( 1136s combined, 1136s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'da' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_append_with_append_dim_no_overwrite[3] ______ 1136s 1136s self = 1136s 1136s def test_append_with_append_dim_no_overwrite(self) -> None: 1136s ds, ds_to_append, _ = create_append_test_data() 1136s with self.create_zarr_target() as store_target: 1136s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1136s original = xr.concat([ds, ds_to_append], dim="time") 1136s original2 = xr.concat([original, ds_to_append], dim="time") 1136s 1136s # overwrite a coordinate; 1136s # for mode='a-', this will not get written to the store 1136s # because it does not have the append_dim as a dim 1136s lon = ds_to_append.lon.to_numpy().copy() 1136s lon[:] = -999 1136s ds_to_append["lon"] = lon 1136s > ds_to_append.to_zarr( 1136s store_target, mode="a-", append_dim="time", **self.version_kwargs 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'da' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ________ TestZarrDirectoryStore.test_to_zarr_compute_false_roundtrip[3] ________ 1136s 1136s self = 1136s 1136s @requires_dask 1136s def test_to_zarr_compute_false_roundtrip(self) -> None: 1136s from dask.delayed import Delayed 1136s 1136s original = create_test_data().chunk() 1136s 1136s with self.create_zarr_target() as store: 1136s delayed_obj = self.save(original, store, compute=False) 1136s assert isinstance(delayed_obj, Delayed) 1136s 1136s # make sure target store has not been written to yet 1136s with pytest.raises(AssertionError): 1136s > with self.open(store) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'dim2' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ____ TestZarrDirectoryStore.test_to_zarr_append_compute_false_roundtrip[3] _____ 1136s 1136s self = 1136s 1136s @requires_dask 1136s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1136s from dask.delayed import Delayed 1136s 1136s ds, ds_to_append, _ = create_append_test_data() 1136s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1136s 1136s with pytest.warns(SerializationWarning): 1136s with self.create_zarr_target() as store: 1136s delayed_obj = self.save(ds, store, compute=False, mode="w") 1136s assert isinstance(delayed_obj, Delayed) 1136s 1136s with pytest.raises(AssertionError): 1136s > with self.open(store) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'da' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDirectoryStore.test_save_emptydim[3-False] ______________ 1136s 1136s self = 1136s chunk = False 1136s 1136s @pytest.mark.parametrize("chunk", [False, True]) 1136s def test_save_emptydim(self, chunk) -> None: 1136s if chunk and not has_dask: 1136s pytest.skip("requires dask") 1136s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1136s if chunk: 1136s ds = ds.chunk({}) # chunk dataset to save dask array 1136s > with self.roundtrip(ds) as ds_reload: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______________ TestZarrDirectoryStore.test_save_emptydim[3-True] _______________ 1136s 1136s self = 1136s chunk = True 1136s 1136s @pytest.mark.parametrize("chunk", [False, True]) 1136s def test_save_emptydim(self, chunk) -> None: 1136s if chunk and not has_dask: 1136s pytest.skip("requires dask") 1136s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1136s if chunk: 1136s ds = ds.chunk({}) # chunk dataset to save dask array 1136s > with self.roundtrip(ds) as ds_reload: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ___ TestZarrDirectoryStore.test_no_warning_from_open_emptydim_with_chunks[3] ___ 1136s 1136s self = 1136s 1136s @requires_dask 1136s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1136s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1136s with assert_no_warnings(): 1136s with warnings.catch_warnings(): 1136s warnings.filterwarnings( 1136s "ignore", 1136s message=".*Zarr format 3 specification.*", 1136s category=UserWarning, 1136s ) 1136s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1136s with self.open(store_target, **open_kwargs) as ds: 1136s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1136s return next(self.gen) 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1136s with xr.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'x' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _____ TestZarrDirectoryStore.test_write_region[3-False-False-False-False] ______ 1136s 1136s self = 1136s consolidated = False, compute = False, use_dask = False, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s assert_identical(actual, zeros) 1136s for i in range(0, 10, 2): 1136s region = {"x": slice(i, i + 2)} 1136s > nonzeros.isel(region).to_zarr( 1136s store, 1136s region=region, 1136s consolidated=consolidated, 1136s write_empty_chunks=write_empty, 1136s **self.version_kwargs, 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-True] ______ 1136s 1136s self = 1136s consolidated = True, compute = False, use_dask = False, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s assert_identical(actual, zeros) 1136s for i in range(0, 10, 2): 1136s region = {"x": slice(i, i + 2)} 1136s > nonzeros.isel(region).to_zarr( 1136s store, 1136s region=region, 1136s consolidated=consolidated, 1136s write_empty_chunks=write_empty, 1136s **self.version_kwargs, 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-None] ______ 1136s 1136s self = 1136s consolidated = None, compute = False, use_dask = False, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s assert_identical(actual, zeros) 1136s for i in range(0, 10, 2): 1136s region = {"x": slice(i, i + 2)} 1136s > nonzeros.isel(region).to_zarr( 1136s store, 1136s region=region, 1136s consolidated=consolidated, 1136s write_empty_chunks=write_empty, 1136s **self.version_kwargs, 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-False] ______ 1136s 1136s self = 1136s consolidated = False, compute = True, use_dask = False, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-True] _______ 1136s 1136s self = 1136s consolidated = True, compute = True, use_dask = False, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-None] _______ 1136s 1136s self = 1136s consolidated = None, compute = True, use_dask = False, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-False] ______ 1136s 1136s self = 1136s consolidated = False, compute = False, use_dask = True, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s assert_identical(actual, zeros) 1136s for i in range(0, 10, 2): 1136s region = {"x": slice(i, i + 2)} 1136s > nonzeros.isel(region).to_zarr( 1136s store, 1136s region=region, 1136s consolidated=consolidated, 1136s write_empty_chunks=write_empty, 1136s **self.version_kwargs, 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-True] _______ 1136s 1136s self = 1136s consolidated = True, compute = False, use_dask = True, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s assert_identical(actual, zeros) 1136s for i in range(0, 10, 2): 1136s region = {"x": slice(i, i + 2)} 1136s > nonzeros.isel(region).to_zarr( 1136s store, 1136s region=region, 1136s consolidated=consolidated, 1136s write_empty_chunks=write_empty, 1136s **self.version_kwargs, 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-None] _______ 1136s 1136s self = 1136s consolidated = None, compute = False, use_dask = True, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s assert_identical(actual, zeros) 1136s for i in range(0, 10, 2): 1136s region = {"x": slice(i, i + 2)} 1136s > nonzeros.isel(region).to_zarr( 1136s store, 1136s region=region, 1136s consolidated=consolidated, 1136s write_empty_chunks=write_empty, 1136s **self.version_kwargs, 1136s ) 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1136s return to_zarr( # type: ignore[call-overload,misc] 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1136s dump_to_store(dataset, zstore, writer, encoding=encoding) 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1136s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1136s k: self.open_store_variable(name=k) for k in existing_variable_names 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s ______ TestZarrDirectoryStore.test_write_region[3-False-True-True-False] _______ 1136s 1136s self = 1136s consolidated = False, compute = True, use_dask = True, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1136s ) 1136s 1136s if self._use_zarr_fill_value_as_mask: 1136s # Setting this attribute triggers CF decoding for missing values 1136s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1136s if zarr_array.fill_value is not None: 1136s attributes["_FillValue"] = zarr_array.fill_value 1136s elif "_FillValue" in attributes: 1136s original_zarr_dtype = zarr_array.metadata.data_type 1136s attributes["_FillValue"] = FillValueCoder.decode( 1136s > attributes["_FillValue"], original_zarr_dtype.value 1136s ) 1136s E AttributeError: 'Float64' object has no attribute 'value' 1136s 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1136s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-True] _______ 1136s 1136s self = 1136s consolidated = True, compute = True, use_dask = True, write_empty = False 1136s 1136s @pytest.mark.parametrize("consolidated", [False, True, None]) 1136s @pytest.mark.parametrize("compute", [False, True]) 1136s @pytest.mark.parametrize("use_dask", [False, True]) 1136s @pytest.mark.parametrize("write_empty", [False, True, None]) 1136s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1136s if (use_dask or not compute) and not has_dask: 1136s pytest.skip("requires dask") 1136s 1136s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1136s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1136s 1136s if use_dask: 1136s zeros = zeros.chunk(2) 1136s nonzeros = nonzeros.chunk(2) 1136s 1136s with self.create_zarr_target() as store: 1136s zeros.to_zarr( 1136s store, 1136s consolidated=consolidated, 1136s compute=compute, 1136s encoding={"u": dict(chunks=2)}, 1136s **self.version_kwargs, 1136s ) 1136s if compute: 1136s > with xr.open_zarr( 1136s store, consolidated=consolidated, **self.version_kwargs 1136s ) as actual: 1136s 1136s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1136s ds = open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1136s backend_ds = backend.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1136s ds = store_entrypoint.open_dataset( 1136s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1136s vars, attrs = filename_or_obj.load() 1136s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1136s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1136s return Frozen(dict(*args, **kwargs)) 1136s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1136s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1136s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1136s 1136s self = , name = 'u' 1136s 1136s def open_store_variable(self, name): 1136s zarr_array = self.members[name] 1136s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1136s try_nczarr = self._mode == "r" 1136s dimensions, attributes = _get_zarr_dims_and_attrs( 1136s zarr_array, DIMENSION_KEY, try_nczarr 1136s ) 1136s attributes = dict(attributes) 1136s 1136s encoding = { 1136s "chunks": zarr_array.chunks, 1136s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1136s } 1136s 1136s if _zarr_v3(): 1136s encoding.update( 1136s { 1136s "compressors": zarr_array.compressors, 1136s "filters": zarr_array.filters, 1136s "shards": zarr_array.shards, 1136s } 1136s ) 1136s if self.zarr_group.metadata.zarr_format == 3: 1136s encoding.update({"serializer": zarr_array.serializer}) 1136s else: 1136s encoding.update( 1136s { 1136s "compressor": zarr_array.compressor, 1136s "filters": zarr_array.filters, 1136s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-None] _______ 1137s 1137s self = 1137s consolidated = None, compute = True, use_dask = True, write_empty = False 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-False] ______ 1137s 1137s self = 1137s consolidated = False, compute = False, use_dask = False, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-True] _______ 1137s 1137s self = 1137s consolidated = True, compute = False, use_dask = False, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-None] _______ 1137s 1137s self = 1137s consolidated = None, compute = False, use_dask = False, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_region[3-True-False-True-False] _______ 1137s 1137s self = 1137s consolidated = False, compute = True, use_dask = False, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-True] _______ 1137s 1137s self = 1137s consolidated = True, compute = True, use_dask = False, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-None] _______ 1137s 1137s self = 1137s consolidated = None, compute = True, use_dask = False, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_region[3-True-True-False-False] _______ 1137s 1137s self = 1137s consolidated = False, compute = False, use_dask = True, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-True] _______ 1137s 1137s self = 1137s consolidated = True, compute = False, use_dask = True, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-None] _______ 1137s 1137s self = 1137s consolidated = None, compute = False, use_dask = True, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-False] _______ 1137s 1137s self = 1137s consolidated = False, compute = True, use_dask = True, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-True] ________ 1137s 1137s self = 1137s consolidated = True, compute = True, use_dask = True, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-None] ________ 1137s 1137s self = 1137s consolidated = None, compute = True, use_dask = True, write_empty = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-False] ______ 1137s 1137s self = 1137s consolidated = False, compute = False, use_dask = False, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-True] _______ 1137s 1137s self = 1137s consolidated = True, compute = False, use_dask = False, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-None] _______ 1137s 1137s self = 1137s consolidated = None, compute = False, use_dask = False, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_region[3-None-False-True-False] _______ 1137s 1137s self = 1137s consolidated = False, compute = True, use_dask = False, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-True] _______ 1137s 1137s self = 1137s consolidated = True, compute = True, use_dask = False, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-None] _______ 1137s 1137s self = 1137s consolidated = None, compute = True, use_dask = False, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_region[3-None-True-False-False] _______ 1137s 1137s self = 1137s consolidated = False, compute = False, use_dask = True, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-True] _______ 1137s 1137s self = 1137s consolidated = True, compute = False, use_dask = True, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-None] _______ 1137s 1137s self = 1137s consolidated = None, compute = False, use_dask = True, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s assert_identical(actual, zeros) 1137s for i in range(0, 10, 2): 1137s region = {"x": slice(i, i + 2)} 1137s > nonzeros.isel(region).to_zarr( 1137s store, 1137s region=region, 1137s consolidated=consolidated, 1137s write_empty_chunks=write_empty, 1137s **self.version_kwargs, 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-False] _______ 1137s 1137s self = 1137s consolidated = False, compute = True, use_dask = True, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-True] ________ 1137s 1137s self = 1137s consolidated = True, compute = True, use_dask = True, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-None] ________ 1137s 1137s self = 1137s consolidated = None, compute = True, use_dask = True, write_empty = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s @pytest.mark.parametrize("compute", [False, True]) 1137s @pytest.mark.parametrize("use_dask", [False, True]) 1137s @pytest.mark.parametrize("write_empty", [False, True, None]) 1137s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1137s if (use_dask or not compute) and not has_dask: 1137s pytest.skip("requires dask") 1137s 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s 1137s if use_dask: 1137s zeros = zeros.chunk(2) 1137s nonzeros = nonzeros.chunk(2) 1137s 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr( 1137s store, 1137s consolidated=consolidated, 1137s compute=compute, 1137s encoding={"u": dict(chunks=2)}, 1137s **self.version_kwargs, 1137s ) 1137s if compute: 1137s > with xr.open_zarr( 1137s store, consolidated=consolidated, **self.version_kwargs 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ____________ TestZarrDirectoryStore.test_write_region_mode[3-None] _____________ 1137s 1137s self = 1137s mode = None 1137s 1137s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1137s def test_write_region_mode(self, mode) -> None: 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr(store, **self.version_kwargs) 1137s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1137s > nonzeros.isel(region).to_zarr( 1137s store, region=region, mode=mode, **self.version_kwargs 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _____________ TestZarrDirectoryStore.test_write_region_mode[3-r+] ______________ 1137s 1137s self = 1137s mode = 'r+' 1137s 1137s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1137s def test_write_region_mode(self, mode) -> None: 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr(store, **self.version_kwargs) 1137s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1137s > nonzeros.isel(region).to_zarr( 1137s store, region=region, mode=mode, **self.version_kwargs 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______________ TestZarrDirectoryStore.test_write_region_mode[3-a] ______________ 1137s 1137s self = 1137s mode = 'a' 1137s 1137s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1137s def test_write_region_mode(self, mode) -> None: 1137s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1137s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1137s with self.create_zarr_target() as store: 1137s zeros.to_zarr(store, **self.version_kwargs) 1137s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1137s > nonzeros.isel(region).to_zarr( 1137s store, region=region, mode=mode, **self.version_kwargs 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______ TestZarrDirectoryStore.test_write_preexisting_override_metadata[3] ______ 1137s 1137s self = 1137s 1137s @requires_dask 1137s def test_write_preexisting_override_metadata(self) -> None: 1137s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1137s original = Dataset( 1137s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1137s attrs={"global": "original"}, 1137s ) 1137s both_modified = Dataset( 1137s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1137s attrs={"global": "modified"}, 1137s ) 1137s global_modified = Dataset( 1137s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1137s attrs={"global": "modified"}, 1137s ) 1137s only_new_data = Dataset( 1137s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1137s attrs={"global": "original"}, 1137s ) 1137s 1137s with self.create_zarr_target() as store: 1137s original.to_zarr(store, compute=False, **self.version_kwargs) 1137s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'u' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______________ TestZarrDirectoryStore.test_encoding_chunksizes[3] ______________ 1137s 1137s self = 1137s 1137s @requires_dask 1137s def test_encoding_chunksizes(self) -> None: 1137s # regression test for GH2278 1137s # see also test_encoding_chunksizes_unlimited 1137s nx, ny, nt = 4, 4, 5 1137s original = xr.Dataset( 1137s {}, 1137s coords={ 1137s "x": np.arange(nx), 1137s "y": np.arange(ny), 1137s "t": np.arange(nt), 1137s }, 1137s ) 1137s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1137s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1137s 1137s > with self.roundtrip(original) as ds1: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'v' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ____ TestZarrDirectoryStore.test_chunk_encoding_with_partial_dask_chunks[3] ____ 1137s 1137s self = 1137s 1137s @requires_dask 1137s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1137s original = xr.Dataset( 1137s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1137s ).chunk({"a": 3}) 1137s 1137s > with self.roundtrip( 1137s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1137s ) as ds1: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _____________ TestZarrDirectoryStore.test_open_zarr_use_cftime[3] ______________ 1137s 1137s self = 1137s 1137s @requires_cftime 1137s def test_open_zarr_use_cftime(self) -> None: 1137s ds = create_test_data() 1137s with self.create_zarr_target() as store_target: 1137s ds.to_zarr(store_target, **self.version_kwargs) 1137s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ____________ TestZarrDirectoryStore.test_write_read_select_write[3] ____________ 1137s 1137s self = 1137s 1137s def test_write_read_select_write(self) -> None: 1137s # Test for https://github.com/pydata/xarray/issues/4084 1137s ds = create_test_data() 1137s 1137s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1137s with self.create_zarr_target() as initial_store: 1137s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1137s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________________ TestZarrDirectoryStore.test_attributes[3-obj1] ________________ 1137s 1137s self = 1137s obj = Size: 8B 1137s array(nan) 1137s Attributes: 1137s good: {'key': 'value'} 1137s 1137s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1137s def test_attributes(self, obj) -> None: 1137s obj = obj.copy() 1137s 1137s obj.attrs["good"] = {"key": "value"} 1137s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1137s with self.create_zarr_target() as store_target: 1137s ds.to_zarr(store_target, **self.version_kwargs) 1137s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'foo' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] _ 1137s 1137s self = 1137s dtype = 'datetime64[ns]' 1137s 1137s @requires_dask 1137s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1137s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1137s # Generalized from @malmans2's test in PR #8253 1137s original = create_test_data().astype(dtype).chunk(1) 1137s > with self.roundtrip( 1137s original, 1137s open_kwargs={ 1137s "chunks": {}, 1137s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1137s }, 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 1137s 1137s self = 1137s dtype = 'timedelta64[ns]' 1137s 1137s @requires_dask 1137s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1137s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1137s # Generalized from @malmans2's test in PR #8253 1137s original = create_test_data().astype(dtype).chunk(1) 1137s > with self.roundtrip( 1137s original, 1137s open_kwargs={ 1137s "chunks": {}, 1137s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1137s }, 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _________ TestZarrDirectoryStore.test_zarr_fill_value_setting[3-float] _________ 1137s 1137s self = 1137s dtype = 1137s 1137s @requires_dask 1137s @pytest.mark.parametrize("dtype", [int, float]) 1137s def test_zarr_fill_value_setting(self, dtype): 1137s # When zarr_format=2, _FillValue sets fill_value 1137s # When zarr_format=3, fill_value is set independently 1137s # We test this by writing a dask array with compute=False, 1137s # on read we should receive chunks filled with `fill_value` 1137s fv = -1 1137s ds = xr.Dataset( 1137s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1137s ) 1137s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1137s 1137s zarr_format_2 = ( 1137s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1137s ) or not has_zarr_v3 1137s if zarr_format_2: 1137s attr = "_FillValue" 1137s expected.foo.attrs[attr] = fv 1137s else: 1137s attr = "fill_value" 1137s if dtype is float: 1137s # for floats, Xarray inserts a default `np.nan` 1137s expected.foo.attrs["_FillValue"] = np.nan 1137s 1137s # turn off all decoding so we see what Zarr returns to us. 1137s # Since chunks, are not written, we should receive on `fill_value` 1137s open_kwargs = { 1137s "mask_and_scale": False, 1137s "consolidated": False, 1137s "use_zarr_fill_value_as_mask": False, 1137s } 1137s save_kwargs = dict(compute=False, consolidated=False) 1137s > with self.roundtrip( 1137s ds, 1137s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1137s open_kwargs=open_kwargs, 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'foo' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _____________ TestZarrWriteEmpty.test_zero_dimensional_variable[3] _____________ 1137s 1137s self = 1137s 1137s def test_zero_dimensional_variable(self) -> None: 1137s expected = create_test_data() 1137s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1137s expected["bytes_var"] = ([], b"foobar") 1137s expected["string_var"] = ([], "foobar") 1137s > with self.roundtrip(expected) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ____________________ TestZarrWriteEmpty.test_write_store[3] ____________________ 1137s 1137s self = 1137s 1137s def test_write_store(self) -> None: 1137s expected = create_test_data() 1137s with self.create_store() as store: 1137s expected.dump_to_store(store) 1137s # we need to cf decode the store because it has time and 1137s # non-dimension coordinates 1137s > with xr.decode_cf(store) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1137s vars, attrs = obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'var2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________________ TestZarrWriteEmpty.test_roundtrip_test_data[3] ________________ 1137s 1137s self = 1137s 1137s def test_roundtrip_test_data(self) -> None: 1137s expected = create_test_data() 1137s > with self.roundtrip(expected) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______________________ TestZarrWriteEmpty.test_load[3] ________________________ 1137s 1137s self = 1137s 1137s def test_load(self) -> None: 1137s expected = create_test_data() 1137s 1137s @contextlib.contextmanager 1137s def assert_loads(vars=None): 1137s if vars is None: 1137s vars = expected 1137s with self.roundtrip(expected) as actual: 1137s for k, v in actual.variables.items(): 1137s # IndexVariables are eagerly loaded into memory 1137s assert v._in_memory == (k in actual.dims) 1137s yield actual 1137s for k, v in actual.variables.items(): 1137s if k in vars: 1137s assert v._in_memory 1137s assert_identical(expected, actual) 1137s 1137s with pytest.raises(AssertionError): 1137s # make sure the contextmanager works! 1137s > with assert_loads() as ds: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1137s with self.roundtrip(expected) as actual: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s __________________ TestZarrWriteEmpty.test_dataset_compute[3] __________________ 1137s 1137s self = 1137s 1137s def test_dataset_compute(self) -> None: 1137s expected = create_test_data() 1137s 1137s > with self.roundtrip(expected) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______________ TestZarrWriteEmpty.test_roundtrip_object_dtype[3] _______________ 1137s 1137s self = 1137s 1137s def test_roundtrip_object_dtype(self) -> None: 1137s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1137s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1137s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1137s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1137s strings = np.array(["ab", "cdef", "g"], dtype=object) 1137s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1137s all_nans = np.array([np.nan, np.nan], dtype=object) 1137s original = Dataset( 1137s { 1137s "floats": ("a", floats), 1137s "floats_nans": ("a", floats_nans), 1137s "bytes": ("b", bytes_), 1137s "bytes_nans": ("b", bytes_nans), 1137s "strings": ("b", strings), 1137s "strings_nans": ("b", strings_nans), 1137s "all_nans": ("c", all_nans), 1137s "nan": ([], np.nan), 1137s } 1137s ) 1137s expected = original.copy(deep=True) 1137s > with self.roundtrip(original) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'nan' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______________ TestZarrWriteEmpty.test_roundtrip_float64_data[3] _______________ 1137s 1137s self = 1137s 1137s def test_roundtrip_float64_data(self) -> None: 1137s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1137s > with self.roundtrip(expected) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________________ TestZarrWriteEmpty.test_orthogonal_indexing[3] ________________ 1137s 1137s self = 1137s 1137s def test_orthogonal_indexing(self) -> None: 1137s in_memory = create_test_data() 1137s > with self.roundtrip(in_memory) as on_disk: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________________ TestZarrWriteEmpty.test_vectorized_indexing[3] ________________ 1137s 1137s self = 1137s 1137s def test_vectorized_indexing(self) -> None: 1137s in_memory = create_test_data() 1137s > with self.roundtrip(in_memory) as on_disk: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _________ TestZarrWriteEmpty.test_vectorized_indexing_negative_step[3] _________ 1137s 1137s self = 1137s 1137s def test_vectorized_indexing_negative_step(self) -> None: 1137s # use dask explicitly when present 1137s open_kwargs: dict[str, Any] | None 1137s if has_dask: 1137s open_kwargs = {"chunks": {}} 1137s else: 1137s open_kwargs = None 1137s in_memory = create_test_data() 1137s 1137s def multiple_indexing(indexers): 1137s # make sure a sequence of lazy indexings certainly works. 1137s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1137s actual = on_disk["var3"] 1137s expected = in_memory["var3"] 1137s for ind in indexers: 1137s actual = actual.isel(ind) 1137s expected = expected.isel(ind) 1137s # make sure the array is not yet loaded into memory 1137s assert not actual.variable._in_memory 1137s assert_identical(expected, actual.load()) 1137s 1137s # with negative step slice. 1137s indexers = [ 1137s { 1137s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1137s "dim3": slice(-1, 1, -1), 1137s } 1137s ] 1137s > multiple_indexing(indexers) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1137s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______________ TestZarrWriteEmpty.test_outer_indexing_reversed[3] ______________ 1137s 1137s self = 1137s 1137s def test_outer_indexing_reversed(self) -> None: 1137s # regression test for GH6560 1137s ds = xr.Dataset( 1137s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1137s ) 1137s 1137s > with self.roundtrip(ds) as on_disk: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'z' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s __________________ TestZarrWriteEmpty.test_isel_dataarray[3] ___________________ 1137s 1137s self = 1137s 1137s def test_isel_dataarray(self) -> None: 1137s # Make sure isel works lazily. GH:issue:1688 1137s in_memory = create_test_data() 1137s > with self.roundtrip(in_memory) as on_disk: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _____________ TestZarrWriteEmpty.test_array_type_after_indexing[3] _____________ 1137s 1137s self = 1137s 1137s def test_array_type_after_indexing(self) -> None: 1137s in_memory = create_test_data() 1137s > with self.roundtrip(in_memory) as on_disk: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______________________ TestZarrWriteEmpty.test_dropna[3] _______________________ 1137s 1137s self = 1137s 1137s def test_dropna(self) -> None: 1137s # regression test for GH:issue:1694 1137s a = np.random.randn(4, 3) 1137s a[1, 1] = np.nan 1137s in_memory = xr.Dataset( 1137s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1137s ) 1137s 1137s assert_identical( 1137s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1137s ) 1137s 1137s > with self.roundtrip(in_memory) as on_disk: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'a' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________________ TestZarrWriteEmpty.test_ondisk_after_print[3] _________________ 1137s 1137s self = 1137s 1137s def test_ondisk_after_print(self) -> None: 1137s """Make sure print does not load file into memory""" 1137s in_memory = create_test_data() 1137s > with self.roundtrip(in_memory) as on_disk: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s __________ TestZarrWriteEmpty.test_roundtrip_bytes_with_fill_value[3] __________ 1137s 1137s self = 1137s 1137s def test_roundtrip_bytes_with_fill_value(self) -> None: 1137s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1137s encoding = {"_FillValue": b"X", "dtype": "S1"} 1137s original = Dataset({"x": ("t", values, {}, encoding)}) 1137s expected = original.copy(deep=True) 1137s > with self.roundtrip(original) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value0-False] ________ 1137s 1137s self = 1137s fill_value = np.int8(-1), exp_fill_warning = False 1137s 1137s @pytest.mark.parametrize( 1137s ("fill_value", "exp_fill_warning"), 1137s [ 1137s (np.int8(-1), False), 1137s (np.uint8(255), True), 1137s (-1, False), 1137s (255, True), 1137s ], 1137s ) 1137s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1137s @contextlib.contextmanager 1137s def _roundtrip_with_warnings(*args, **kwargs): 1137s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1137s if exp_fill_warning and is_np2: 1137s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1137s SerializationWarning, 1137s match="_FillValue attribute can't be represented", 1137s ) 1137s else: 1137s warn_checker = contextlib.nullcontext() 1137s with warn_checker: 1137s with self.roundtrip(*args, **kwargs) as actual: 1137s yield actual 1137s 1137s # regression/numpy2 test for 1137s encoding = { 1137s "_FillValue": fill_value, 1137s "_Unsigned": "true", 1137s "dtype": "i1", 1137s } 1137s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1137s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1137s 1137s attributes = { 1137s "_FillValue": fill_value, 1137s "_Unsigned": "true", 1137s } 1137s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1137s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1137s encoded = Dataset({"x": ("t", sb, attributes)}) 1137s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1137s 1137s > with _roundtrip_with_warnings(decoded) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1137s with self.roundtrip(*args, **kwargs) as actual: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Int8' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value1-True] ________ 1137s 1137s self = 1137s fill_value = np.uint8(255), exp_fill_warning = True 1137s 1137s @pytest.mark.parametrize( 1137s ("fill_value", "exp_fill_warning"), 1137s [ 1137s (np.int8(-1), False), 1137s (np.uint8(255), True), 1137s (-1, False), 1137s (255, True), 1137s ], 1137s ) 1137s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1137s @contextlib.contextmanager 1137s def _roundtrip_with_warnings(*args, **kwargs): 1137s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1137s if exp_fill_warning and is_np2: 1137s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1137s SerializationWarning, 1137s match="_FillValue attribute can't be represented", 1137s ) 1137s else: 1137s warn_checker = contextlib.nullcontext() 1137s with warn_checker: 1137s with self.roundtrip(*args, **kwargs) as actual: 1137s yield actual 1137s 1137s # regression/numpy2 test for 1137s encoding = { 1137s "_FillValue": fill_value, 1137s "_Unsigned": "true", 1137s "dtype": "i1", 1137s } 1137s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1137s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1137s 1137s attributes = { 1137s "_FillValue": fill_value, 1137s "_Unsigned": "true", 1137s } 1137s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1137s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1137s encoded = Dataset({"x": ("t", sb, attributes)}) 1137s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1137s 1137s > with _roundtrip_with_warnings(decoded) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1137s with self.roundtrip(*args, **kwargs) as actual: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Int8' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3--1-False] ____________ 1137s 1137s self = 1137s fill_value = -1, exp_fill_warning = False 1137s 1137s @pytest.mark.parametrize( 1137s ("fill_value", "exp_fill_warning"), 1137s [ 1137s (np.int8(-1), False), 1137s (np.uint8(255), True), 1137s (-1, False), 1137s (255, True), 1137s ], 1137s ) 1137s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1137s @contextlib.contextmanager 1137s def _roundtrip_with_warnings(*args, **kwargs): 1137s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1137s if exp_fill_warning and is_np2: 1137s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1137s SerializationWarning, 1137s match="_FillValue attribute can't be represented", 1137s ) 1137s else: 1137s warn_checker = contextlib.nullcontext() 1137s with warn_checker: 1137s with self.roundtrip(*args, **kwargs) as actual: 1137s yield actual 1137s 1137s # regression/numpy2 test for 1137s encoding = { 1137s "_FillValue": fill_value, 1137s "_Unsigned": "true", 1137s "dtype": "i1", 1137s } 1137s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1137s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1137s 1137s attributes = { 1137s "_FillValue": fill_value, 1137s "_Unsigned": "true", 1137s } 1137s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1137s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1137s encoded = Dataset({"x": ("t", sb, attributes)}) 1137s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1137s 1137s > with _roundtrip_with_warnings(decoded) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1137s with self.roundtrip(*args, **kwargs) as actual: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Int8' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-255-True] ____________ 1137s 1137s self = 1137s fill_value = 255, exp_fill_warning = True 1137s 1137s @pytest.mark.parametrize( 1137s ("fill_value", "exp_fill_warning"), 1137s [ 1137s (np.int8(-1), False), 1137s (np.uint8(255), True), 1137s (-1, False), 1137s (255, True), 1137s ], 1137s ) 1137s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1137s @contextlib.contextmanager 1137s def _roundtrip_with_warnings(*args, **kwargs): 1137s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1137s if exp_fill_warning and is_np2: 1137s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1137s SerializationWarning, 1137s match="_FillValue attribute can't be represented", 1137s ) 1137s else: 1137s warn_checker = contextlib.nullcontext() 1137s with warn_checker: 1137s with self.roundtrip(*args, **kwargs) as actual: 1137s yield actual 1137s 1137s # regression/numpy2 test for 1137s encoding = { 1137s "_FillValue": fill_value, 1137s "_Unsigned": "true", 1137s "dtype": "i1", 1137s } 1137s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1137s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1137s 1137s attributes = { 1137s "_FillValue": fill_value, 1137s "_Unsigned": "true", 1137s } 1137s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1137s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1137s encoded = Dataset({"x": ("t", sb, attributes)}) 1137s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1137s 1137s > with _roundtrip_with_warnings(decoded) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1137s with self.roundtrip(*args, **kwargs) as actual: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Int8' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1137s 1137s self = 1137s 1137s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1137s original = self._create_cf_dataset() 1137s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = 1137s name = 'det_lim' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ___ TestZarrWriteEmpty.test_coordinate_variables_after_dataset_roundtrip[3] ____ 1137s 1137s self = 1137s 1137s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1137s original = self._create_cf_dataset() 1137s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = 1137s name = 'det_lim' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1137s 1137s self = 1137s 1137s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1137s self, 1137s ) -> None: 1137s original = self._create_cf_dataset() 1137s # The DataArray roundtrip should have the same warnings as the 1137s # Dataset, but we already tested for those, so just go for the 1137s # new warnings. It would appear that there is no way to tell 1137s # pytest "This warning and also this warning should both be 1137s # present". 1137s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1137s # needs the to_dataset. The other backends should be fine 1137s # without it. 1137s with pytest.warns( 1137s UserWarning, 1137s match=( 1137s r"Variable\(s\) referenced in bounds not in variables: " 1137s r"\['l(at|ong)itude_bnds'\]" 1137s ), 1137s ): 1137s > with self.roundtrip( 1137s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'ln_p' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s 1137s During handling of the above exception, another exception occurred: 1137s 1137s self = 1137s 1137s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1137s self, 1137s ) -> None: 1137s original = self._create_cf_dataset() 1137s # The DataArray roundtrip should have the same warnings as the 1137s # Dataset, but we already tested for those, so just go for the 1137s # new warnings. It would appear that there is no way to tell 1137s # pytest "This warning and also this warning should both be 1137s # present". 1137s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1137s # needs the to_dataset. The other backends should be fine 1137s # without it. 1137s > with pytest.warns( 1137s UserWarning, 1137s match=( 1137s r"Variable\(s\) referenced in bounds not in variables: " 1137s r"\['l(at|ong)itude_bnds'\]" 1137s ), 1137s ): 1137s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1137s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1137s E Emitted warnings: [ ZarrUserWarning('Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future.')]. 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1137s __________________ TestZarrWriteEmpty.test_encoding_kwarg[3] ___________________ 1137s 1137s self = 1137s 1137s def test_encoding_kwarg(self) -> None: 1137s ds = Dataset({"x": ("y", np.arange(10.0))}) 1137s 1137s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1137s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float32' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________________ TestZarrWriteEmpty.test_default_fill_value[3] _________________ 1137s 1137s self = 1137s 1137s def test_default_fill_value(self) -> None: 1137s # Test default encoding for float: 1137s ds = Dataset({"x": ("y", np.arange(10.0))}) 1137s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1137s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float32' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord[3] ________ 1137s 1137s self = 1137s 1137s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1137s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1137s ds.y.encoding["_FillValue"] = None 1137s > with self.roundtrip(ds) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1137s 1137s self = 1137s 1137s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1137s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1137s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1137s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________________ TestZarrWriteEmpty.test_encoding_same_dtype[3] ________________ 1137s 1137s self = 1137s 1137s def test_encoding_same_dtype(self) -> None: 1137s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1137s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1137s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'x' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float32' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ______________ TestZarrWriteEmpty.test_append_overwrite_values[3] ______________ 1137s 1137s self = 1137s 1137s def test_append_overwrite_values(self) -> None: 1137s # regression for GH1215 1137s data = create_test_data() 1137s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1137s self.save(data, tmp_file, mode="w") 1137s data["var2"][:] = -999 1137s data["var9"] = data["var2"] * 3 1137s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1137s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ___________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-False] ____________ 1137s 1137s self = 1137s consolidated = False 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s def test_roundtrip_consolidated(self, consolidated) -> None: 1137s expected = create_test_data() 1137s > with self.roundtrip( 1137s expected, 1137s save_kwargs={"consolidated": consolidated}, 1137s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-True] ____________ 1137s 1137s self = 1137s consolidated = True 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s def test_roundtrip_consolidated(self, consolidated) -> None: 1137s expected = create_test_data() 1137s > with self.roundtrip( 1137s expected, 1137s save_kwargs={"consolidated": consolidated}, 1137s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-None] ____________ 1137s 1137s self = 1137s consolidated = None 1137s 1137s @pytest.mark.parametrize("consolidated", [False, True, None]) 1137s def test_roundtrip_consolidated(self, consolidated) -> None: 1137s expected = create_test_data() 1137s > with self.roundtrip( 1137s expected, 1137s save_kwargs={"consolidated": consolidated}, 1137s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ___________ TestZarrWriteEmpty.test_read_non_consolidated_warning[3] ___________ 1137s 1137s self = 1137s 1137s def test_read_non_consolidated_warning(self) -> None: 1137s expected = create_test_data() 1137s with self.create_zarr_target() as store: 1137s self.save( 1137s expected, store_target=store, consolidated=False, **self.version_kwargs 1137s ) 1137s with pytest.warns( 1137s RuntimeWarning, 1137s match="Failed to open Zarr store with consolidated", 1137s ): 1137s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________________ TestZarrWriteEmpty.test_non_existent_store[3] _________________ 1137s 1137s self = 1137s 1137s def test_non_existent_store(self) -> None: 1137s with pytest.raises( 1137s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1137s ): 1137s > xr.open_zarr(f"{uuid.uuid4()}") 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1137s ds = open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1137s store = ZarrStore.open_group( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1137s ) = _get_open_params( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1137s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1137s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1137s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1137s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1137s raise return_result 1137s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1137s return await coro 1137s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1137s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1137s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1137s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1137s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1137s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1137s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1137s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1137s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1137s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1137s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1137s await store._open() 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/05f3aeef-3059-46a0-a844-4c4b9c2f2e80') 1137s 1137s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1137s if not self.read_only: 1137s self.root.mkdir(parents=True, exist_ok=True) 1137s 1137s if not self.root.exists(): 1137s > raise FileNotFoundError(f"{self.root} does not exist") 1137s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/05f3aeef-3059-46a0-a844-4c4b9c2f2e80 does not exist 1137s 1137s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1137s 1137s During handling of the above exception, another exception occurred: 1137s 1137s self = 1137s 1137s def test_non_existent_store(self) -> None: 1137s > with pytest.raises( 1137s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1137s ): 1137s E AssertionError: Regex pattern did not match. 1137s E Regex: '(No such file or directory|Unable to find group)' 1137s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/05f3aeef-3059-46a0-a844-4c4b9c2f2e80 does not exist' 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1137s ____________________ TestZarrWriteEmpty.test_auto_chunk[3] _____________________ 1137s 1137s self = 1137s 1137s @requires_dask 1137s def test_auto_chunk(self) -> None: 1137s original = create_test_data().chunk() 1137s 1137s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ___________________ TestZarrWriteEmpty.test_manual_chunk[3] ____________________ 1137s 1137s self = 1137s 1137s @requires_dask 1137s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1137s def test_manual_chunk(self) -> None: 1137s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1137s 1137s # Using chunks = None should return non-chunked arrays 1137s open_kwargs: dict[str, Any] = {"chunks": None} 1137s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______________ TestZarrWriteEmpty.test_warning_on_bad_chunks[3] _______________ 1137s 1137s self = 1137s 1137s @requires_dask 1137s def test_warning_on_bad_chunks(self) -> None: 1137s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1137s 1137s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1137s for chunks in bad_chunks: 1137s kwargs = {"chunks": chunks} 1137s with pytest.warns(UserWarning): 1137s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _____________ TestZarrWriteEmpty.test_write_uneven_dask_chunks[3] ______________ 1137s 1137s self = 1137s 1137s @requires_dask 1137s def test_write_uneven_dask_chunks(self) -> None: 1137s # regression for GH#2225 1137s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1137s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s __________________ TestZarrWriteEmpty.test_chunk_encoding[3] ___________________ 1137s 1137s self = 1137s 1137s def test_chunk_encoding(self) -> None: 1137s # These datasets have no dask chunks. All chunking specified in 1137s # encoding 1137s data = create_test_data() 1137s chunks = (5, 5) 1137s data["var2"].encoding.update({"chunks": chunks}) 1137s 1137s > with self.roundtrip(data) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s __________________ TestZarrWriteEmpty.test_shard_encoding[3] ___________________ 1137s 1137s self = 1137s 1137s def test_shard_encoding(self) -> None: 1137s # These datasets have no dask chunks. All chunking/sharding specified in 1137s # encoding 1137s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1137s data = create_test_data() 1137s chunks = (1, 1) 1137s shards = (5, 5) 1137s data["var2"].encoding.update({"chunks": chunks}) 1137s data["var2"].encoding.update({"shards": shards}) 1137s > with self.roundtrip(data) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ___________ TestZarrWriteEmpty.test_write_persistence_modes[3-None] ____________ 1137s 1137s self = 1137s group = None 1137s 1137s @pytest.mark.parametrize("group", [None, "group1"]) 1137s def test_write_persistence_modes(self, group) -> None: 1137s original = create_test_data() 1137s 1137s # overwrite mode 1137s > with self.roundtrip( 1137s original, 1137s save_kwargs={"mode": "w", "group": group}, 1137s open_kwargs={"group": group}, 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s __________ TestZarrWriteEmpty.test_write_persistence_modes[3-group1] ___________ 1137s 1137s self = 1137s group = 'group1' 1137s 1137s @pytest.mark.parametrize("group", [None, "group1"]) 1137s def test_write_persistence_modes(self, group) -> None: 1137s original = create_test_data() 1137s 1137s # overwrite mode 1137s > with self.roundtrip( 1137s original, 1137s save_kwargs={"mode": "w", "group": group}, 1137s open_kwargs={"group": group}, 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________________ TestZarrWriteEmpty.test_compressor_encoding[3] ________________ 1137s 1137s self = 1137s 1137s def test_compressor_encoding(self) -> None: 1137s # specify a custom compressor 1137s original = create_test_data() 1137s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1137s encoding_key = "compressors" 1137s # all parameters need to be explicitly specified in order for the comparison to pass below 1137s encoding = { 1137s "serializer": zarr.codecs.BytesCodec(endian="little"), 1137s encoding_key: ( 1137s zarr.codecs.BloscCodec( 1137s cname="zstd", 1137s clevel=3, 1137s shuffle="shuffle", 1137s typesize=8, 1137s blocksize=0, 1137s ), 1137s ), 1137s } 1137s else: 1137s from numcodecs.blosc import Blosc 1137s 1137s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1137s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1137s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1137s 1137s save_kwargs = dict(encoding={"var1": encoding}) 1137s 1137s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______________________ TestZarrWriteEmpty.test_group[3] _______________________ 1137s 1137s self = 1137s 1137s def test_group(self) -> None: 1137s original = create_test_data() 1137s group = "some/random/path" 1137s > with self.roundtrip( 1137s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1137s ) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1137s with self.open(store_target, **open_kwargs) as ds: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ___________________ TestZarrWriteEmpty.test_append_write[3] ____________________ 1137s 1137s self = 1137s 1137s def test_append_write(self) -> None: 1137s > super().test_append_write() 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1137s with self.roundtrip_append(data) as actual: 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1137s self.save(data[[key]], path, mode=mode, **save_kwargs) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1137s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'dim2' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrWriteEmpty.test_append_with_append_dim_not_set_raises[3] _______ 1137s 1137s self = 1137s 1137s def test_append_with_append_dim_not_set_raises(self) -> None: 1137s ds, ds_to_append, _ = create_append_test_data() 1137s with self.create_zarr_target() as store_target: 1137s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1137s with pytest.raises(ValueError, match="different dimension sizes"): 1137s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'da' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _______ TestZarrWriteEmpty.test_append_string_length_mismatch_works[3-U] _______ 1137s 1137s self = 1137s dtype = 'U' 1137s 1137s @pytest.mark.parametrize("dtype", ["U", "S"]) 1137s def test_append_string_length_mismatch_works(self, dtype) -> None: 1137s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1137s # ...but it probably would if we used object dtype 1137s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1137s expected = xr.concat([ds, ds_to_append], dim="time") 1137s with self.create_zarr_target() as store_target: 1137s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1137s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1137s _validate_datatypes_for_zarr_append( 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s vname = 'temperature' 1137s existing_var = Size: 24B 1137s [3 values with dtype= Size: 60B 1137s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 1137s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1137s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1137s f"dataset to append has dtype {new_var.dtype}." 1137s ) 1137s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 1137s dtype = 'S' 1137s 1137s @pytest.mark.parametrize("dtype", ["U", "S"]) 1137s def test_append_string_length_mismatch_works(self, dtype) -> None: 1137s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1137s # ...but it probably would if we used object dtype 1137s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1137s expected = xr.concat([ds, ds_to_append], dim="time") 1137s with self.create_zarr_target() as store_target: 1137s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1137s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1137s _validate_datatypes_for_zarr_append( 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s vname = 'temperature' 1137s existing_var = Size: 6B 1137s [3 values with dtype=|S2] 1137s new_var = Size: 9B 1137s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1137s 1137s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1137s """If variable exists in the store, confirm dtype of the data to append is compatible with 1137s existing dtype. 1137s """ 1137s if ( 1137s np.issubdtype(new_var.dtype, np.number) 1137s or np.issubdtype(new_var.dtype, np.datetime64) 1137s or np.issubdtype(new_var.dtype, np.bool_) 1137s or new_var.dtype == object 1137s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1137s ): 1137s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1137s # new to the dataset, because in this case there is no existing var to compare it to; 1137s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1137s # we can be confident appending won't cause problems. Examples of dtypes which are not 1137s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1137s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1137s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1137s f"dataset to append has dtype {new_var.dtype}." 1137s ) 1137s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype |S2 but dataset to append has dtype |S3. 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1137s _____ TestZarrWriteEmpty.test_check_encoding_is_consistent_after_append[3] _____ 1137s 1137s self = 1137s 1137s def test_check_encoding_is_consistent_after_append(self) -> None: 1137s ds, ds_to_append, _ = create_append_test_data() 1137s 1137s # check encoding consistency 1137s with self.create_zarr_target() as store_target: 1137s import numcodecs 1137s 1137s encoding_value: Any 1137s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1137s compressor = zarr.codecs.BloscCodec() 1137s else: 1137s compressor = numcodecs.Blosc() 1137s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1137s encoding_value = (compressor,) if has_zarr_v3 else compressor 1137s 1137s encoding = {"da": {encoding_key: encoding_value}} 1137s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1137s > original_ds = xr.open_dataset( 1137s store_target, engine="zarr", **self.version_kwargs 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'da' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s _____________ TestZarrWriteEmpty.test_append_with_new_variable[3] ______________ 1137s 1137s self = 1137s 1137s def test_append_with_new_variable(self) -> None: 1137s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1137s 1137s # check append mode for new variable 1137s with self.create_zarr_target() as store_target: 1137s combined = xr.concat([ds, ds_to_append], dim="time") 1137s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1137s assert_identical( 1137s combined, 1137s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'da' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s ________ TestZarrWriteEmpty.test_append_with_append_dim_no_overwrite[3] ________ 1137s 1137s self = 1137s 1137s def test_append_with_append_dim_no_overwrite(self) -> None: 1137s ds, ds_to_append, _ = create_append_test_data() 1137s with self.create_zarr_target() as store_target: 1137s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1137s original = xr.concat([ds, ds_to_append], dim="time") 1137s original2 = xr.concat([original, ds_to_append], dim="time") 1137s 1137s # overwrite a coordinate; 1137s # for mode='a-', this will not get written to the store 1137s # because it does not have the append_dim as a dim 1137s lon = ds_to_append.lon.to_numpy().copy() 1137s lon[:] = -999 1137s ds_to_append["lon"] = lon 1137s > ds_to_append.to_zarr( 1137s store_target, mode="a-", append_dim="time", **self.version_kwargs 1137s ) 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1137s return to_zarr( # type: ignore[call-overload,misc] 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1137s dump_to_store(dataset, zstore, writer, encoding=encoding) 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1137s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1137s k: self.open_store_variable(name=k) for k in existing_variable_names 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1137s self = , name = 'da' 1137s 1137s def open_store_variable(self, name): 1137s zarr_array = self.members[name] 1137s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1137s try_nczarr = self._mode == "r" 1137s dimensions, attributes = _get_zarr_dims_and_attrs( 1137s zarr_array, DIMENSION_KEY, try_nczarr 1137s ) 1137s attributes = dict(attributes) 1137s 1137s encoding = { 1137s "chunks": zarr_array.chunks, 1137s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1137s } 1137s 1137s if _zarr_v3(): 1137s encoding.update( 1137s { 1137s "compressors": zarr_array.compressors, 1137s "filters": zarr_array.filters, 1137s "shards": zarr_array.shards, 1137s } 1137s ) 1137s if self.zarr_group.metadata.zarr_format == 3: 1137s encoding.update({"serializer": zarr_array.serializer}) 1137s else: 1137s encoding.update( 1137s { 1137s "compressor": zarr_array.compressor, 1137s "filters": zarr_array.filters, 1137s } 1137s ) 1137s 1137s if self._use_zarr_fill_value_as_mask: 1137s # Setting this attribute triggers CF decoding for missing values 1137s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1137s if zarr_array.fill_value is not None: 1137s attributes["_FillValue"] = zarr_array.fill_value 1137s elif "_FillValue" in attributes: 1137s original_zarr_dtype = zarr_array.metadata.data_type 1137s attributes["_FillValue"] = FillValueCoder.decode( 1137s > attributes["_FillValue"], original_zarr_dtype.value 1137s ) 1137s E AttributeError: 'Float64' object has no attribute 'value' 1137s 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1137s __________ TestZarrWriteEmpty.test_to_zarr_compute_false_roundtrip[3] __________ 1137s 1137s self = 1137s 1137s @requires_dask 1137s def test_to_zarr_compute_false_roundtrip(self) -> None: 1137s from dask.delayed import Delayed 1137s 1137s original = create_test_data().chunk() 1137s 1137s with self.create_zarr_target() as store: 1137s delayed_obj = self.save(original, store, compute=False) 1137s assert isinstance(delayed_obj, Delayed) 1137s 1137s # make sure target store has not been written to yet 1137s with pytest.raises(AssertionError): 1137s > with self.open(store) as actual: 1137s 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1137s return next(self.gen) 1137s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1137s with xr.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1137s backend_ds = backend.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1137s ds = store_entrypoint.open_dataset( 1137s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1137s vars, attrs = filename_or_obj.load() 1137s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1137s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1137s return Frozen(dict(*args, **kwargs)) 1137s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1137s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1137s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1137s 1138s self = , name = 'dim2' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ______ TestZarrWriteEmpty.test_to_zarr_append_compute_false_roundtrip[3] _______ 1138s 1138s self = 1138s 1138s @requires_dask 1138s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1138s from dask.delayed import Delayed 1138s 1138s ds, ds_to_append, _ = create_append_test_data() 1138s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1138s 1138s with pytest.warns(SerializationWarning): 1138s with self.create_zarr_target() as store: 1138s delayed_obj = self.save(ds, store, compute=False, mode="w") 1138s assert isinstance(delayed_obj, Delayed) 1138s 1138s with pytest.raises(AssertionError): 1138s > with self.open(store) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1138s with xr.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'da' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________________ TestZarrWriteEmpty.test_save_emptydim[3-False] ________________ 1138s 1138s self = 1138s chunk = False 1138s 1138s @pytest.mark.parametrize("chunk", [False, True]) 1138s def test_save_emptydim(self, chunk) -> None: 1138s if chunk and not has_dask: 1138s pytest.skip("requires dask") 1138s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1138s if chunk: 1138s ds = ds.chunk({}) # chunk dataset to save dask array 1138s > with self.roundtrip(ds) as ds_reload: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1138s with self.open(store_target, **open_kwargs) as ds: 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1138s with xr.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'x' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________________ TestZarrWriteEmpty.test_save_emptydim[3-True] _________________ 1138s 1138s self = 1138s chunk = True 1138s 1138s @pytest.mark.parametrize("chunk", [False, True]) 1138s def test_save_emptydim(self, chunk) -> None: 1138s if chunk and not has_dask: 1138s pytest.skip("requires dask") 1138s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1138s if chunk: 1138s ds = ds.chunk({}) # chunk dataset to save dask array 1138s > with self.roundtrip(ds) as ds_reload: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1138s with self.open(store_target, **open_kwargs) as ds: 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1138s with xr.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'x' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _____ TestZarrWriteEmpty.test_no_warning_from_open_emptydim_with_chunks[3] _____ 1138s 1138s self = 1138s 1138s @requires_dask 1138s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1138s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1138s with assert_no_warnings(): 1138s with warnings.catch_warnings(): 1138s warnings.filterwarnings( 1138s "ignore", 1138s message=".*Zarr format 3 specification.*", 1138s category=UserWarning, 1138s ) 1138s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1138s with self.open(store_target, **open_kwargs) as ds: 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1138s with xr.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'x' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _______ TestZarrWriteEmpty.test_write_region[3-False-False-False-False] ________ 1138s 1138s self = 1138s consolidated = False, compute = False, use_dask = False, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-True] ________ 1138s 1138s self = 1138s consolidated = True, compute = False, use_dask = False, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-None] ________ 1138s 1138s self = 1138s consolidated = None, compute = False, use_dask = False, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-False] ________ 1138s 1138s self = 1138s consolidated = False, compute = True, use_dask = False, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-True] _________ 1138s 1138s self = 1138s consolidated = True, compute = True, use_dask = False, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-None] _________ 1138s 1138s self = 1138s consolidated = None, compute = True, use_dask = False, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-False] ________ 1138s 1138s self = 1138s consolidated = False, compute = False, use_dask = True, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-True] _________ 1138s 1138s self = 1138s consolidated = True, compute = False, use_dask = True, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-None] _________ 1138s 1138s self = 1138s consolidated = None, compute = False, use_dask = True, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-False-True-True-False] _________ 1138s 1138s self = 1138s consolidated = False, compute = True, use_dask = True, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-True] _________ 1138s 1138s self = 1138s consolidated = True, compute = True, use_dask = True, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-None] _________ 1138s 1138s self = 1138s consolidated = None, compute = True, use_dask = True, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-False] ________ 1138s 1138s self = 1138s consolidated = False, compute = False, use_dask = False, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-True] _________ 1138s 1138s self = 1138s consolidated = True, compute = False, use_dask = False, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-None] _________ 1138s 1138s self = 1138s consolidated = None, compute = False, use_dask = False, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-True-False-True-False] _________ 1138s 1138s self = 1138s consolidated = False, compute = True, use_dask = False, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-True] _________ 1138s 1138s self = 1138s consolidated = True, compute = True, use_dask = False, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-None] _________ 1138s 1138s self = 1138s consolidated = None, compute = True, use_dask = False, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-True-True-False-False] _________ 1138s 1138s self = 1138s consolidated = False, compute = False, use_dask = True, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-True] _________ 1138s 1138s self = 1138s consolidated = True, compute = False, use_dask = True, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-None] _________ 1138s 1138s self = 1138s consolidated = None, compute = False, use_dask = True, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-False] _________ 1138s 1138s self = 1138s consolidated = False, compute = True, use_dask = True, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-True] __________ 1138s 1138s self = 1138s consolidated = True, compute = True, use_dask = True, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-None] __________ 1138s 1138s self = 1138s consolidated = None, compute = True, use_dask = True, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-False] ________ 1138s 1138s self = 1138s consolidated = False, compute = False, use_dask = False, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-True] _________ 1138s 1138s self = 1138s consolidated = True, compute = False, use_dask = False, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-None] _________ 1138s 1138s self = 1138s consolidated = None, compute = False, use_dask = False, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-None-False-True-False] _________ 1138s 1138s self = 1138s consolidated = False, compute = True, use_dask = False, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-True] _________ 1138s 1138s self = 1138s consolidated = True, compute = True, use_dask = False, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-None] _________ 1138s 1138s self = 1138s consolidated = None, compute = True, use_dask = False, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_region[3-None-True-False-False] _________ 1138s 1138s self = 1138s consolidated = False, compute = False, use_dask = True, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-True] _________ 1138s 1138s self = 1138s consolidated = True, compute = False, use_dask = True, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-None] _________ 1138s 1138s self = 1138s consolidated = None, compute = False, use_dask = True, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s assert_identical(actual, zeros) 1138s for i in range(0, 10, 2): 1138s region = {"x": slice(i, i + 2)} 1138s > nonzeros.isel(region).to_zarr( 1138s store, 1138s region=region, 1138s consolidated=consolidated, 1138s write_empty_chunks=write_empty, 1138s **self.version_kwargs, 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-False] _________ 1138s 1138s self = 1138s consolidated = False, compute = True, use_dask = True, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-True] __________ 1138s 1138s self = 1138s consolidated = True, compute = True, use_dask = True, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-None] __________ 1138s 1138s self = 1138s consolidated = None, compute = True, use_dask = True, write_empty = None 1138s 1138s @pytest.mark.parametrize("consolidated", [False, True, None]) 1138s @pytest.mark.parametrize("compute", [False, True]) 1138s @pytest.mark.parametrize("use_dask", [False, True]) 1138s @pytest.mark.parametrize("write_empty", [False, True, None]) 1138s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1138s if (use_dask or not compute) and not has_dask: 1138s pytest.skip("requires dask") 1138s 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s 1138s if use_dask: 1138s zeros = zeros.chunk(2) 1138s nonzeros = nonzeros.chunk(2) 1138s 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr( 1138s store, 1138s consolidated=consolidated, 1138s compute=compute, 1138s encoding={"u": dict(chunks=2)}, 1138s **self.version_kwargs, 1138s ) 1138s if compute: 1138s > with xr.open_zarr( 1138s store, consolidated=consolidated, **self.version_kwargs 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ______________ TestZarrWriteEmpty.test_write_region_mode[3-None] _______________ 1138s 1138s self = 1138s mode = None 1138s 1138s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1138s def test_write_region_mode(self, mode) -> None: 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr(store, **self.version_kwargs) 1138s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1138s > nonzeros.isel(region).to_zarr( 1138s store, region=region, mode=mode, **self.version_kwargs 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _______________ TestZarrWriteEmpty.test_write_region_mode[3-r+] ________________ 1138s 1138s self = 1138s mode = 'r+' 1138s 1138s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1138s def test_write_region_mode(self, mode) -> None: 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr(store, **self.version_kwargs) 1138s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1138s > nonzeros.isel(region).to_zarr( 1138s store, region=region, mode=mode, **self.version_kwargs 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________________ TestZarrWriteEmpty.test_write_region_mode[3-a] ________________ 1138s 1138s self = 1138s mode = 'a' 1138s 1138s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1138s def test_write_region_mode(self, mode) -> None: 1138s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1138s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1138s with self.create_zarr_target() as store: 1138s zeros.to_zarr(store, **self.version_kwargs) 1138s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1138s > nonzeros.isel(region).to_zarr( 1138s store, region=region, mode=mode, **self.version_kwargs 1138s ) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________ TestZarrWriteEmpty.test_write_preexisting_override_metadata[3] ________ 1138s 1138s self = 1138s 1138s @requires_dask 1138s def test_write_preexisting_override_metadata(self) -> None: 1138s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1138s original = Dataset( 1138s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1138s attrs={"global": "original"}, 1138s ) 1138s both_modified = Dataset( 1138s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1138s attrs={"global": "modified"}, 1138s ) 1138s global_modified = Dataset( 1138s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1138s attrs={"global": "modified"}, 1138s ) 1138s only_new_data = Dataset( 1138s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1138s attrs={"global": "original"}, 1138s ) 1138s 1138s with self.create_zarr_target() as store: 1138s original.to_zarr(store, compute=False, **self.version_kwargs) 1138s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'u' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ________________ TestZarrWriteEmpty.test_encoding_chunksizes[3] ________________ 1138s 1138s self = 1138s 1138s @requires_dask 1138s def test_encoding_chunksizes(self) -> None: 1138s # regression test for GH2278 1138s # see also test_encoding_chunksizes_unlimited 1138s nx, ny, nt = 4, 4, 5 1138s original = xr.Dataset( 1138s {}, 1138s coords={ 1138s "x": np.arange(nx), 1138s "y": np.arange(ny), 1138s "t": np.arange(nt), 1138s }, 1138s ) 1138s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1138s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1138s 1138s > with self.roundtrip(original) as ds1: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1138s with self.open(store_target, **open_kwargs) as ds: 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1138s with xr.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'v' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ______ TestZarrWriteEmpty.test_chunk_encoding_with_partial_dask_chunks[3] ______ 1138s 1138s self = 1138s 1138s @requires_dask 1138s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1138s original = xr.Dataset( 1138s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1138s ).chunk({"a": 3}) 1138s 1138s > with self.roundtrip( 1138s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1138s ) as ds1: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1138s with self.open(store_target, **open_kwargs) as ds: 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1138s with xr.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'x' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _______________ TestZarrWriteEmpty.test_open_zarr_use_cftime[3] ________________ 1138s 1138s self = 1138s 1138s @requires_cftime 1138s def test_open_zarr_use_cftime(self) -> None: 1138s ds = create_test_data() 1138s with self.create_zarr_target() as store_target: 1138s ds.to_zarr(store_target, **self.version_kwargs) 1138s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'dim2' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ______________ TestZarrWriteEmpty.test_write_read_select_write[3] ______________ 1138s 1138s self = 1138s 1138s def test_write_read_select_write(self) -> None: 1138s # Test for https://github.com/pydata/xarray/issues/4084 1138s ds = create_test_data() 1138s 1138s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1138s with self.create_zarr_target() as initial_store: 1138s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1138s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'dim2' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s __________________ TestZarrWriteEmpty.test_attributes[3-obj1] __________________ 1138s 1138s self = 1138s obj = Size: 8B 1138s array(nan) 1138s Attributes: 1138s good: {'key': 'value'} 1138s 1138s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1138s def test_attributes(self, obj) -> None: 1138s obj = obj.copy() 1138s 1138s obj.attrs["good"] = {"key": "value"} 1138s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1138s with self.create_zarr_target() as store_target: 1138s ds.to_zarr(store_target, **self.version_kwargs) 1138s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1138s ds = open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'foo' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 1138s 1138s self = 1138s dtype = 'datetime64[ns]' 1138s 1138s @requires_dask 1138s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1138s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1138s # Generalized from @malmans2's test in PR #8253 1138s original = create_test_data().astype(dtype).chunk(1) 1138s > with self.roundtrip( 1138s original, 1138s open_kwargs={ 1138s "chunks": {}, 1138s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1138s }, 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1138s with self.open(store_target, **open_kwargs) as ds: 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1138s with xr.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'dim2' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 1138s 1138s self = 1138s dtype = 'timedelta64[ns]' 1138s 1138s @requires_dask 1138s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1138s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1138s # Generalized from @malmans2's test in PR #8253 1138s original = create_test_data().astype(dtype).chunk(1) 1138s > with self.roundtrip( 1138s original, 1138s open_kwargs={ 1138s "chunks": {}, 1138s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1138s }, 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1138s with self.open(store_target, **open_kwargs) as ds: 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1138s with xr.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'dim2' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ___________ TestZarrWriteEmpty.test_zarr_fill_value_setting[3-float] ___________ 1138s 1138s self = 1138s dtype = 1138s 1138s @requires_dask 1138s @pytest.mark.parametrize("dtype", [int, float]) 1138s def test_zarr_fill_value_setting(self, dtype): 1138s # When zarr_format=2, _FillValue sets fill_value 1138s # When zarr_format=3, fill_value is set independently 1138s # We test this by writing a dask array with compute=False, 1138s # on read we should receive chunks filled with `fill_value` 1138s fv = -1 1138s ds = xr.Dataset( 1138s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1138s ) 1138s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1138s 1138s zarr_format_2 = ( 1138s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1138s ) or not has_zarr_v3 1138s if zarr_format_2: 1138s attr = "_FillValue" 1138s expected.foo.attrs[attr] = fv 1138s else: 1138s attr = "fill_value" 1138s if dtype is float: 1138s # for floats, Xarray inserts a default `np.nan` 1138s expected.foo.attrs["_FillValue"] = np.nan 1138s 1138s # turn off all decoding so we see what Zarr returns to us. 1138s # Since chunks, are not written, we should receive on `fill_value` 1138s open_kwargs = { 1138s "mask_and_scale": False, 1138s "consolidated": False, 1138s "use_zarr_fill_value_as_mask": False, 1138s } 1138s save_kwargs = dict(compute=False, consolidated=False) 1138s > with self.roundtrip( 1138s ds, 1138s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1138s open_kwargs=open_kwargs, 1138s ) as actual: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1138s with self.open(store_target, **open_kwargs) as ds: 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1138s with xr.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1138s backend_ds = backend.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1138s ds = store_entrypoint.open_dataset( 1138s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1138s vars, attrs = filename_or_obj.load() 1138s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1138s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1138s return Frozen(dict(*args, **kwargs)) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1138s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'foo' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _______________ TestZarrWriteEmpty.test_write_empty[3-True-True] _______________ 1138s 1138s self = 1138s consolidated = True, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [True, False, None]) 1138s @pytest.mark.parametrize("write_empty", [True, False, None]) 1138s def test_write_empty( 1138s self, 1138s consolidated: bool | None, 1138s write_empty: bool | None, 1138s ) -> None: 1138s def assert_expected_files(expected: list[str], store: str) -> None: 1138s """Convenience for comparing with actual files written""" 1138s ls = [] 1138s test_root = os.path.join(store, "test") 1138s for root, _, files in os.walk(test_root): 1138s ls.extend( 1138s [ 1138s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1138s for f in files 1138s ] 1138s ) 1138s 1138s assert set(expected) == set( 1138s [ 1138s file.lstrip("c/") 1138s for file in ls 1138s if (file not in (".zattrs", ".zarray", "zarr.json")) 1138s ] 1138s ) 1138s 1138s # The zarr format is set by the `default_zarr_format` 1138s # pytest fixture that acts on a superclass 1138s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1138s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1138s expected = ["0.1.0"] 1138s else: 1138s expected = [ 1138s "0.0.0", 1138s "0.0.1", 1138s "0.1.0", 1138s "0.1.1", 1138s ] 1138s 1138s if zarr_format_3: 1138s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1138s # transform to the path style of zarr 3 1138s # e.g. 0/0/1 1138s expected = [e.replace(".", "/") for e in expected] 1138s else: 1138s # use nan for default fill_value behaviour 1138s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1138s 1138s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1138s 1138s if has_dask: 1138s ds["test"] = ds["test"].chunk(1) 1138s encoding = None 1138s else: 1138s encoding = {"test": {"chunks": (1, 1, 1)}} 1138s 1138s with self.temp_dir() as (d, store): 1138s ds.to_zarr( 1138s store, 1138s mode="w", 1138s encoding=encoding, 1138s write_empty_chunks=write_empty, 1138s ) 1138s 1138s # check expected files after a write 1138s assert_expected_files(expected, store) 1138s 1138s > with self.roundtrip_dir( 1138s ds, 1138s store, 1138s save_kwargs={ 1138s "mode": "a", 1138s "append_dim": "Z", 1138s "write_empty_chunks": write_empty, 1138s }, 1138s ) as a_ds: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1138s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'test' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ______________ TestZarrWriteEmpty.test_write_empty[3-True-False] _______________ 1138s 1138s self = 1138s consolidated = False, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [True, False, None]) 1138s @pytest.mark.parametrize("write_empty", [True, False, None]) 1138s def test_write_empty( 1138s self, 1138s consolidated: bool | None, 1138s write_empty: bool | None, 1138s ) -> None: 1138s def assert_expected_files(expected: list[str], store: str) -> None: 1138s """Convenience for comparing with actual files written""" 1138s ls = [] 1138s test_root = os.path.join(store, "test") 1138s for root, _, files in os.walk(test_root): 1138s ls.extend( 1138s [ 1138s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1138s for f in files 1138s ] 1138s ) 1138s 1138s assert set(expected) == set( 1138s [ 1138s file.lstrip("c/") 1138s for file in ls 1138s if (file not in (".zattrs", ".zarray", "zarr.json")) 1138s ] 1138s ) 1138s 1138s # The zarr format is set by the `default_zarr_format` 1138s # pytest fixture that acts on a superclass 1138s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1138s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1138s expected = ["0.1.0"] 1138s else: 1138s expected = [ 1138s "0.0.0", 1138s "0.0.1", 1138s "0.1.0", 1138s "0.1.1", 1138s ] 1138s 1138s if zarr_format_3: 1138s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1138s # transform to the path style of zarr 3 1138s # e.g. 0/0/1 1138s expected = [e.replace(".", "/") for e in expected] 1138s else: 1138s # use nan for default fill_value behaviour 1138s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1138s 1138s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1138s 1138s if has_dask: 1138s ds["test"] = ds["test"].chunk(1) 1138s encoding = None 1138s else: 1138s encoding = {"test": {"chunks": (1, 1, 1)}} 1138s 1138s with self.temp_dir() as (d, store): 1138s ds.to_zarr( 1138s store, 1138s mode="w", 1138s encoding=encoding, 1138s write_empty_chunks=write_empty, 1138s ) 1138s 1138s # check expected files after a write 1138s assert_expected_files(expected, store) 1138s 1138s > with self.roundtrip_dir( 1138s ds, 1138s store, 1138s save_kwargs={ 1138s "mode": "a", 1138s "append_dim": "Z", 1138s "write_empty_chunks": write_empty, 1138s }, 1138s ) as a_ds: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1138s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'test' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s _______________ TestZarrWriteEmpty.test_write_empty[3-True-None] _______________ 1138s 1138s self = 1138s consolidated = None, write_empty = True 1138s 1138s @pytest.mark.parametrize("consolidated", [True, False, None]) 1138s @pytest.mark.parametrize("write_empty", [True, False, None]) 1138s def test_write_empty( 1138s self, 1138s consolidated: bool | None, 1138s write_empty: bool | None, 1138s ) -> None: 1138s def assert_expected_files(expected: list[str], store: str) -> None: 1138s """Convenience for comparing with actual files written""" 1138s ls = [] 1138s test_root = os.path.join(store, "test") 1138s for root, _, files in os.walk(test_root): 1138s ls.extend( 1138s [ 1138s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1138s for f in files 1138s ] 1138s ) 1138s 1138s assert set(expected) == set( 1138s [ 1138s file.lstrip("c/") 1138s for file in ls 1138s if (file not in (".zattrs", ".zarray", "zarr.json")) 1138s ] 1138s ) 1138s 1138s # The zarr format is set by the `default_zarr_format` 1138s # pytest fixture that acts on a superclass 1138s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1138s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1138s expected = ["0.1.0"] 1138s else: 1138s expected = [ 1138s "0.0.0", 1138s "0.0.1", 1138s "0.1.0", 1138s "0.1.1", 1138s ] 1138s 1138s if zarr_format_3: 1138s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1138s # transform to the path style of zarr 3 1138s # e.g. 0/0/1 1138s expected = [e.replace(".", "/") for e in expected] 1138s else: 1138s # use nan for default fill_value behaviour 1138s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1138s 1138s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1138s 1138s if has_dask: 1138s ds["test"] = ds["test"].chunk(1) 1138s encoding = None 1138s else: 1138s encoding = {"test": {"chunks": (1, 1, 1)}} 1138s 1138s with self.temp_dir() as (d, store): 1138s ds.to_zarr( 1138s store, 1138s mode="w", 1138s encoding=encoding, 1138s write_empty_chunks=write_empty, 1138s ) 1138s 1138s # check expected files after a write 1138s assert_expected_files(expected, store) 1138s 1138s > with self.roundtrip_dir( 1138s ds, 1138s store, 1138s save_kwargs={ 1138s "mode": "a", 1138s "append_dim": "Z", 1138s "write_empty_chunks": write_empty, 1138s }, 1138s ) as a_ds: 1138s 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1138s return next(self.gen) 1138s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1138s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1138s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1138s return to_zarr( # type: ignore[call-overload,misc] 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1138s dump_to_store(dataset, zstore, writer, encoding=encoding) 1138s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1138s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1138s k: self.open_store_variable(name=k) for k in existing_variable_names 1138s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1138s 1138s self = , name = 'test' 1138s 1138s def open_store_variable(self, name): 1138s zarr_array = self.members[name] 1138s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1138s try_nczarr = self._mode == "r" 1138s dimensions, attributes = _get_zarr_dims_and_attrs( 1138s zarr_array, DIMENSION_KEY, try_nczarr 1138s ) 1138s attributes = dict(attributes) 1138s 1138s encoding = { 1138s "chunks": zarr_array.chunks, 1138s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1138s } 1138s 1138s if _zarr_v3(): 1138s encoding.update( 1138s { 1138s "compressors": zarr_array.compressors, 1138s "filters": zarr_array.filters, 1138s "shards": zarr_array.shards, 1138s } 1138s ) 1138s if self.zarr_group.metadata.zarr_format == 3: 1138s encoding.update({"serializer": zarr_array.serializer}) 1138s else: 1138s encoding.update( 1138s { 1138s "compressor": zarr_array.compressor, 1138s "filters": zarr_array.filters, 1138s } 1138s ) 1138s 1138s if self._use_zarr_fill_value_as_mask: 1138s # Setting this attribute triggers CF decoding for missing values 1138s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1138s if zarr_array.fill_value is not None: 1138s attributes["_FillValue"] = zarr_array.fill_value 1138s elif "_FillValue" in attributes: 1138s original_zarr_dtype = zarr_array.metadata.data_type 1138s attributes["_FillValue"] = FillValueCoder.decode( 1138s > attributes["_FillValue"], original_zarr_dtype.value 1138s ) 1138s E AttributeError: 'Float64' object has no attribute 'value' 1138s 1138s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1138s ______________ TestZarrWriteEmpty.test_write_empty[3-False-True] _______________ 1138s 1138s self = 1138s consolidated = True, write_empty = False 1138s 1138s @pytest.mark.parametrize("consolidated", [True, False, None]) 1138s @pytest.mark.parametrize("write_empty", [True, False, None]) 1138s def test_write_empty( 1138s self, 1138s consolidated: bool | None, 1138s write_empty: bool | None, 1138s ) -> None: 1138s def assert_expected_files(expected: list[str], store: str) -> None: 1138s """Convenience for comparing with actual files written""" 1138s ls = [] 1138s test_root = os.path.join(store, "test") 1138s for root, _, files in os.walk(test_root): 1138s ls.extend( 1138s [ 1138s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1138s for f in files 1138s ] 1138s ) 1138s 1138s assert set(expected) == set( 1138s [ 1138s file.lstrip("c/") 1138s for file in ls 1138s if (file not in (".zattrs", ".zarray", "zarr.json")) 1138s ] 1138s ) 1138s 1138s # The zarr format is set by the `default_zarr_format` 1138s # pytest fixture that acts on a superclass 1138s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1138s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1138s expected = ["0.1.0"] 1138s else: 1138s expected = [ 1138s "0.0.0", 1138s "0.0.1", 1138s "0.1.0", 1138s "0.1.1", 1138s ] 1138s 1138s if zarr_format_3: 1138s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1138s # transform to the path style of zarr 3 1138s # e.g. 0/0/1 1138s expected = [e.replace(".", "/") for e in expected] 1138s else: 1138s # use nan for default fill_value behaviour 1138s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1138s 1138s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1138s 1138s if has_dask: 1138s ds["test"] = ds["test"].chunk(1) 1138s encoding = None 1138s else: 1138s encoding = {"test": {"chunks": (1, 1, 1)}} 1138s 1138s with self.temp_dir() as (d, store): 1138s ds.to_zarr( 1138s store, 1138s mode="w", 1138s encoding=encoding, 1138s write_empty_chunks=write_empty, 1138s ) 1138s 1138s # check expected files after a write 1138s assert_expected_files(expected, store) 1138s 1138s > with self.roundtrip_dir( 1138s ds, 1138s store, 1138s save_kwargs={ 1138s "mode": "a", 1138s "append_dim": "Z", 1139s "write_empty_chunks": write_empty, 1139s }, 1139s ) as a_ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1139s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'test' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s ______________ TestZarrWriteEmpty.test_write_empty[3-False-False] ______________ 1139s 1139s self = 1139s consolidated = False, write_empty = False 1139s 1139s @pytest.mark.parametrize("consolidated", [True, False, None]) 1139s @pytest.mark.parametrize("write_empty", [True, False, None]) 1139s def test_write_empty( 1139s self, 1139s consolidated: bool | None, 1139s write_empty: bool | None, 1139s ) -> None: 1139s def assert_expected_files(expected: list[str], store: str) -> None: 1139s """Convenience for comparing with actual files written""" 1139s ls = [] 1139s test_root = os.path.join(store, "test") 1139s for root, _, files in os.walk(test_root): 1139s ls.extend( 1139s [ 1139s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1139s for f in files 1139s ] 1139s ) 1139s 1139s assert set(expected) == set( 1139s [ 1139s file.lstrip("c/") 1139s for file in ls 1139s if (file not in (".zattrs", ".zarray", "zarr.json")) 1139s ] 1139s ) 1139s 1139s # The zarr format is set by the `default_zarr_format` 1139s # pytest fixture that acts on a superclass 1139s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1139s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1139s expected = ["0.1.0"] 1139s else: 1139s expected = [ 1139s "0.0.0", 1139s "0.0.1", 1139s "0.1.0", 1139s "0.1.1", 1139s ] 1139s 1139s if zarr_format_3: 1139s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1139s # transform to the path style of zarr 3 1139s # e.g. 0/0/1 1139s expected = [e.replace(".", "/") for e in expected] 1139s else: 1139s # use nan for default fill_value behaviour 1139s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1139s 1139s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1139s 1139s if has_dask: 1139s ds["test"] = ds["test"].chunk(1) 1139s encoding = None 1139s else: 1139s encoding = {"test": {"chunks": (1, 1, 1)}} 1139s 1139s with self.temp_dir() as (d, store): 1139s ds.to_zarr( 1139s store, 1139s mode="w", 1139s encoding=encoding, 1139s write_empty_chunks=write_empty, 1139s ) 1139s 1139s # check expected files after a write 1139s assert_expected_files(expected, store) 1139s 1139s > with self.roundtrip_dir( 1139s ds, 1139s store, 1139s save_kwargs={ 1139s "mode": "a", 1139s "append_dim": "Z", 1139s "write_empty_chunks": write_empty, 1139s }, 1139s ) as a_ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1139s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'test' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s ______________ TestZarrWriteEmpty.test_write_empty[3-False-None] _______________ 1139s 1139s self = 1139s consolidated = None, write_empty = False 1139s 1139s @pytest.mark.parametrize("consolidated", [True, False, None]) 1139s @pytest.mark.parametrize("write_empty", [True, False, None]) 1139s def test_write_empty( 1139s self, 1139s consolidated: bool | None, 1139s write_empty: bool | None, 1139s ) -> None: 1139s def assert_expected_files(expected: list[str], store: str) -> None: 1139s """Convenience for comparing with actual files written""" 1139s ls = [] 1139s test_root = os.path.join(store, "test") 1139s for root, _, files in os.walk(test_root): 1139s ls.extend( 1139s [ 1139s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1139s for f in files 1139s ] 1139s ) 1139s 1139s assert set(expected) == set( 1139s [ 1139s file.lstrip("c/") 1139s for file in ls 1139s if (file not in (".zattrs", ".zarray", "zarr.json")) 1139s ] 1139s ) 1139s 1139s # The zarr format is set by the `default_zarr_format` 1139s # pytest fixture that acts on a superclass 1139s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1139s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1139s expected = ["0.1.0"] 1139s else: 1139s expected = [ 1139s "0.0.0", 1139s "0.0.1", 1139s "0.1.0", 1139s "0.1.1", 1139s ] 1139s 1139s if zarr_format_3: 1139s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1139s # transform to the path style of zarr 3 1139s # e.g. 0/0/1 1139s expected = [e.replace(".", "/") for e in expected] 1139s else: 1139s # use nan for default fill_value behaviour 1139s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1139s 1139s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1139s 1139s if has_dask: 1139s ds["test"] = ds["test"].chunk(1) 1139s encoding = None 1139s else: 1139s encoding = {"test": {"chunks": (1, 1, 1)}} 1139s 1139s with self.temp_dir() as (d, store): 1139s ds.to_zarr( 1139s store, 1139s mode="w", 1139s encoding=encoding, 1139s write_empty_chunks=write_empty, 1139s ) 1139s 1139s # check expected files after a write 1139s assert_expected_files(expected, store) 1139s 1139s > with self.roundtrip_dir( 1139s ds, 1139s store, 1139s save_kwargs={ 1139s "mode": "a", 1139s "append_dim": "Z", 1139s "write_empty_chunks": write_empty, 1139s }, 1139s ) as a_ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1139s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'test' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s _______________ TestZarrWriteEmpty.test_write_empty[3-None-True] _______________ 1139s 1139s self = 1139s consolidated = True, write_empty = None 1139s 1139s @pytest.mark.parametrize("consolidated", [True, False, None]) 1139s @pytest.mark.parametrize("write_empty", [True, False, None]) 1139s def test_write_empty( 1139s self, 1139s consolidated: bool | None, 1139s write_empty: bool | None, 1139s ) -> None: 1139s def assert_expected_files(expected: list[str], store: str) -> None: 1139s """Convenience for comparing with actual files written""" 1139s ls = [] 1139s test_root = os.path.join(store, "test") 1139s for root, _, files in os.walk(test_root): 1139s ls.extend( 1139s [ 1139s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1139s for f in files 1139s ] 1139s ) 1139s 1139s assert set(expected) == set( 1139s [ 1139s file.lstrip("c/") 1139s for file in ls 1139s if (file not in (".zattrs", ".zarray", "zarr.json")) 1139s ] 1139s ) 1139s 1139s # The zarr format is set by the `default_zarr_format` 1139s # pytest fixture that acts on a superclass 1139s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1139s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1139s expected = ["0.1.0"] 1139s else: 1139s expected = [ 1139s "0.0.0", 1139s "0.0.1", 1139s "0.1.0", 1139s "0.1.1", 1139s ] 1139s 1139s if zarr_format_3: 1139s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1139s # transform to the path style of zarr 3 1139s # e.g. 0/0/1 1139s expected = [e.replace(".", "/") for e in expected] 1139s else: 1139s # use nan for default fill_value behaviour 1139s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1139s 1139s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1139s 1139s if has_dask: 1139s ds["test"] = ds["test"].chunk(1) 1139s encoding = None 1139s else: 1139s encoding = {"test": {"chunks": (1, 1, 1)}} 1139s 1139s with self.temp_dir() as (d, store): 1139s ds.to_zarr( 1139s store, 1139s mode="w", 1139s encoding=encoding, 1139s write_empty_chunks=write_empty, 1139s ) 1139s 1139s # check expected files after a write 1139s assert_expected_files(expected, store) 1139s 1139s > with self.roundtrip_dir( 1139s ds, 1139s store, 1139s save_kwargs={ 1139s "mode": "a", 1139s "append_dim": "Z", 1139s "write_empty_chunks": write_empty, 1139s }, 1139s ) as a_ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1139s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'test' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s ______________ TestZarrWriteEmpty.test_write_empty[3-None-False] _______________ 1139s 1139s self = 1139s consolidated = False, write_empty = None 1139s 1139s @pytest.mark.parametrize("consolidated", [True, False, None]) 1139s @pytest.mark.parametrize("write_empty", [True, False, None]) 1139s def test_write_empty( 1139s self, 1139s consolidated: bool | None, 1139s write_empty: bool | None, 1139s ) -> None: 1139s def assert_expected_files(expected: list[str], store: str) -> None: 1139s """Convenience for comparing with actual files written""" 1139s ls = [] 1139s test_root = os.path.join(store, "test") 1139s for root, _, files in os.walk(test_root): 1139s ls.extend( 1139s [ 1139s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1139s for f in files 1139s ] 1139s ) 1139s 1139s assert set(expected) == set( 1139s [ 1139s file.lstrip("c/") 1139s for file in ls 1139s if (file not in (".zattrs", ".zarray", "zarr.json")) 1139s ] 1139s ) 1139s 1139s # The zarr format is set by the `default_zarr_format` 1139s # pytest fixture that acts on a superclass 1139s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1139s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1139s expected = ["0.1.0"] 1139s else: 1139s expected = [ 1139s "0.0.0", 1139s "0.0.1", 1139s "0.1.0", 1139s "0.1.1", 1139s ] 1139s 1139s if zarr_format_3: 1139s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1139s # transform to the path style of zarr 3 1139s # e.g. 0/0/1 1139s expected = [e.replace(".", "/") for e in expected] 1139s else: 1139s # use nan for default fill_value behaviour 1139s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1139s 1139s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1139s 1139s if has_dask: 1139s ds["test"] = ds["test"].chunk(1) 1139s encoding = None 1139s else: 1139s encoding = {"test": {"chunks": (1, 1, 1)}} 1139s 1139s with self.temp_dir() as (d, store): 1139s ds.to_zarr( 1139s store, 1139s mode="w", 1139s encoding=encoding, 1139s write_empty_chunks=write_empty, 1139s ) 1139s 1139s # check expected files after a write 1139s assert_expected_files(expected, store) 1139s 1139s > with self.roundtrip_dir( 1139s ds, 1139s store, 1139s save_kwargs={ 1139s "mode": "a", 1139s "append_dim": "Z", 1139s "write_empty_chunks": write_empty, 1139s }, 1139s ) as a_ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1139s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'test' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s _______________ TestZarrWriteEmpty.test_write_empty[3-None-None] _______________ 1139s 1139s self = 1139s consolidated = None, write_empty = None 1139s 1139s @pytest.mark.parametrize("consolidated", [True, False, None]) 1139s @pytest.mark.parametrize("write_empty", [True, False, None]) 1139s def test_write_empty( 1139s self, 1139s consolidated: bool | None, 1139s write_empty: bool | None, 1139s ) -> None: 1139s def assert_expected_files(expected: list[str], store: str) -> None: 1139s """Convenience for comparing with actual files written""" 1139s ls = [] 1139s test_root = os.path.join(store, "test") 1139s for root, _, files in os.walk(test_root): 1139s ls.extend( 1139s [ 1139s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1139s for f in files 1139s ] 1139s ) 1139s 1139s assert set(expected) == set( 1139s [ 1139s file.lstrip("c/") 1139s for file in ls 1139s if (file not in (".zattrs", ".zarray", "zarr.json")) 1139s ] 1139s ) 1139s 1139s # The zarr format is set by the `default_zarr_format` 1139s # pytest fixture that acts on a superclass 1139s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1139s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1139s expected = ["0.1.0"] 1139s else: 1139s expected = [ 1139s "0.0.0", 1139s "0.0.1", 1139s "0.1.0", 1139s "0.1.1", 1139s ] 1139s 1139s if zarr_format_3: 1139s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1139s # transform to the path style of zarr 3 1139s # e.g. 0/0/1 1139s expected = [e.replace(".", "/") for e in expected] 1139s else: 1139s # use nan for default fill_value behaviour 1139s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1139s 1139s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1139s 1139s if has_dask: 1139s ds["test"] = ds["test"].chunk(1) 1139s encoding = None 1139s else: 1139s encoding = {"test": {"chunks": (1, 1, 1)}} 1139s 1139s with self.temp_dir() as (d, store): 1139s ds.to_zarr( 1139s store, 1139s mode="w", 1139s encoding=encoding, 1139s write_empty_chunks=write_empty, 1139s ) 1139s 1139s # check expected files after a write 1139s assert_expected_files(expected, store) 1139s 1139s > with self.roundtrip_dir( 1139s ds, 1139s store, 1139s save_kwargs={ 1139s "mode": "a", 1139s "append_dim": "Z", 1139s "write_empty_chunks": write_empty, 1139s }, 1139s ) as a_ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1139s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'test' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-full-auto] _____________ 1139s 1139s self = 1139s region = 'auto' 1139s 1139s @pytest.mark.parametrize( 1139s "region", 1139s [ 1139s pytest.param("auto", id="full-auto"), 1139s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 1139s ], 1139s ) 1139s def test_zarr_region_auto(self, region): 1139s with self.create() as (target, ds): 1139s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 1139s > self.save(target, ds_region, region=region) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1139s ds.to_zarr(target, **kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'test' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-mixed-auto] ____________ 1139s 1139s self = 1139s region = {'x': slice(np.int64(2), np.int64(4), None), 'y': slice(6, 8, None)} 1139s 1139s @pytest.mark.parametrize( 1139s "region", 1139s [ 1139s pytest.param("auto", id="full-auto"), 1139s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 1139s ], 1139s ) 1139s def test_zarr_region_auto(self, region): 1139s with self.create() as (target, ds): 1139s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 1139s > self.save(target, ds_region, region=region) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1139s ds.to_zarr(target, **kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'test' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s ______________ TestZarrRegionAuto.test_zarr_region_index_write[3] ______________ 1139s 1139s self = 1139s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_zarr_region_index_write_30') 1139s 1139s def test_zarr_region_index_write(self, tmp_path): 1139s region: Mapping[str, slice] | Literal["auto"] 1139s region_slice = dict(x=slice(2, 4), y=slice(6, 8)) 1139s 1139s with self.create() as (target, ds): 1139s ds_region = 1 + ds.isel(region_slice) 1139s for region in [region_slice, "auto"]: # type: ignore[assignment] 1139s with patch.object( 1139s ZarrStore, 1139s "set_variables", 1139s side_effect=ZarrStore.set_variables, 1139s autospec=True, 1139s ) as mock: 1139s > self.save(target, ds_region, region=region, mode="r+") 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6336: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1139s ds.to_zarr(target, **kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'test' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s ____________________ TestZarrRegionAuto.test_zarr_region[3] ____________________ 1139s 1139s self = 1139s 1139s def test_zarr_region(self): 1139s with self.create() as (target, ds): 1139s ds_transposed = ds.transpose("y", "x") 1139s ds_region = 1 + ds_transposed.isel(x=[0], y=[0]) 1139s > self.save(target, ds_region, region={"x": slice(0, 1), "y": slice(0, 1)}) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6369: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1139s ds.to_zarr(target, **kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'test' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s _____________ TestZarrRegionAuto.test_zarr_append_chunk_partial[3] _____________ 1139s 1139s self = 1139s 1139s @requires_dask 1139s def test_zarr_append_chunk_partial(self): 1139s t_coords = np.array([np.datetime64("2020-01-01").astype("datetime64[ns]")]) 1139s data = np.ones((10, 10)) 1139s 1139s da = xr.DataArray( 1139s data.reshape((-1, 10, 10)), 1139s dims=["time", "x", "y"], 1139s coords={"time": t_coords}, 1139s name="foo", 1139s ) 1139s new_time = np.array([np.datetime64("2021-01-01").astype("datetime64[ns]")]) 1139s da2 = xr.DataArray( 1139s data.reshape((-1, 10, 10)), 1139s dims=["time", "x", "y"], 1139s coords={"time": new_time}, 1139s name="foo", 1139s ) 1139s 1139s with self.create_zarr_target() as target: 1139s self.save(target, da, mode="w", encoding={"foo": {"chunks": (5, 5, 1)}}) 1139s 1139s with pytest.raises(ValueError, match="encoding was provided"): 1139s self.save( 1139s target, 1139s da2, 1139s append_dim="time", 1139s mode="a", 1139s encoding={"foo": {"chunks": (1, 1, 1)}}, 1139s ) 1139s 1139s # chunking with dask sidesteps the encoding check, so we need a different check 1139s with pytest.raises(ValueError, match="Specified zarr chunks"): 1139s > self.save( 1139s target, 1139s da2.chunk({"x": 1, "y": 1, "time": 1}), 1139s append_dim="time", 1139s mode="a", 1139s ) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6426: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1139s ds.to_zarr(target, **kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'foo' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s _________ TestZarrRegionAuto.test_zarr_region_chunk_partial_offset[3] __________ 1139s 1139s self = 1139s 1139s @requires_dask 1139s def test_zarr_region_chunk_partial_offset(self): 1139s # https://github.com/pydata/xarray/pull/8459#issuecomment-1819417545 1139s with self.create_zarr_target() as store: 1139s data = np.ones((30,)) 1139s da = xr.DataArray( 1139s data, dims=["x"], coords={"x": range(30)}, name="foo" 1139s ).chunk(x=10) 1139s self.save(store, da, compute=False) 1139s 1139s > self.save(store, da.isel(x=slice(10)).chunk(x=(10,)), region="auto") 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6443: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1139s ds.to_zarr(target, **kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'foo' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s ____________ TestZarrRegionAuto.test_zarr_safe_chunk_append_dim[3] _____________ 1139s 1139s self = 1139s 1139s @requires_dask 1139s def test_zarr_safe_chunk_append_dim(self): 1139s with self.create_zarr_target() as store: 1139s data = np.ones((20,)) 1139s da = xr.DataArray( 1139s data, dims=["x"], coords={"x": range(20)}, name="foo" 1139s ).chunk(x=5) 1139s 1139s self.save(store, da.isel(x=slice(0, 7)), safe_chunks=True, mode="w") 1139s with pytest.raises(ValueError): 1139s # If the first chunk is smaller than the border size then raise an error 1139s > self.save( 1139s store, 1139s da.isel(x=slice(7, 11)).chunk(x=(2, 2)), 1139s append_dim="x", 1139s safe_chunks=True, 1139s ) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6468: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1139s ds.to_zarr(target, **kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = , name = 'foo' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-r+] _____________ 1139s 1139s self = 1139s mode = 'r+' 1139s 1139s @requires_dask 1139s @pytest.mark.parametrize("mode", ["r+", "a"]) 1139s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 1139s with self.create_zarr_target() as store: 1139s arr = xr.DataArray( 1139s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 1139s ).chunk(a=3) 1139s self.save(store, arr, mode="w") 1139s 1139s with pytest.raises(ValueError): 1139s # There are two Dask chunks on the same Zarr chunk, 1139s # which means that it is unsafe in any mode 1139s self.save( 1139s store, 1139s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 1139s region="auto", 1139s mode=mode, 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # the first chunk is covering the border size, but it is not 1139s # completely covering the second chunk, which means that it is 1139s # unsafe in any mode 1139s self.save( 1139s store, 1139s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 1139s region="auto", 1139s mode=mode, 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # The first chunk is safe but the other two chunks are overlapping with 1139s # the same Zarr chunk 1139s self.save( 1139s store, 1139s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 1139s region="auto", 1139s mode=mode, 1139s ) 1139s 1139s # Fully update two contiguous chunks is safe in any mode 1139s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 1139s 1139s # The last chunk is considered full based on their current size (2) 1139s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 1139s self.save( 1139s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 1139s ) 1139s 1139s # Write the last chunk of a region partially is safe in "a" mode 1139s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 1139s with pytest.raises(ValueError): 1139s # with "r+" mode it is invalid to write partial chunk 1139s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 1139s 1139s # This is safe with mode "a", the border size is covered by the first chunk of Dask 1139s self.save( 1139s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 1139s ) 1139s with pytest.raises(ValueError): 1139s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 1139s self.save( 1139s store, 1139s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s # This is safe on mode "a" because there is a single dask chunk 1139s self.save( 1139s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 1139s ) 1139s with pytest.raises(ValueError): 1139s # This is unsafe on mode "r+", because the Dask chunk is partially writing 1139s # in the first chunk of Zarr 1139s self.save( 1139s store, 1139s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s # The first chunk is completely covering the first Zarr chunk 1139s # and the last chunk is a partial one 1139s self.save( 1139s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # The last chunk is partial, so it is considered unsafe on mode "r+" 1139s self.save( 1139s store, 1139s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s # The first chunk is covering the border size (2 elements) 1139s # and also the second chunk (3 elements), so it is valid 1139s self.save( 1139s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # The first chunk is not fully covering the first zarr chunk 1139s self.save( 1139s store, 1139s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # Validate that the border condition is not affecting the "r+" mode 1139s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 1139s 1139s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 1139s with pytest.raises(ValueError): 1139s # Validate that even if we write with a single Dask chunk on the last Zarr 1139s # chunk it is still unsafe if it is not fully covering it 1139s # (the last Zarr chunk has size 2) 1139s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 1139s 1139s # Validate the same as the above test but in the beginning of the last chunk 1139s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 1139s with pytest.raises(ValueError): 1139s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 1139s 1139s self.save( 1139s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 1139s ) 1139s with pytest.raises(ValueError): 1139s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 1139s # if it is partial covering other Zarr chunks 1139s self.save( 1139s store, 1139s arr.isel(a=slice(7, None)).chunk(a=-1), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # If the chunk is of size equal to the one in the Zarr encoding, but 1139s # it is partially writing in the first chunk then raise an error 1139s self.save( 1139s store, 1139s arr.isel(a=slice(8, None)).chunk(a=3), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s self.save( 1139s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 1139s ) 1139s 1139s # Test if the code is detecting the last chunk correctly 1139s data = np.random.default_rng(0).random((2920, 25, 53)) 1139s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 1139s chunks = {"time": 1000, "lat": 25, "lon": 53} 1139s self.save(store, ds.chunk(chunks), compute=False, mode="w") 1139s region = {"time": slice(1000, 2000, 1)} 1139s chunk = ds.isel(region) 1139s chunk = chunk.chunk() 1139s > self.save(store, chunk.chunk(), region=region) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1139s ds.to_zarr(target, **kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = 1139s name = 'temperature' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-a] ______________ 1139s 1139s self = 1139s mode = 'a' 1139s 1139s @requires_dask 1139s @pytest.mark.parametrize("mode", ["r+", "a"]) 1139s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 1139s with self.create_zarr_target() as store: 1139s arr = xr.DataArray( 1139s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 1139s ).chunk(a=3) 1139s self.save(store, arr, mode="w") 1139s 1139s with pytest.raises(ValueError): 1139s # There are two Dask chunks on the same Zarr chunk, 1139s # which means that it is unsafe in any mode 1139s self.save( 1139s store, 1139s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 1139s region="auto", 1139s mode=mode, 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # the first chunk is covering the border size, but it is not 1139s # completely covering the second chunk, which means that it is 1139s # unsafe in any mode 1139s self.save( 1139s store, 1139s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 1139s region="auto", 1139s mode=mode, 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # The first chunk is safe but the other two chunks are overlapping with 1139s # the same Zarr chunk 1139s self.save( 1139s store, 1139s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 1139s region="auto", 1139s mode=mode, 1139s ) 1139s 1139s # Fully update two contiguous chunks is safe in any mode 1139s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 1139s 1139s # The last chunk is considered full based on their current size (2) 1139s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 1139s self.save( 1139s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 1139s ) 1139s 1139s # Write the last chunk of a region partially is safe in "a" mode 1139s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 1139s with pytest.raises(ValueError): 1139s # with "r+" mode it is invalid to write partial chunk 1139s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 1139s 1139s # This is safe with mode "a", the border size is covered by the first chunk of Dask 1139s self.save( 1139s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 1139s ) 1139s with pytest.raises(ValueError): 1139s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 1139s self.save( 1139s store, 1139s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s # This is safe on mode "a" because there is a single dask chunk 1139s self.save( 1139s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 1139s ) 1139s with pytest.raises(ValueError): 1139s # This is unsafe on mode "r+", because the Dask chunk is partially writing 1139s # in the first chunk of Zarr 1139s self.save( 1139s store, 1139s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s # The first chunk is completely covering the first Zarr chunk 1139s # and the last chunk is a partial one 1139s self.save( 1139s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # The last chunk is partial, so it is considered unsafe on mode "r+" 1139s self.save( 1139s store, 1139s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s # The first chunk is covering the border size (2 elements) 1139s # and also the second chunk (3 elements), so it is valid 1139s self.save( 1139s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # The first chunk is not fully covering the first zarr chunk 1139s self.save( 1139s store, 1139s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # Validate that the border condition is not affecting the "r+" mode 1139s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 1139s 1139s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 1139s with pytest.raises(ValueError): 1139s # Validate that even if we write with a single Dask chunk on the last Zarr 1139s # chunk it is still unsafe if it is not fully covering it 1139s # (the last Zarr chunk has size 2) 1139s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 1139s 1139s # Validate the same as the above test but in the beginning of the last chunk 1139s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 1139s with pytest.raises(ValueError): 1139s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 1139s 1139s self.save( 1139s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 1139s ) 1139s with pytest.raises(ValueError): 1139s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 1139s # if it is partial covering other Zarr chunks 1139s self.save( 1139s store, 1139s arr.isel(a=slice(7, None)).chunk(a=-1), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s # If the chunk is of size equal to the one in the Zarr encoding, but 1139s # it is partially writing in the first chunk then raise an error 1139s self.save( 1139s store, 1139s arr.isel(a=slice(8, None)).chunk(a=3), 1139s region="auto", 1139s mode="r+", 1139s ) 1139s 1139s with pytest.raises(ValueError): 1139s self.save( 1139s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 1139s ) 1139s 1139s # Test if the code is detecting the last chunk correctly 1139s data = np.random.default_rng(0).random((2920, 25, 53)) 1139s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 1139s chunks = {"time": 1000, "lat": 25, "lon": 53} 1139s self.save(store, ds.chunk(chunks), compute=False, mode="w") 1139s region = {"time": slice(1000, 2000, 1)} 1139s chunk = ds.isel(region) 1139s chunk = chunk.chunk() 1139s > self.save(store, chunk.chunk(), region=region) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1139s ds.to_zarr(target, **kwargs) 1139s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1139s return to_zarr( # type: ignore[call-overload,misc] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1139s dump_to_store(dataset, zstore, writer, encoding=encoding) 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1139s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1139s k: self.open_store_variable(name=k) for k in existing_variable_names 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s self = 1139s name = 'temperature' 1139s 1139s def open_store_variable(self, name): 1139s zarr_array = self.members[name] 1139s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1139s try_nczarr = self._mode == "r" 1139s dimensions, attributes = _get_zarr_dims_and_attrs( 1139s zarr_array, DIMENSION_KEY, try_nczarr 1139s ) 1139s attributes = dict(attributes) 1139s 1139s encoding = { 1139s "chunks": zarr_array.chunks, 1139s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1139s } 1139s 1139s if _zarr_v3(): 1139s encoding.update( 1139s { 1139s "compressors": zarr_array.compressors, 1139s "filters": zarr_array.filters, 1139s "shards": zarr_array.shards, 1139s } 1139s ) 1139s if self.zarr_group.metadata.zarr_format == 3: 1139s encoding.update({"serializer": zarr_array.serializer}) 1139s else: 1139s encoding.update( 1139s { 1139s "compressor": zarr_array.compressor, 1139s "filters": zarr_array.filters, 1139s } 1139s ) 1139s 1139s if self._use_zarr_fill_value_as_mask: 1139s # Setting this attribute triggers CF decoding for missing values 1139s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1139s if zarr_array.fill_value is not None: 1139s attributes["_FillValue"] = zarr_array.fill_value 1139s elif "_FillValue" in attributes: 1139s original_zarr_dtype = zarr_array.metadata.data_type 1139s attributes["_FillValue"] = FillValueCoder.decode( 1139s > attributes["_FillValue"], original_zarr_dtype.value 1139s ) 1139s E AttributeError: 'Float64' object has no attribute 'value' 1139s 1139s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1139s _____________ TestScipyFilePath.test_roundtrip_example_1_netcdf_gz _____________ 1139s 1139s self = 1139s 1139s def test_roundtrip_example_1_netcdf_gz(self) -> None: 1139s with open_example_dataset("example_1.nc.gz") as expected: 1139s > with open_example_dataset("example_1.nc") as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3940: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:164: in open_example_dataset 1139s return open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _____________ TestGenericNetCDFData.test_zero_dimensional_variable _____________ 1139s 1139s self = 1139s 1139s def test_zero_dimensional_variable(self) -> None: 1139s expected = create_test_data() 1139s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1139s expected["bytes_var"] = ([], b"foobar") 1139s expected["string_var"] = ([], "foobar") 1139s > with self.roundtrip(expected) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ________________ TestGenericNetCDFData.test_roundtrip_test_data ________________ 1139s 1139s self = 1139s 1139s def test_roundtrip_test_data(self) -> None: 1139s expected = create_test_data() 1139s > with self.roundtrip(expected) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _______________________ TestGenericNetCDFData.test_load ________________________ 1139s 1139s self = 1139s 1139s def test_load(self) -> None: 1139s expected = create_test_data() 1139s 1139s @contextlib.contextmanager 1139s def assert_loads(vars=None): 1139s if vars is None: 1139s vars = expected 1139s with self.roundtrip(expected) as actual: 1139s for k, v in actual.variables.items(): 1139s # IndexVariables are eagerly loaded into memory 1139s assert v._in_memory == (k in actual.dims) 1139s yield actual 1139s for k, v in actual.variables.items(): 1139s if k in vars: 1139s assert v._in_memory 1139s assert_identical(expected, actual) 1139s 1139s with pytest.raises(AssertionError): 1139s # make sure the contextmanager works! 1139s > with assert_loads() as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1139s with self.roundtrip(expected) as actual: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s __________________ TestGenericNetCDFData.test_dataset_compute __________________ 1139s 1139s self = 1139s 1139s def test_dataset_compute(self) -> None: 1139s expected = create_test_data() 1139s 1139s > with self.roundtrip(expected) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ______________________ TestGenericNetCDFData.test_pickle _______________________ 1139s 1139s self = 1139s 1139s def test_pickle(self) -> None: 1139s expected = Dataset({"foo": ("x", [42])}) 1139s > with self.roundtrip(expected, allow_cleanup_failure=ON_WINDOWS) as roundtripped: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:499: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _________________ TestGenericNetCDFData.test_pickle_dataarray __________________ 1139s 1139s self = 1139s 1139s @pytest.mark.filterwarnings("ignore:deallocating CachingFileManager") 1139s def test_pickle_dataarray(self) -> None: 1139s expected = Dataset({"foo": ("x", [42])}) 1139s > with self.roundtrip(expected, allow_cleanup_failure=ON_WINDOWS) as roundtripped: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:509: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s __________________ TestGenericNetCDFData.test_dataset_caching __________________ 1139s 1139s self = 1139s 1139s def test_dataset_caching(self) -> None: 1139s expected = Dataset({"foo": ("x", [5, 6, 7])}) 1139s > with self.roundtrip(expected) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:519: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ______________ TestGenericNetCDFData.test_roundtrip_None_variable ______________ 1139s 1139s self = 1139s 1139s @pytest.mark.filterwarnings("ignore:deallocating CachingFileManager") 1139s def test_roundtrip_None_variable(self) -> None: 1139s expected = Dataset({None: (("x", "y"), [[0, 1], [2, 3]])}) 1139s > with self.roundtrip(expected) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:534: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ______________ TestGenericNetCDFData.test_roundtrip_object_dtype _______________ 1139s 1139s self = 1139s 1139s def test_roundtrip_object_dtype(self) -> None: 1139s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1139s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1139s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1139s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1139s strings = np.array(["ab", "cdef", "g"], dtype=object) 1139s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1139s all_nans = np.array([np.nan, np.nan], dtype=object) 1139s original = Dataset( 1139s { 1139s "floats": ("a", floats), 1139s "floats_nans": ("a", floats_nans), 1139s "bytes": ("b", bytes_), 1139s "bytes_nans": ("b", bytes_nans), 1139s "strings": ("b", strings), 1139s "strings_nans": ("b", strings_nans), 1139s "all_nans": ("c", all_nans), 1139s "nan": ([], np.nan), 1139s } 1139s ) 1139s expected = original.copy(deep=True) 1139s > with self.roundtrip(original) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _______________ TestGenericNetCDFData.test_roundtrip_string_data _______________ 1139s 1139s self = 1139s 1139s def test_roundtrip_string_data(self) -> None: 1139s expected = Dataset({"x": ("t", ["ab", "cdef"])}) 1139s > with self.roundtrip(expected) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:575: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ________ TestGenericNetCDFData.test_roundtrip_string_encoded_characters ________ 1139s 1139s self = 1139s 1139s def test_roundtrip_string_encoded_characters(self) -> None: 1139s expected = Dataset({"x": ("t", ["ab", "cdef"])}) 1139s expected["x"].encoding["dtype"] = "S1" 1139s > with self.roundtrip(expected) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:581: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ___________ TestGenericNetCDFData.test_roundtrip_numpy_datetime_data ___________ 1139s 1139s self = 1139s 1139s def test_roundtrip_numpy_datetime_data(self) -> None: 1139s times = pd.to_datetime(["2000-01-01", "2000-01-02", "NaT"], unit="ns") 1139s expected = Dataset({"t": ("t", times), "t0": times[0]}) 1139s kwargs = {"encoding": {"t0": {"units": "days since 1950-01-01"}}} 1139s > with self.roundtrip(expected, save_kwargs=kwargs) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:594: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s __________ TestGenericNetCDFData.test_roundtrip_cftime_datetime_data ___________ 1139s 1139s self = 1139s 1139s @requires_cftime 1139s def test_roundtrip_cftime_datetime_data(self) -> None: 1139s from xarray.tests.test_coding_times import _all_cftime_date_types 1139s 1139s date_types = _all_cftime_date_types() 1139s for date_type in date_types.values(): 1139s times = [date_type(1, 1, 1), date_type(1, 1, 2)] 1139s expected = Dataset({"t": ("t", times), "t0": times[0]}) 1139s kwargs = {"encoding": {"t0": {"units": "days since 0001-01-01"}}} 1139s expected_decoded_t = np.array(times) 1139s expected_decoded_t0 = np.array([date_type(1, 1, 1)]) 1139s expected_calendar = times[0].calendar 1139s 1139s with warnings.catch_warnings(): 1139s if expected_calendar in {"proleptic_gregorian", "standard"}: 1139s warnings.filterwarnings("ignore", "Unable to decode time axis") 1139s 1139s > with self.roundtrip(expected, save_kwargs=kwargs) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:615: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _____________ TestGenericNetCDFData.test_roundtrip_timedelta_data ______________ 1139s 1139s self = 1139s 1139s def test_roundtrip_timedelta_data(self) -> None: 1139s # todo: suggestion from review: 1139s # roundtrip large microsecond or coarser resolution timedeltas, 1139s # though we cannot test that until we fix the timedelta decoding 1139s # to support large ranges 1139s time_deltas = pd.to_timedelta(["1h", "2h", "NaT"]).as_unit("s") # type: ignore[arg-type, unused-ignore] 1139s expected = Dataset({"td": ("td", time_deltas), "td0": time_deltas[0]}) 1139s > with self.roundtrip( 1139s expected, open_kwargs={"decode_timedelta": CFTimedeltaCoder(time_unit="ns")} 1139s ) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:639: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ______________ TestGenericNetCDFData.test_roundtrip_float64_data _______________ 1139s 1139s self = 1139s 1139s def test_roundtrip_float64_data(self) -> None: 1139s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1139s > with self.roundtrip(expected) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _______________ TestGenericNetCDFData.test_roundtrip_coordinates _______________ 1139s 1139s self = 1139s 1139s def test_roundtrip_coordinates(self) -> None: 1139s original = Dataset( 1139s {"foo": ("x", [0, 1])}, {"x": [2, 3], "y": ("a", [42]), "z": ("x", [4, 5])} 1139s ) 1139s 1139s > with self.roundtrip(original) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:664: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ___________ TestGenericNetCDFData.test_roundtrip_global_coordinates ____________ 1139s 1139s self = 1139s 1139s def test_roundtrip_global_coordinates(self) -> None: 1139s original = Dataset( 1139s {"foo": ("x", [0, 1])}, {"x": [2, 3], "y": ("a", [42]), "z": ("x", [4, 5])} 1139s ) 1139s > with self.roundtrip(original) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:679: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _________ TestGenericNetCDFData.test_roundtrip_coordinates_with_space __________ 1139s 1139s self = 1139s 1139s def test_roundtrip_coordinates_with_space(self) -> None: 1139s original = Dataset(coords={"x": 0, "y z": 1}) 1139s expected = Dataset({"y z": 1}, {"x": 0}) 1139s with pytest.warns(SerializationWarning): 1139s > with self.roundtrip(original) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:696: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ______________ TestGenericNetCDFData.test_roundtrip_boolean_dtype ______________ 1139s 1139s self = 1139s 1139s def test_roundtrip_boolean_dtype(self) -> None: 1139s original = create_boolean_data() 1139s assert original["x"].dtype == "bool" 1139s > with self.roundtrip(original) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:702: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ________________ TestGenericNetCDFData.test_orthogonal_indexing ________________ 1139s 1139s self = 1139s 1139s def test_orthogonal_indexing(self) -> None: 1139s in_memory = create_test_data() 1139s > with self.roundtrip(in_memory) as on_disk: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ________________ TestGenericNetCDFData.test_vectorized_indexing ________________ 1139s 1139s self = 1139s 1139s def test_vectorized_indexing(self) -> None: 1139s in_memory = create_test_data() 1139s > with self.roundtrip(in_memory) as on_disk: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _________ TestGenericNetCDFData.test_vectorized_indexing_negative_step _________ 1139s 1139s self = 1139s 1139s def test_vectorized_indexing_negative_step(self) -> None: 1139s # use dask explicitly when present 1139s open_kwargs: dict[str, Any] | None 1139s if has_dask: 1139s open_kwargs = {"chunks": {}} 1139s else: 1139s open_kwargs = None 1139s in_memory = create_test_data() 1139s 1139s def multiple_indexing(indexers): 1139s # make sure a sequence of lazy indexings certainly works. 1139s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1139s actual = on_disk["var3"] 1139s expected = in_memory["var3"] 1139s for ind in indexers: 1139s actual = actual.isel(ind) 1139s expected = expected.isel(ind) 1139s # make sure the array is not yet loaded into memory 1139s assert not actual.variable._in_memory 1139s assert_identical(expected, actual.load()) 1139s 1139s # with negative step slice. 1139s indexers = [ 1139s { 1139s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1139s "dim3": slice(-1, 1, -1), 1139s } 1139s ] 1139s > multiple_indexing(indexers) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1139s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ______________ TestGenericNetCDFData.test_outer_indexing_reversed ______________ 1139s 1139s self = 1139s 1139s def test_outer_indexing_reversed(self) -> None: 1139s # regression test for GH6560 1139s ds = xr.Dataset( 1139s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1139s ) 1139s 1139s > with self.roundtrip(ds) as on_disk: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s __________________ TestGenericNetCDFData.test_isel_dataarray ___________________ 1139s 1139s self = 1139s 1139s def test_isel_dataarray(self) -> None: 1139s # Make sure isel works lazily. GH:issue:1688 1139s in_memory = create_test_data() 1139s > with self.roundtrip(in_memory) as on_disk: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _____________ TestGenericNetCDFData.test_array_type_after_indexing _____________ 1139s 1139s self = 1139s 1139s def test_array_type_after_indexing(self) -> None: 1139s in_memory = create_test_data() 1139s > with self.roundtrip(in_memory) as on_disk: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ______________________ TestGenericNetCDFData.test_dropna _______________________ 1139s 1139s self = 1139s 1139s def test_dropna(self) -> None: 1139s # regression test for GH:issue:1694 1139s a = np.random.randn(4, 3) 1139s a[1, 1] = np.nan 1139s in_memory = xr.Dataset( 1139s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1139s ) 1139s 1139s assert_identical( 1139s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1139s ) 1139s 1139s > with self.roundtrip(in_memory) as on_disk: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ________________ TestGenericNetCDFData.test_ondisk_after_print _________________ 1139s 1139s self = 1139s 1139s def test_ondisk_after_print(self) -> None: 1139s """Make sure print does not load file into memory""" 1139s in_memory = create_test_data() 1139s > with self.roundtrip(in_memory) as on_disk: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s __________ TestGenericNetCDFData.test_roundtrip_bytes_with_fill_value __________ 1139s 1139s self = 1139s 1139s def test_roundtrip_bytes_with_fill_value(self) -> None: 1139s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1139s encoding = {"_FillValue": b"X", "dtype": "S1"} 1139s original = Dataset({"x": ("t", values, {}, encoding)}) 1139s expected = original.copy(deep=True) 1139s > with self.roundtrip(original) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _________ TestGenericNetCDFData.test_roundtrip_empty_vlen_string_array _________ 1139s 1139s self = 1139s 1139s def test_roundtrip_empty_vlen_string_array(self) -> None: 1139s # checks preserving vlen dtype for empty arrays GH7862 1139s dtype = create_vlen_dtype(str) 1139s original = Dataset({"a": np.array([], dtype=dtype)}) 1139s assert check_vlen_dtype(original["a"].dtype) is str 1139s > with self.roundtrip(original) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:936: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _______ TestGenericNetCDFData.test_roundtrip_unsigned[fill_value0-False] _______ 1139s 1139s self = 1139s fill_value = np.int8(-1), exp_fill_warning = False 1139s 1139s @pytest.mark.parametrize( 1139s ("fill_value", "exp_fill_warning"), 1139s [ 1139s (np.int8(-1), False), 1139s (np.uint8(255), True), 1139s (-1, False), 1139s (255, True), 1139s ], 1139s ) 1139s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1139s @contextlib.contextmanager 1139s def _roundtrip_with_warnings(*args, **kwargs): 1139s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1139s if exp_fill_warning and is_np2: 1139s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1139s SerializationWarning, 1139s match="_FillValue attribute can't be represented", 1139s ) 1139s else: 1139s warn_checker = contextlib.nullcontext() 1139s with warn_checker: 1139s with self.roundtrip(*args, **kwargs) as actual: 1139s yield actual 1139s 1139s # regression/numpy2 test for 1139s encoding = { 1139s "_FillValue": fill_value, 1139s "_Unsigned": "true", 1139s "dtype": "i1", 1139s } 1139s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1139s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1139s 1139s attributes = { 1139s "_FillValue": fill_value, 1139s "_Unsigned": "true", 1139s } 1139s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1139s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1139s encoded = Dataset({"x": ("t", sb, attributes)}) 1139s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1139s 1139s > with _roundtrip_with_warnings(decoded) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1139s with self.roundtrip(*args, **kwargs) as actual: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _______ TestGenericNetCDFData.test_roundtrip_unsigned[fill_value1-True] ________ 1139s 1139s self = 1139s fill_value = np.uint8(255), exp_fill_warning = True 1139s 1139s @pytest.mark.parametrize( 1139s ("fill_value", "exp_fill_warning"), 1139s [ 1139s (np.int8(-1), False), 1139s (np.uint8(255), True), 1139s (-1, False), 1139s (255, True), 1139s ], 1139s ) 1139s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1139s @contextlib.contextmanager 1139s def _roundtrip_with_warnings(*args, **kwargs): 1139s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1139s if exp_fill_warning and is_np2: 1139s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1139s SerializationWarning, 1139s match="_FillValue attribute can't be represented", 1139s ) 1139s else: 1139s warn_checker = contextlib.nullcontext() 1139s with warn_checker: 1139s with self.roundtrip(*args, **kwargs) as actual: 1139s yield actual 1139s 1139s # regression/numpy2 test for 1139s encoding = { 1139s "_FillValue": fill_value, 1139s "_Unsigned": "true", 1139s "dtype": "i1", 1139s } 1139s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1139s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1139s 1139s attributes = { 1139s "_FillValue": fill_value, 1139s "_Unsigned": "true", 1139s } 1139s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1139s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1139s encoded = Dataset({"x": ("t", sb, attributes)}) 1139s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1139s 1139s > with _roundtrip_with_warnings(decoded) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1139s with self.roundtrip(*args, **kwargs) as actual: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ___________ TestGenericNetCDFData.test_roundtrip_unsigned[-1-False] ____________ 1139s 1139s self = 1139s fill_value = -1, exp_fill_warning = False 1139s 1139s @pytest.mark.parametrize( 1139s ("fill_value", "exp_fill_warning"), 1139s [ 1139s (np.int8(-1), False), 1139s (np.uint8(255), True), 1139s (-1, False), 1139s (255, True), 1139s ], 1139s ) 1139s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1139s @contextlib.contextmanager 1139s def _roundtrip_with_warnings(*args, **kwargs): 1139s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1139s if exp_fill_warning and is_np2: 1139s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1139s SerializationWarning, 1139s match="_FillValue attribute can't be represented", 1139s ) 1139s else: 1139s warn_checker = contextlib.nullcontext() 1139s with warn_checker: 1139s with self.roundtrip(*args, **kwargs) as actual: 1139s yield actual 1139s 1139s # regression/numpy2 test for 1139s encoding = { 1139s "_FillValue": fill_value, 1139s "_Unsigned": "true", 1139s "dtype": "i1", 1139s } 1139s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1139s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1139s 1139s attributes = { 1139s "_FillValue": fill_value, 1139s "_Unsigned": "true", 1139s } 1139s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1139s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1139s encoded = Dataset({"x": ("t", sb, attributes)}) 1139s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1139s 1139s > with _roundtrip_with_warnings(decoded) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1139s with self.roundtrip(*args, **kwargs) as actual: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ___________ TestGenericNetCDFData.test_roundtrip_unsigned[255-True] ____________ 1139s 1139s self = 1139s fill_value = 255, exp_fill_warning = True 1139s 1139s @pytest.mark.parametrize( 1139s ("fill_value", "exp_fill_warning"), 1139s [ 1139s (np.int8(-1), False), 1139s (np.uint8(255), True), 1139s (-1, False), 1139s (255, True), 1139s ], 1139s ) 1139s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1139s @contextlib.contextmanager 1139s def _roundtrip_with_warnings(*args, **kwargs): 1139s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1139s if exp_fill_warning and is_np2: 1139s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1139s SerializationWarning, 1139s match="_FillValue attribute can't be represented", 1139s ) 1139s else: 1139s warn_checker = contextlib.nullcontext() 1139s with warn_checker: 1139s with self.roundtrip(*args, **kwargs) as actual: 1139s yield actual 1139s 1139s # regression/numpy2 test for 1139s encoding = { 1139s "_FillValue": fill_value, 1139s "_Unsigned": "true", 1139s "dtype": "i1", 1139s } 1139s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1139s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1139s 1139s attributes = { 1139s "_FillValue": fill_value, 1139s "_Unsigned": "true", 1139s } 1139s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1139s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1139s encoded = Dataset({"x": ("t", sb, attributes)}) 1139s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1139s 1139s > with _roundtrip_with_warnings(decoded) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1139s with self.roundtrip(*args, **kwargs) as actual: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestGenericNetCDFData.test_grid_mapping_and_bounds_are_not_coordinates_in_file _ 1139s 1139s self = 1139s 1139s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1139s original = self._create_cf_dataset() 1139s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ___ TestGenericNetCDFData.test_coordinate_variables_after_dataset_roundtrip ____ 1139s 1139s self = 1139s 1139s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1139s original = self._create_cf_dataset() 1139s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestGenericNetCDFData.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip _ 1139s 1139s self = 1139s 1139s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1139s self, 1139s ) -> None: 1139s original = self._create_cf_dataset() 1139s # The DataArray roundtrip should have the same warnings as the 1139s # Dataset, but we already tested for those, so just go for the 1139s # new warnings. It would appear that there is no way to tell 1139s # pytest "This warning and also this warning should both be 1139s # present". 1139s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1139s # needs the to_dataset. The other backends should be fine 1139s # without it. 1139s with pytest.warns( 1139s UserWarning, 1139s match=( 1139s r"Variable\(s\) referenced in bounds not in variables: " 1139s r"\['l(at|ong)itude_bnds'\]" 1139s ), 1139s ): 1139s > with self.roundtrip( 1139s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1139s ) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s 1139s During handling of the above exception, another exception occurred: 1139s 1139s self = 1139s 1139s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1139s self, 1139s ) -> None: 1139s original = self._create_cf_dataset() 1139s # The DataArray roundtrip should have the same warnings as the 1139s # Dataset, but we already tested for those, so just go for the 1139s # new warnings. It would appear that there is no way to tell 1139s # pytest "This warning and also this warning should both be 1139s # present". 1139s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1139s # needs the to_dataset. The other backends should be fine 1139s # without it. 1139s > with pytest.warns( 1139s UserWarning, 1139s match=( 1139s r"Variable\(s\) referenced in bounds not in variables: " 1139s r"\['l(at|ong)itude_bnds'\]" 1139s ), 1139s ): 1139s E Failed: DID NOT WARN. No warnings of type (,) were emitted. 1139s E Emitted warnings: []. 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1139s _______________ TestGenericNetCDFData.test_coordinates_encoding ________________ 1139s 1139s self = 1139s 1139s def test_coordinates_encoding(self) -> None: 1139s def equals_latlon(obj): 1139s return obj == "lat lon" or obj == "lon lat" 1139s 1139s original = Dataset( 1139s {"temp": ("x", [0, 1]), "precip": ("x", [0, -1])}, 1139s {"lat": ("x", [2, 3]), "lon": ("x", [4, 5])}, 1139s ) 1139s > with self.roundtrip(original) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1207: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s __________________ TestGenericNetCDFData.test_encoding_kwarg ___________________ 1139s 1139s self = 1139s 1139s def test_encoding_kwarg(self) -> None: 1139s ds = Dataset({"x": ("y", np.arange(10.0))}) 1139s 1139s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1139s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _______________ TestGenericNetCDFData.test_encoding_kwarg_dates ________________ 1139s 1139s self = 1139s 1139s def test_encoding_kwarg_dates(self) -> None: 1139s ds = Dataset({"t": pd.date_range("2000-01-01", periods=3)}) 1139s units = "days since 1900-01-01" 1139s kwargs = dict(encoding={"t": {"units": units}}) 1139s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1302: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _________ TestGenericNetCDFData.test_encoding_kwarg_fixed_width_string _________ 1139s 1139s self = 1139s 1139s def test_encoding_kwarg_fixed_width_string(self) -> None: 1139s # regression test for GH2149 1139s for strings in [[b"foo", b"bar", b"baz"], ["foo", "bar", "baz"]]: 1139s ds = Dataset({"x": strings}) 1139s kwargs = dict(encoding={"x": {"dtype": "S1"}}) 1139s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1311: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ________________ TestGenericNetCDFData.test_default_fill_value _________________ 1139s 1139s self = 1139s 1139s def test_default_fill_value(self) -> None: 1139s # Test default encoding for float: 1139s ds = Dataset({"x": ("y", np.arange(10.0))}) 1139s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1139s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ____________ TestGenericNetCDFData.test_explicitly_omit_fill_value _____________ 1139s 1139s self = 1139s 1139s def test_explicitly_omit_fill_value(self) -> None: 1139s ds = Dataset({"x": ("y", [np.pi, -np.pi])}) 1139s ds.x.encoding["_FillValue"] = None 1139s > with self.roundtrip(ds) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1341: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ___ TestGenericNetCDFData.test_explicitly_omit_fill_value_via_encoding_kwarg ___ 1139s 1139s self = 1139s 1139s def test_explicitly_omit_fill_value_via_encoding_kwarg(self) -> None: 1139s ds = Dataset({"x": ("y", [np.pi, -np.pi])}) 1139s kwargs = dict(encoding={"x": {"_FillValue": None}}) 1139s # _FillValue is not a valid encoding for Zarr 1139s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1348: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ________ TestGenericNetCDFData.test_explicitly_omit_fill_value_in_coord ________ 1139s 1139s self = 1139s 1139s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1139s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1139s ds.y.encoding["_FillValue"] = None 1139s > with self.roundtrip(ds) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestGenericNetCDFData.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg _ 1139s 1139s self = 1139s 1139s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1139s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1139s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1139s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ________________ TestGenericNetCDFData.test_encoding_same_dtype ________________ 1139s 1139s self = 1139s 1139s def test_encoding_same_dtype(self) -> None: 1139s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1139s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1139s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ___________________ TestGenericNetCDFData.test_append_write ____________________ 1139s 1139s self = 1139s 1139s def test_append_write(self) -> None: 1139s # regression for GH1215 1139s data = create_test_data() 1139s > with self.roundtrip_append(data) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:389: in roundtrip_append 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ______________ TestGenericNetCDFData.test_append_overwrite_values ______________ 1139s 1139s self = 1139s 1139s def test_append_overwrite_values(self) -> None: 1139s # regression for GH1215 1139s data = create_test_data() 1139s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1139s self.save(data, tmp_file, mode="w") 1139s data["var2"][:] = -999 1139s data["var9"] = data["var2"] * 3 1139s self.save(data[["var2", "var9"]], tmp_file, mode="a") 1139s > with self.open(tmp_file) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1388: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ____________ TestGenericNetCDFData.test_multiindex_not_implemented _____________ 1139s 1139s self = 1139s 1139s def test_multiindex_not_implemented(self) -> None: 1139s ds = Dataset(coords={"y": ("x", [1, 2]), "z": ("x", ["a", "b"])}).set_index( 1139s x=["y", "z"] 1139s ) 1139s with pytest.raises(NotImplementedError, match=r"MultiIndex"): 1139s with self.roundtrip(ds): 1139s pass 1139s 1139s # regression GH8628 (can serialize reset multi-index level coordinates) 1139s ds_reset = ds.reset_index("x") 1139s > with self.roundtrip(ds_reset) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1412: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _______________ TestGenericNetCDFData.test_string_object_warning _______________ 1139s 1139s self = 1139s 1139s @requires_dask 1139s def test_string_object_warning(self) -> None: 1139s original = Dataset( 1139s { 1139s "x": ( 1139s [ 1139s "y", 1139s ], 1139s np.array(["foo", "bar"], dtype=object), 1139s ) 1139s } 1139s ).chunk() 1139s with pytest.warns(SerializationWarning, match="dask array with dtype=object"): 1139s > with self.roundtrip(original) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1428: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s ______________ TestGenericNetCDFData.test_encoding_unlimited_dims ______________ 1139s 1139s self = 1139s 1139s def test_encoding_unlimited_dims(self) -> None: 1139s ds = Dataset({"x": ("y", np.arange(10.0))}) 1139s > with self.roundtrip(ds, save_kwargs=dict(unlimited_dims=["y"])) as actual: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4046: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:374: in roundtrip 1139s with self.open(path, **open_kwargs) as ds: 1139s /usr/lib/python3.14/contextlib.py:141: in __enter__ 1139s return next(self.gen) 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:400: in open 1139s with open_dataset(path, engine=self.engine, **kwargs) as ds: 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-all-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'all', join = 'outer' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-all-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'outer' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-minimal-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'outer' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-minimal-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'outer' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-different-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'different', join = 'outer' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[outer-different-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'outer' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-all-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'all', join = 'inner' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-all-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'inner' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-minimal-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'inner' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-minimal-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'inner' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-different-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'different', join = 'inner' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[inner-different-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'inner' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-all-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'all', join = 'left' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-all-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'left' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-minimal-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'left' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-minimal-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'left' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-different-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'different', join = 'left' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[left-different-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'left' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-all-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'all', join = 'right' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-all-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'all', join = 'right' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-minimal-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'right' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-minimal-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'right' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-different-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'different', join = 'right' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_does_same_as_concat[right-different-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'different', join = 'right' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s @pytest.mark.parametrize("join", ["outer", "inner", "left", "right"]) 1139s def test_open_mfdataset_does_same_as_concat( 1139s self, combine, concat_dim, opt, join 1139s ) -> None: 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4658: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[drop] _ 1139s 1139s self = 1139s combine_attrs = 'drop', attrs = [{'a': 1}, {'a': 2}], expected = {} 1139s expect_error = False 1139s 1139s @pytest.mark.parametrize( 1139s ["combine_attrs", "attrs", "expected", "expect_error"], 1139s ( 1139s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 1139s pytest.param( 1139s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 1139s ), 1139s pytest.param( 1139s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 1139s ), 1139s pytest.param( 1139s "identical", 1139s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 1139s None, 1139s True, 1139s id="identical", 1139s ), 1139s pytest.param( 1139s "drop_conflicts", 1139s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 1139s {"a": 1, "c": 3}, 1139s False, 1139s id="drop_conflicts", 1139s ), 1139s ), 1139s ) 1139s def test_open_mfdataset_dataset_combine_attrs( 1139s self, combine_attrs, attrs, expected, expect_error 1139s ): 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s # Give the files an inconsistent attribute 1139s for i, f in enumerate(files): 1139s > ds = open_dataset(f).load() 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[override] _ 1139s 1139s self = 1139s combine_attrs = 'override', attrs = [{'a': 1}, {'a': 2}], expected = {'a': 1} 1139s expect_error = False 1139s 1139s @pytest.mark.parametrize( 1139s ["combine_attrs", "attrs", "expected", "expect_error"], 1139s ( 1139s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 1139s pytest.param( 1139s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 1139s ), 1139s pytest.param( 1139s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 1139s ), 1139s pytest.param( 1139s "identical", 1139s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 1139s None, 1139s True, 1139s id="identical", 1139s ), 1139s pytest.param( 1139s "drop_conflicts", 1139s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 1139s {"a": 1, "c": 3}, 1139s False, 1139s id="drop_conflicts", 1139s ), 1139s ), 1139s ) 1139s def test_open_mfdataset_dataset_combine_attrs( 1139s self, combine_attrs, attrs, expected, expect_error 1139s ): 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s # Give the files an inconsistent attribute 1139s for i, f in enumerate(files): 1139s > ds = open_dataset(f).load() 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[no_conflicts] _ 1139s 1139s self = 1139s combine_attrs = 'no_conflicts', attrs = [{'a': 1}, {'a': 2}], expected = None 1139s expect_error = True 1139s 1139s @pytest.mark.parametrize( 1139s ["combine_attrs", "attrs", "expected", "expect_error"], 1139s ( 1139s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 1139s pytest.param( 1139s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 1139s ), 1139s pytest.param( 1139s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 1139s ), 1139s pytest.param( 1139s "identical", 1139s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 1139s None, 1139s True, 1139s id="identical", 1139s ), 1139s pytest.param( 1139s "drop_conflicts", 1139s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 1139s {"a": 1, "c": 3}, 1139s False, 1139s id="drop_conflicts", 1139s ), 1139s ), 1139s ) 1139s def test_open_mfdataset_dataset_combine_attrs( 1139s self, combine_attrs, attrs, expected, expect_error 1139s ): 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s # Give the files an inconsistent attribute 1139s for i, f in enumerate(files): 1139s > ds = open_dataset(f).load() 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[identical] _ 1139s 1139s self = 1139s combine_attrs = 'identical', attrs = [{'a': 1, 'b': 2}, {'a': 1, 'c': 3}] 1139s expected = None, expect_error = True 1139s 1139s @pytest.mark.parametrize( 1139s ["combine_attrs", "attrs", "expected", "expect_error"], 1139s ( 1139s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 1139s pytest.param( 1139s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 1139s ), 1139s pytest.param( 1139s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 1139s ), 1139s pytest.param( 1139s "identical", 1139s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 1139s None, 1139s True, 1139s id="identical", 1139s ), 1139s pytest.param( 1139s "drop_conflicts", 1139s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 1139s {"a": 1, "c": 3}, 1139s False, 1139s id="drop_conflicts", 1139s ), 1139s ), 1139s ) 1139s def test_open_mfdataset_dataset_combine_attrs( 1139s self, combine_attrs, attrs, expected, expect_error 1139s ): 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s # Give the files an inconsistent attribute 1139s for i, f in enumerate(files): 1139s > ds = open_dataset(f).load() 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_combine_attrs[drop_conflicts] _ 1139s 1139s self = 1139s combine_attrs = 'drop_conflicts', attrs = [{'a': 1, 'b': 2}, {'b': -1, 'c': 3}] 1139s expected = {'a': 1, 'c': 3}, expect_error = False 1139s 1139s @pytest.mark.parametrize( 1139s ["combine_attrs", "attrs", "expected", "expect_error"], 1139s ( 1139s pytest.param("drop", [{"a": 1}, {"a": 2}], {}, False, id="drop"), 1139s pytest.param( 1139s "override", [{"a": 1}, {"a": 2}], {"a": 1}, False, id="override" 1139s ), 1139s pytest.param( 1139s "no_conflicts", [{"a": 1}, {"a": 2}], None, True, id="no_conflicts" 1139s ), 1139s pytest.param( 1139s "identical", 1139s [{"a": 1, "b": 2}, {"a": 1, "c": 3}], 1139s None, 1139s True, 1139s id="identical", 1139s ), 1139s pytest.param( 1139s "drop_conflicts", 1139s [{"a": 1, "b": 2}, {"b": -1, "c": 3}], 1139s {"a": 1, "c": 3}, 1139s False, 1139s id="drop_conflicts", 1139s ), 1139s ), 1139s ) 1139s def test_open_mfdataset_dataset_combine_attrs( 1139s self, combine_attrs, attrs, expected, expect_error 1139s ): 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s # Give the files an inconsistent attribute 1139s for i, f in enumerate(files): 1139s > ds = open_dataset(f).load() 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4696: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataset_attr_by_coords _ 1139s 1139s self = 1139s 1139s def test_open_mfdataset_dataset_attr_by_coords(self) -> None: 1139s """ 1139s Case when an attribute differs across the multiple files 1139s """ 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s # Give the files an inconsistent attribute 1139s for i, f in enumerate(files): 1139s > ds = open_dataset(f).load() 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4725: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_dataarray_attr_by_coords _ 1139s 1139s self = 1139s 1139s def test_open_mfdataset_dataarray_attr_by_coords(self) -> None: 1139s """ 1139s Case when an attribute of a member DataArray differs across the multiple files 1139s """ 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s # Give the files an inconsistent attribute 1139s for i, f in enumerate(files): 1139s > ds = open_dataset(f).load() 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4740: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[all-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'all' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s def test_open_mfdataset_exact_join_raises_error( 1139s self, combine, concat_dim, opt 1139s ) -> None: 1139s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s with pytest.raises( 1139s ValueError, match=r"cannot align objects.*join.*exact.*" 1139s ): 1139s > open_mfdataset( 1139s files, 1139s data_vars=opt, 1139s combine=combine, 1139s concat_dim=concat_dim, 1139s join="exact", 1139s ) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[all-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'all' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s def test_open_mfdataset_exact_join_raises_error( 1139s self, combine, concat_dim, opt 1139s ) -> None: 1139s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s with pytest.raises( 1139s ValueError, match=r"cannot align objects.*join.*exact.*" 1139s ): 1139s > open_mfdataset( 1139s files, 1139s data_vars=opt, 1139s combine=combine, 1139s concat_dim=concat_dim, 1139s join="exact", 1139s ) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[minimal-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'minimal' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s def test_open_mfdataset_exact_join_raises_error( 1139s self, combine, concat_dim, opt 1139s ) -> None: 1139s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s with pytest.raises( 1139s ValueError, match=r"cannot align objects.*join.*exact.*" 1139s ): 1139s > open_mfdataset( 1139s files, 1139s data_vars=opt, 1139s combine=combine, 1139s concat_dim=concat_dim, 1139s join="exact", 1139s ) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[minimal-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'minimal' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s def test_open_mfdataset_exact_join_raises_error( 1139s self, combine, concat_dim, opt 1139s ) -> None: 1139s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s with pytest.raises( 1139s ValueError, match=r"cannot align objects.*join.*exact.*" 1139s ): 1139s > open_mfdataset( 1139s files, 1139s data_vars=opt, 1139s combine=combine, 1139s concat_dim=concat_dim, 1139s join="exact", 1139s ) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[different-nested-t] _ 1139s 1139s self = 1139s combine = 'nested', concat_dim = 't', opt = 'different' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s def test_open_mfdataset_exact_join_raises_error( 1139s self, combine, concat_dim, opt 1139s ) -> None: 1139s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s with pytest.raises( 1139s ValueError, match=r"cannot align objects.*join.*exact.*" 1139s ): 1139s > open_mfdataset( 1139s files, 1139s data_vars=opt, 1139s combine=combine, 1139s concat_dim=concat_dim, 1139s join="exact", 1139s ) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_open_mfdataset_exact_join_raises_error[different-by_coords-None] _ 1139s 1139s self = 1139s combine = 'by_coords', concat_dim = None, opt = 'different' 1139s 1139s @pytest.mark.parametrize( 1139s "combine, concat_dim", [("nested", "t"), ("by_coords", None)] 1139s ) 1139s @pytest.mark.parametrize("opt", ["all", "minimal", "different"]) 1139s def test_open_mfdataset_exact_join_raises_error( 1139s self, combine, concat_dim, opt 1139s ) -> None: 1139s with self.setup_files_and_datasets(fuzz=0.1) as (files, [ds1, ds2]): 1139s if combine == "by_coords": 1139s files.reverse() 1139s with pytest.raises( 1139s ValueError, match=r"cannot align objects.*join.*exact.*" 1139s ): 1139s > open_mfdataset( 1139s files, 1139s data_vars=opt, 1139s combine=combine, 1139s concat_dim=concat_dim, 1139s join="exact", 1139s ) 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4761: 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1139s datasets = [open_(p, **open_kwargs) for p in paths1d] 1139s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1139s backend_ds = backend.open_dataset( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1139s store = NetCDF4DataStore.open( 1139s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1139s import netCDF4 1139s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1139s 1139s # init for netCDF4. package 1139s # Docstring comes from extension module _netCDF4. 1139s > from ._netCDF4 import * 1139s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1139s 1139s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1139s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_common_coord_when_datavars_all _ 1139s 1139s self = 1139s 1139s def test_common_coord_when_datavars_all(self) -> None: 1139s opt: Final = "all" 1139s 1139s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1139s # open the files with the data_var option 1139s > with open_mfdataset( 1139s files, data_vars=opt, combine="nested", concat_dim="t" 1139s ) as ds: 1139s 1139s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4774: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1140s datasets = [open_(p, **open_kwargs) for p in paths1d] 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_common_coord_when_datavars_minimal _ 1140s 1140s self = 1140s 1140s def test_common_coord_when_datavars_minimal(self) -> None: 1140s opt: Final = "minimal" 1140s 1140s with self.setup_files_and_datasets() as (files, [ds1, ds2]): 1140s # open the files using data_vars option 1140s > with open_mfdataset( 1140s files, data_vars=opt, combine="nested", concat_dim="t" 1140s ) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4792: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1140s datasets = [open_(p, **open_kwargs) for p in paths1d] 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _ TestOpenMFDatasetWithDataVarsAndCoordsKw.test_invalid_data_vars_value_should_fail _ 1140s 1140s self = 1140s 1140s def test_invalid_data_vars_value_should_fail(self) -> None: 1140s with self.setup_files_and_datasets() as (files, _): 1140s with pytest.raises(ValueError): 1140s > with open_mfdataset(files, data_vars="minimum", combine="by_coords"): # type: ignore[arg-type] 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:4808: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:1635: in open_mfdataset 1140s datasets = [open_(p, **open_kwargs) for p in paths1d] 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ____________ TestDataArrayToNetCDF.test_dataarray_to_netcdf_no_name ____________ 1140s 1140s self = 1140s 1140s def test_dataarray_to_netcdf_no_name(self) -> None: 1140s original_da = DataArray(np.arange(12).reshape((3, 4))) 1140s 1140s with create_tmp_file() as tmp: 1140s original_da.to_netcdf(tmp) 1140s 1140s > with open_dataarray(tmp) as loaded_da: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5576: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 1140s dataset = open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ TestDataArrayToNetCDF.test_dataarray_to_netcdf_with_name ___________ 1140s 1140s self = 1140s 1140s def test_dataarray_to_netcdf_with_name(self) -> None: 1140s original_da = DataArray(np.arange(12).reshape((3, 4)), name="test") 1140s 1140s with create_tmp_file() as tmp: 1140s original_da.to_netcdf(tmp) 1140s 1140s > with open_dataarray(tmp) as loaded_da: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5585: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 1140s dataset = open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _______ TestDataArrayToNetCDF.test_dataarray_to_netcdf_coord_name_clash ________ 1140s 1140s self = 1140s 1140s def test_dataarray_to_netcdf_coord_name_clash(self) -> None: 1140s original_da = DataArray( 1140s np.arange(12).reshape((3, 4)), dims=["x", "y"], name="x" 1140s ) 1140s 1140s with create_tmp_file() as tmp: 1140s original_da.to_netcdf(tmp) 1140s 1140s > with open_dataarray(tmp) as loaded_da: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5596: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 1140s dataset = open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________ TestDataArrayToNetCDF.test_open_dataarray_options _______________ 1140s 1140s self = 1140s 1140s def test_open_dataarray_options(self) -> None: 1140s data = DataArray(np.arange(5), coords={"y": ("x", range(5))}, dims=["x"]) 1140s 1140s with create_tmp_file() as tmp: 1140s data.to_netcdf(tmp) 1140s 1140s expected = data.drop_vars("y") 1140s > with open_dataarray(tmp, drop_variables=["y"]) as loaded: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5606: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 1140s dataset = open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ________ TestDataArrayToNetCDF.test_dataarray_to_netcdf_no_name_pathlib ________ 1140s 1140s self = 1140s 1140s def test_dataarray_to_netcdf_no_name_pathlib(self) -> None: 1140s original_da = DataArray(np.arange(12).reshape((3, 4))) 1140s 1140s with create_tmp_file() as tmps: 1140s tmp = Path(tmps) 1140s original_da.to_netcdf(tmp) 1140s 1140s > with open_dataarray(tmp) as loaded_da: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5623: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:881: in open_dataarray 1140s dataset = open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _____________________ test_source_encoding_always_present ______________________ 1140s 1140s @requires_scipy_or_netCDF4 1140s def test_source_encoding_always_present() -> None: 1140s # Test for GH issue #2550. 1140s rnddata = np.random.randn(10) 1140s original = Dataset({"foo": ("x", rnddata)}) 1140s with create_tmp_file() as tmp: 1140s original.to_netcdf(tmp) 1140s > with open_dataset(tmp) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5703: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _______________ test_source_encoding_always_present_with_pathlib _______________ 1140s 1140s @requires_scipy_or_netCDF4 1140s def test_source_encoding_always_present_with_pathlib() -> None: 1140s # Test for GH issue #5888. 1140s rnddata = np.random.randn(10) 1140s original = Dataset({"foo": ("x", rnddata)}) 1140s with create_tmp_file() as tmp: 1140s original.to_netcdf(tmp) 1140s > with open_dataset(Path(tmp)) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5714: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ________ test_use_cftime_standard_calendar_default_in_range[gregorian] _________ 1140s 1140s calendar = 'gregorian' 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _STANDARD_CALENDARS) 1140s def test_use_cftime_standard_calendar_default_in_range(calendar) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units_date = "2000-01-01" 1140s units = "days since 2000-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s x_timedeltas = np.array(x).astype("timedelta64[D]") 1140s time_timedeltas = np.array(time).astype("timedelta64[D]") 1140s decoded_x = np.datetime64(units_date, "ns") + x_timedeltas 1140s decoded_time = np.datetime64(units_date, "ns") + time_timedeltas 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s > with open_dataset(tmp_file) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5763: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___ test_use_cftime_standard_calendar_default_in_range[proleptic_gregorian] ____ 1140s 1140s calendar = 'proleptic_gregorian' 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _STANDARD_CALENDARS) 1140s def test_use_cftime_standard_calendar_default_in_range(calendar) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units_date = "2000-01-01" 1140s units = "days since 2000-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s x_timedeltas = np.array(x).astype("timedelta64[D]") 1140s time_timedeltas = np.array(time).astype("timedelta64[D]") 1140s decoded_x = np.datetime64(units_date, "ns") + x_timedeltas 1140s decoded_time = np.datetime64(units_date, "ns") + time_timedeltas 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s > with open_dataset(tmp_file) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5763: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _________ test_use_cftime_standard_calendar_default_in_range[standard] _________ 1140s 1140s calendar = 'standard' 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _STANDARD_CALENDARS) 1140s def test_use_cftime_standard_calendar_default_in_range(calendar) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units_date = "2000-01-01" 1140s units = "days since 2000-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s x_timedeltas = np.array(x).astype("timedelta64[D]") 1140s time_timedeltas = np.array(time).astype("timedelta64[D]") 1140s decoded_x = np.datetime64(units_date, "ns") + x_timedeltas 1140s decoded_time = np.datetime64(units_date, "ns") + time_timedeltas 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s > with open_dataset(tmp_file) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5763: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _______ test_use_cftime_standard_calendar_default_out_of_range[standard] _______ 1140s 1140s calendar = 'standard' 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1140s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 1140s # todo: check, if we still need to test for two dates 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = "days since 1582-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.warns(SerializationWarning): 1140s > with open_dataset(tmp_file) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5794: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s 1140s During handling of the above exception, another exception occurred: 1140s 1140s calendar = 'standard' 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1140s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 1140s # todo: check, if we still need to test for two dates 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = "days since 1582-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s > with pytest.warns(SerializationWarning): 1140s E Failed: DID NOT WARN. No warnings of type (,) were emitted. 1140s E Emitted warnings: []. 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5793: Failed 1140s ______ test_use_cftime_standard_calendar_default_out_of_range[gregorian] _______ 1140s 1140s calendar = 'gregorian' 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1140s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 1140s # todo: check, if we still need to test for two dates 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = "days since 1582-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.warns(SerializationWarning): 1140s > with open_dataset(tmp_file) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5794: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s 1140s During handling of the above exception, another exception occurred: 1140s 1140s calendar = 'gregorian' 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1140s def test_use_cftime_standard_calendar_default_out_of_range(calendar) -> None: 1140s # todo: check, if we still need to test for two dates 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = "days since 1582-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s > with pytest.warns(SerializationWarning): 1140s E Failed: DID NOT WARN. No warnings of type (,) were emitted. 1140s E Emitted warnings: []. 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5793: Failed 1140s ______________________ test_use_cftime_true[1500-360_day] ______________________ 1140s 1140s calendar = '360_day', units_year = 1500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[1500-365_day] ______________________ 1140s 1140s calendar = '365_day', units_year = 1500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[1500-366_day] ______________________ 1140s 1140s calendar = '366_day', units_year = 1500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _____________________ test_use_cftime_true[1500-all_leap] ______________________ 1140s 1140s calendar = 'all_leap', units_year = 1500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _____________________ test_use_cftime_true[1500-gregorian] _____________________ 1140s 1140s calendar = 'gregorian', units_year = 1500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[1500-julian] _______________________ 1140s 1140s calendar = 'julian', units_year = 1500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[1500-noleap] _______________________ 1140s 1140s calendar = 'noleap', units_year = 1500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ________________ test_use_cftime_true[1500-proleptic_gregorian] ________________ 1140s 1140s calendar = 'proleptic_gregorian', units_year = 1500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _____________________ test_use_cftime_true[1500-standard] ______________________ 1140s 1140s calendar = 'standard', units_year = 1500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[2000-360_day] ______________________ 1140s 1140s calendar = '360_day', units_year = 2000 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[2000-365_day] ______________________ 1140s 1140s calendar = '365_day', units_year = 2000 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[2000-366_day] ______________________ 1140s 1140s calendar = '366_day', units_year = 2000 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _____________________ test_use_cftime_true[2000-all_leap] ______________________ 1140s 1140s calendar = 'all_leap', units_year = 2000 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _____________________ test_use_cftime_true[2000-gregorian] _____________________ 1140s 1140s calendar = 'gregorian', units_year = 2000 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[2000-julian] _______________________ 1140s 1140s calendar = 'julian', units_year = 2000 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[2000-noleap] _______________________ 1140s 1140s calendar = 'noleap', units_year = 2000 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ________________ test_use_cftime_true[2000-proleptic_gregorian] ________________ 1140s 1140s calendar = 'proleptic_gregorian', units_year = 2000 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _____________________ test_use_cftime_true[2000-standard] ______________________ 1140s 1140s calendar = 'standard', units_year = 2000 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[2500-360_day] ______________________ 1140s 1140s calendar = '360_day', units_year = 2500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[2500-365_day] ______________________ 1140s 1140s calendar = '365_day', units_year = 2500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[2500-366_day] ______________________ 1140s 1140s calendar = '366_day', units_year = 2500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _____________________ test_use_cftime_true[2500-all_leap] ______________________ 1140s 1140s calendar = 'all_leap', units_year = 2500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _____________________ test_use_cftime_true[2500-gregorian] _____________________ 1140s 1140s calendar = 'gregorian', units_year = 2500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[2500-julian] _______________________ 1140s 1140s calendar = 'julian', units_year = 2500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ______________________ test_use_cftime_true[2500-noleap] _______________________ 1140s 1140s calendar = 'noleap', units_year = 2500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ________________ test_use_cftime_true[2500-proleptic_gregorian] ________________ 1140s 1140s calendar = 'proleptic_gregorian', units_year = 2500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _____________________ test_use_cftime_true[2500-standard] ______________________ 1140s 1140s calendar = 'standard', units_year = 2500 1140s 1140s @requires_cftime 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _ALL_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_true(calendar, units_year) -> None: 1140s import cftime 1140s 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s decoded_x = cftime.num2date(x, units, calendar, only_use_cftime_datetimes=True) 1140s decoded_time = cftime.num2date( 1140s time, units, calendar, only_use_cftime_datetimes=True 1140s ) 1140s expected_x = DataArray(decoded_x, [("time", decoded_time)], name="x") 1140s expected_time = DataArray(decoded_time, [("time", decoded_time)], name="time") 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with warnings.catch_warnings(record=True) as record: 1140s decoder = CFDatetimeCoder(use_cftime=True) 1140s > with open_dataset(tmp_file, decode_times=decoder) as ds: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5825: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ________ test_use_cftime_false_standard_calendar_out_of_range[standard] ________ 1140s 1140s calendar = 'standard' 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1140s def test_use_cftime_false_standard_calendar_out_of_range(calendar) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = "days since 1582-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5877: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s _______ test_use_cftime_false_standard_calendar_out_of_range[gregorian] ________ 1140s 1140s calendar = 'gregorian' 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", ["standard", "gregorian"]) 1140s def test_use_cftime_false_standard_calendar_out_of_range(calendar) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = "days since 1582-01-01" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5877: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[1500-360_day] ___________ 1140s 1140s calendar = '360_day', units_year = 1500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[1500-365_day] ___________ 1140s 1140s calendar = '365_day', units_year = 1500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[1500-366_day] ___________ 1140s 1140s calendar = '366_day', units_year = 1500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s __________ test_use_cftime_false_nonstandard_calendar[1500-all_leap] ___________ 1140s 1140s calendar = 'all_leap', units_year = 1500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[1500-julian] ____________ 1140s 1140s calendar = 'julian', units_year = 1500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[1500-noleap] ____________ 1140s 1140s calendar = 'noleap', units_year = 1500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[2000-360_day] ___________ 1140s 1140s calendar = '360_day', units_year = 2000 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[2000-365_day] ___________ 1140s 1140s calendar = '365_day', units_year = 2000 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[2000-366_day] ___________ 1140s 1140s calendar = '366_day', units_year = 2000 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s __________ test_use_cftime_false_nonstandard_calendar[2000-all_leap] ___________ 1140s 1140s calendar = 'all_leap', units_year = 2000 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[2000-julian] ____________ 1140s 1140s calendar = 'julian', units_year = 2000 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[2000-noleap] ____________ 1140s 1140s calendar = 'noleap', units_year = 2000 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[2500-360_day] ___________ 1140s 1140s calendar = '360_day', units_year = 2500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[2500-365_day] ___________ 1140s 1140s calendar = '365_day', units_year = 2500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[2500-366_day] ___________ 1140s 1140s calendar = '366_day', units_year = 2500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s __________ test_use_cftime_false_nonstandard_calendar[2500-all_leap] ___________ 1140s 1140s calendar = 'all_leap', units_year = 2500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[2500-julian] ____________ 1140s 1140s calendar = 'julian', units_year = 2500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ___________ test_use_cftime_false_nonstandard_calendar[2500-noleap] ____________ 1140s 1140s calendar = 'noleap', units_year = 2500 1140s 1140s @requires_scipy_or_netCDF4 1140s @pytest.mark.parametrize("calendar", _NON_STANDARD_CALENDARS) 1140s @pytest.mark.parametrize("units_year", [1500, 2000, 2500]) 1140s def test_use_cftime_false_nonstandard_calendar(calendar, units_year) -> None: 1140s x = [0, 1] 1140s time = [0, 720] 1140s units = f"days since {units_year}" 1140s original = DataArray(x, [("time", time)], name="x").to_dataset() 1140s for v in ["x", "time"]: 1140s original[v].attrs["units"] = units 1140s original[v].attrs["calendar"] = calendar 1140s 1140s with create_tmp_file() as tmp_file: 1140s original.to_netcdf(tmp_file) 1140s with pytest.raises((OutOfBoundsDatetime, ValueError)): 1140s decoder = CFDatetimeCoder(use_cftime=False) 1140s > open_dataset(tmp_file, decode_times=decoder) 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:5896: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1140s store = NetCDF4DataStore.open( 1140s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1140s import netCDF4 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s # init for netCDF4. package 1140s # Docstring comes from extension module _netCDF4. 1140s > from ._netCDF4 import * 1140s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1140s 1140s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1140s ____________________ test_open_dataset_chunking_zarr[auto] _____________________ 1140s 1140s chunks = 'auto' 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar0') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1140s encoded_chunks = 100 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s _____________________ test_open_dataset_chunking_zarr[-1] ______________________ 1140s 1140s chunks = -1 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar1') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1140s encoded_chunks = 100 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ___________________ test_open_dataset_chunking_zarr[chunks2] ___________________ 1140s 1140s chunks = {} 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar2') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1140s encoded_chunks = 100 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ___________________ test_open_dataset_chunking_zarr[chunks3] ___________________ 1140s 1140s chunks = {'x': 'auto'} 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar3') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1140s encoded_chunks = 100 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ___________________ test_open_dataset_chunking_zarr[chunks4] ___________________ 1140s 1140s chunks = {'x': -1} 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar4') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1140s encoded_chunks = 100 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ___________________ test_open_dataset_chunking_zarr[chunks5] ___________________ 1140s 1140s chunks = {'x': 'auto', 'y': -1} 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_open_dataset_chunking_zar5') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1140s encoded_chunks = 100 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s _______________________ test_chunking_consintency[auto] ________________________ 1140s 1140s chunks = 'auto' 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_auto0') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1140s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1140s encoded_chunks: dict[str, Any] = {} 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s ds.to_netcdf(tmp_path / "test.nc") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with xr.open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ________________________ test_chunking_consintency[-1] _________________________ 1140s 1140s chunks = -1 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency__1_0') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1140s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1140s encoded_chunks: dict[str, Any] = {} 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s ds.to_netcdf(tmp_path / "test.nc") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with xr.open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ______________________ test_chunking_consintency[chunks2] ______________________ 1140s 1140s chunks = {} 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun0') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1140s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1140s encoded_chunks: dict[str, Any] = {} 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s ds.to_netcdf(tmp_path / "test.nc") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with xr.open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ______________________ test_chunking_consintency[chunks3] ______________________ 1140s 1140s chunks = {'x': 'auto'} 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun1') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1140s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1140s encoded_chunks: dict[str, Any] = {} 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s ds.to_netcdf(tmp_path / "test.nc") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with xr.open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ______________________ test_chunking_consintency[chunks4] ______________________ 1140s 1140s chunks = {'x': -1} 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun2') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1140s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1140s encoded_chunks: dict[str, Any] = {} 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s ds.to_netcdf(tmp_path / "test.nc") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with xr.open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ______________________ test_chunking_consintency[chunks5] ______________________ 1140s 1140s chunks = {'x': 'auto', 'y': -1} 1140s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-0/test_chunking_consintency_chun3') 1140s 1140s @requires_zarr 1140s @requires_dask 1140s @pytest.mark.parametrize( 1140s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1140s ) 1140s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1140s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1140s encoded_chunks: dict[str, Any] = {} 1140s dask_arr = da.from_array( 1140s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1140s ) 1140s ds = xr.Dataset( 1140s { 1140s "test": xr.DataArray( 1140s dask_arr, 1140s dims=("x", "y"), 1140s ) 1140s } 1140s ) 1140s ds["test"].encoding["chunks"] = encoded_chunks 1140s ds.to_zarr(tmp_path / "test.zarr") 1140s ds.to_netcdf(tmp_path / "test.nc") 1140s 1140s with dask.config.set({"array.chunk-size": "1MiB"}): 1140s expected = ds.chunk(chunks) 1140s > with xr.open_dataset( 1140s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1140s ) as actual: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1140s backend_ds = backend.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1140s ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'test' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ________________ TestZarrDatatreeIO.test_to_zarr[zarr_format=3] ________________ 1140s 1140s self = 1140s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zarr_format_3_0') 1140s simple_datatree = 1140s Group: / 1140s │ Dimensions: (y: 3, x: 2) 1140s │ Dimensions without coordinates: y, x 1140s │ Data variables: 1140s ... a (x) int64 16B 2 3 1140s │ │ b (x) float64 16B 0.1 0.2 1140s │ └── Group: /set2/set1 1140s └── Group: /set3 1140s zarr_format = 3 1140s 1140s def test_to_zarr(self, tmpdir, simple_datatree, zarr_format): 1140s filepath = str(tmpdir / "test.zarr") 1140s original_dt = simple_datatree 1140s original_dt.to_zarr(filepath, zarr_format=zarr_format) 1140s 1140s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:459: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1140s backend_tree = backend.open_datatree( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1140s groups_dict = self.open_groups_as_dict( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1140s group_ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'b' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s _____________ TestZarrDatatreeIO.test_zarr_encoding[zarr_format=3] _____________ 1140s 1140s self = 1140s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_zarr_encoding_zarr_format1') 1140s simple_datatree = 1140s Group: / 1140s │ Dimensions: (y: 3, x: 2) 1140s │ Dimensions without coordinates: y, x 1140s │ Data variables: 1140s ... a (x) int64 16B 2 3 1140s │ │ b (x) float64 16B 0.1 0.2 1140s │ └── Group: /set2/set1 1140s └── Group: /set3 1140s zarr_format = 3 1140s 1140s def test_zarr_encoding(self, tmpdir, simple_datatree, zarr_format): 1140s filepath = str(tmpdir / "test.zarr") 1140s original_dt = simple_datatree 1140s 1140s if zarr_format == 2: 1140s from numcodecs.blosc import Blosc 1140s 1140s codec = Blosc(cname="zstd", clevel=3, shuffle=2) 1140s comp = {"compressors": (codec,)} if has_zarr_v3 else {"compressor": codec} 1140s elif zarr_format == 3: 1140s # specifying codecs in zarr_format=3 requires importing from zarr 3 namespace 1140s import numcodecs.zarr3 1140s 1140s comp = {"compressors": (numcodecs.zarr3.Blosc(cname="zstd", clevel=3),)} 1140s 1140s enc = {"/set2": {var: comp for var in original_dt["/set2"].dataset.data_vars}} 1140s original_dt.to_zarr(filepath, encoding=enc, zarr_format=zarr_format) 1140s 1140s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:480: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1140s backend_tree = backend.open_datatree( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1140s groups_dict = self.open_groups_as_dict( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1140s group_ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'b' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=2] ___________ 1140s 1140s cls = 1140s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1140s path = '', mode = 'r' 1140s 1140s @classmethod 1140s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1140s """ 1140s Open StorePath based on the provided mode. 1140s 1140s * If the mode is None, return an opened version of the store with no changes. 1140s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1140s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1140s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1140s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1140s 1140s Parameters 1140s ---------- 1140s mode : AccessModeLiteral 1140s The mode to use when initializing the store path. 1140s 1140s The accepted values are: 1140s 1140s - ``'r'``: read only (must exist) 1140s - ``'r+'``: read/write (must exist) 1140s - ``'a'``: read/write (create if doesn't exist) 1140s - ``'w'``: read/write (overwrite if exists) 1140s - ``'w-'``: read/write (create if doesn't exist). 1140s 1140s Raises 1140s ------ 1140s FileExistsError 1140s If the mode is 'w-' and the store path already exists. 1140s ValueError 1140s If the mode is not "r" and the store is read-only, or 1140s """ 1140s 1140s # fastpath if mode is None 1140s if mode is None: 1140s return await cls._create_open_instance(store, path) 1140s 1140s if mode not in ANY_ACCESS_MODE: 1140s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1140s 1140s if store.read_only: 1140s # Don't allow write operations on a read-only store 1140s if mode != "r": 1140s raise ValueError( 1140s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1140s ) 1140s self = await cls._create_open_instance(store, path) 1140s elif mode == "r": 1140s # Create read-only copy for read mode on writable store 1140s try: 1140s > read_only_store = store.with_read_only(True) 1140s 1140s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1140s read_only = True 1140s 1140s def with_read_only(self, read_only: bool = False) -> Store: 1140s """ 1140s Return a new store with a new read_only setting. 1140s 1140s The new store points to the same location with the specified new read_only state. 1140s The returned Store is not automatically opened, and this store is 1140s not automatically closed. 1140s 1140s Parameters 1140s ---------- 1140s read_only 1140s If True, the store will be created in read-only mode. Defaults to False. 1140s 1140s Returns 1140s ------- 1140s A new store of the same type with the new read only attribute. 1140s """ 1140s > raise NotImplementedError( 1140s f"with_read_only is not implemented for the {type(self)} store type." 1140s ) 1140s E NotImplementedError: with_read_only is not implemented for the store type. 1140s 1140s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 1140s 1140s The above exception was the direct cause of the following exception: 1140s 1140s self = 1140s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0') 1140s simple_datatree = 1140s Group: / 1140s │ Dimensions: (y: 3, x: 2) 1140s │ Dimensions without coordinates: y, x 1140s │ Data variables: 1140s ... a (x) int64 16B 2 3 1140s │ │ b (x) float64 16B 0.1 0.2 1140s │ └── Group: /set2/set1 1140s └── Group: /set3 1140s zarr_format = 2 1140s 1140s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 1140s from zarr.storage import ZipStore 1140s 1140s filepath = str(tmpdir / "test.zarr.zip") 1140s original_dt = simple_datatree 1140s store = ZipStore(filepath, mode="w") 1140s original_dt.to_zarr(store, zarr_format=zarr_format) 1140s 1140s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1140s backend_tree = backend.open_datatree( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1140s groups_dict = self.open_groups_as_dict( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 1140s stores = ZarrStore.open_store( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 1140s ) = _get_open_params( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 1140s zarr_root_group = zarr.open_group(store, **open_kwargs) 1140s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 1140s sync( 1140s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1140s raise return_result 1140s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1140s return await coro 1140s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1140s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1140s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 1140s return await StorePath.open(store, path=path_normalized, mode=mode) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s cls = 1140s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1140s path = '', mode = 'r' 1140s 1140s @classmethod 1140s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1140s """ 1140s Open StorePath based on the provided mode. 1140s 1140s * If the mode is None, return an opened version of the store with no changes. 1140s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1140s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1140s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1140s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1140s 1140s Parameters 1140s ---------- 1140s mode : AccessModeLiteral 1140s The mode to use when initializing the store path. 1140s 1140s The accepted values are: 1140s 1140s - ``'r'``: read only (must exist) 1140s - ``'r+'``: read/write (must exist) 1140s - ``'a'``: read/write (create if doesn't exist) 1140s - ``'w'``: read/write (overwrite if exists) 1140s - ``'w-'``: read/write (create if doesn't exist). 1140s 1140s Raises 1140s ------ 1140s FileExistsError 1140s If the mode is 'w-' and the store path already exists. 1140s ValueError 1140s If the mode is not "r" and the store is read-only, or 1140s """ 1140s 1140s # fastpath if mode is None 1140s if mode is None: 1140s return await cls._create_open_instance(store, path) 1140s 1140s if mode not in ANY_ACCESS_MODE: 1140s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1140s 1140s if store.read_only: 1140s # Don't allow write operations on a read-only store 1140s if mode != "r": 1140s raise ValueError( 1140s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1140s ) 1140s self = await cls._create_open_instance(store, path) 1140s elif mode == "r": 1140s # Create read-only copy for read mode on writable store 1140s try: 1140s read_only_store = store.with_read_only(True) 1140s except NotImplementedError as e: 1140s > raise ValueError( 1140s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 1140s "Please use a read-only store or a storage class that implements .with_read_only()." 1140s ) from e 1140s E ValueError: Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. Please use a read-only store or a storage class that implements .with_read_only(). 1140s 1140s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 1140s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=3] ___________ 1140s 1140s cls = 1140s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1140s path = '', mode = 'r' 1140s 1140s @classmethod 1140s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1140s """ 1140s Open StorePath based on the provided mode. 1140s 1140s * If the mode is None, return an opened version of the store with no changes. 1140s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1140s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1140s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1140s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1140s 1140s Parameters 1140s ---------- 1140s mode : AccessModeLiteral 1140s The mode to use when initializing the store path. 1140s 1140s The accepted values are: 1140s 1140s - ``'r'``: read only (must exist) 1140s - ``'r+'``: read/write (must exist) 1140s - ``'a'``: read/write (create if doesn't exist) 1140s - ``'w'``: read/write (overwrite if exists) 1140s - ``'w-'``: read/write (create if doesn't exist). 1140s 1140s Raises 1140s ------ 1140s FileExistsError 1140s If the mode is 'w-' and the store path already exists. 1140s ValueError 1140s If the mode is not "r" and the store is read-only, or 1140s """ 1140s 1140s # fastpath if mode is None 1140s if mode is None: 1140s return await cls._create_open_instance(store, path) 1140s 1140s if mode not in ANY_ACCESS_MODE: 1140s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1140s 1140s if store.read_only: 1140s # Don't allow write operations on a read-only store 1140s if mode != "r": 1140s raise ValueError( 1140s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1140s ) 1140s self = await cls._create_open_instance(store, path) 1140s elif mode == "r": 1140s # Create read-only copy for read mode on writable store 1140s try: 1140s > read_only_store = store.with_read_only(True) 1140s 1140s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1140s read_only = True 1140s 1140s def with_read_only(self, read_only: bool = False) -> Store: 1140s """ 1140s Return a new store with a new read_only setting. 1140s 1140s The new store points to the same location with the specified new read_only state. 1140s The returned Store is not automatically opened, and this store is 1140s not automatically closed. 1140s 1140s Parameters 1140s ---------- 1140s read_only 1140s If True, the store will be created in read-only mode. Defaults to False. 1140s 1140s Returns 1140s ------- 1140s A new store of the same type with the new read only attribute. 1140s """ 1140s > raise NotImplementedError( 1140s f"with_read_only is not implemented for the {type(self)} store type." 1140s ) 1140s E NotImplementedError: with_read_only is not implemented for the store type. 1140s 1140s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 1140s 1140s The above exception was the direct cause of the following exception: 1140s 1140s self = 1140s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1') 1140s simple_datatree = 1140s Group: / 1140s │ Dimensions: (y: 3, x: 2) 1140s │ Dimensions without coordinates: y, x 1140s │ Data variables: 1140s ... a (x) int64 16B 2 3 1140s │ │ b (x) float64 16B 0.1 0.2 1140s │ └── Group: /set2/set1 1140s └── Group: /set3 1140s zarr_format = 3 1140s 1140s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 1140s from zarr.storage import ZipStore 1140s 1140s filepath = str(tmpdir / "test.zarr.zip") 1140s original_dt = simple_datatree 1140s store = ZipStore(filepath, mode="w") 1140s original_dt.to_zarr(store, zarr_format=zarr_format) 1140s 1140s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1140s backend_tree = backend.open_datatree( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1140s groups_dict = self.open_groups_as_dict( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 1140s stores = ZarrStore.open_store( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 1140s ) = _get_open_params( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 1140s zarr_root_group = zarr.open_group(store, **open_kwargs) 1140s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 1140s sync( 1140s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1140s raise return_result 1140s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1140s return await coro 1140s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1140s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1140s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 1140s return await StorePath.open(store, path=path_normalized, mode=mode) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s cls = 1140s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1140s path = '', mode = 'r' 1140s 1140s @classmethod 1140s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1140s """ 1140s Open StorePath based on the provided mode. 1140s 1140s * If the mode is None, return an opened version of the store with no changes. 1140s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1140s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1140s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1140s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1140s 1140s Parameters 1140s ---------- 1140s mode : AccessModeLiteral 1140s The mode to use when initializing the store path. 1140s 1140s The accepted values are: 1140s 1140s - ``'r'``: read only (must exist) 1140s - ``'r+'``: read/write (must exist) 1140s - ``'a'``: read/write (create if doesn't exist) 1140s - ``'w'``: read/write (overwrite if exists) 1140s - ``'w-'``: read/write (create if doesn't exist). 1140s 1140s Raises 1140s ------ 1140s FileExistsError 1140s If the mode is 'w-' and the store path already exists. 1140s ValueError 1140s If the mode is not "r" and the store is read-only, or 1140s """ 1140s 1140s # fastpath if mode is None 1140s if mode is None: 1140s return await cls._create_open_instance(store, path) 1140s 1140s if mode not in ANY_ACCESS_MODE: 1140s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1140s 1140s if store.read_only: 1140s # Don't allow write operations on a read-only store 1140s if mode != "r": 1140s raise ValueError( 1140s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1140s ) 1140s self = await cls._create_open_instance(store, path) 1140s elif mode == "r": 1140s # Create read-only copy for read mode on writable store 1140s try: 1140s read_only_store = store.with_read_only(True) 1140s except NotImplementedError as e: 1140s > raise ValueError( 1140s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 1140s "Please use a read-only store or a storage class that implements .with_read_only()." 1140s ) from e 1140s E ValueError: Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. Please use a read-only store or a storage class that implements .with_read_only(). 1140s 1140s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 1140s _______ TestZarrDatatreeIO.test_to_zarr_not_consolidated[zarr_format=3] ________ 1140s 1140s self = 1140s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_to_zarr_not_consolidated_1') 1140s simple_datatree = 1140s Group: / 1140s │ Dimensions: (y: 3, x: 2) 1140s │ Dimensions without coordinates: y, x 1140s │ Data variables: 1140s ... a (x) int64 16B 2 3 1140s │ │ b (x) float64 16B 0.1 0.2 1140s │ └── Group: /set2/set1 1140s └── Group: /set3 1140s zarr_format = 3 1140s 1140s def test_to_zarr_not_consolidated(self, tmpdir, simple_datatree, zarr_format): 1140s filepath = tmpdir / "test.zarr" 1140s zmetadata = filepath / ".zmetadata" 1140s s1zmetadata = filepath / "set1" / ".zmetadata" 1140s filepath = str(filepath) # casting to str avoids a pathlib bug in xarray 1140s original_dt = simple_datatree 1140s original_dt.to_zarr(filepath, consolidated=False, zarr_format=zarr_format) 1140s assert not zmetadata.exists() 1140s assert not s1zmetadata.exists() 1140s 1140s with pytest.warns(RuntimeWarning, match="consolidated"): 1140s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:514: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1140s backend_tree = backend.open_datatree( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1140s groups_dict = self.open_groups_as_dict( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1140s group_ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'b' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s ________ TestZarrDatatreeIO.test_open_groups_round_trip[zarr_format=3] _________ 1140s 1140s self = 1140s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_groups_round_trip_za1') 1140s simple_datatree = 1140s Group: / 1140s │ Dimensions: (y: 3, x: 2) 1140s │ Dimensions without coordinates: y, x 1140s │ Data variables: 1140s ... a (x) int64 16B 2 3 1140s │ │ b (x) float64 16B 0.1 0.2 1140s │ └── Group: /set2/set1 1140s └── Group: /set3 1140s zarr_format = 3 1140s 1140s def test_open_groups_round_trip(self, tmpdir, simple_datatree, zarr_format) -> None: 1140s """Test `open_groups` opens a zarr store with the `simple_datatree` structure.""" 1140s filepath = str(tmpdir / "test.zarr") 1140s original_dt = simple_datatree 1140s original_dt.to_zarr(filepath, zarr_format=zarr_format) 1140s 1140s > roundtrip_dict = open_groups(filepath, engine="zarr") 1140s 1140s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:631: 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1140s backend_groups = backend.open_groups_as_dict( 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1140s group_ds = store_entrypoint.open_dataset( 1140s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1140s vars, attrs = filename_or_obj.load() 1140s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1140s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1140s return Frozen(dict(*args, **kwargs)) 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1140s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1140s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1140s 1140s self = , name = 'b' 1140s 1140s def open_store_variable(self, name): 1140s zarr_array = self.members[name] 1140s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1140s try_nczarr = self._mode == "r" 1140s dimensions, attributes = _get_zarr_dims_and_attrs( 1140s zarr_array, DIMENSION_KEY, try_nczarr 1140s ) 1140s attributes = dict(attributes) 1140s 1140s encoding = { 1140s "chunks": zarr_array.chunks, 1140s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1140s } 1140s 1140s if _zarr_v3(): 1140s encoding.update( 1140s { 1140s "compressors": zarr_array.compressors, 1140s "filters": zarr_array.filters, 1140s "shards": zarr_array.shards, 1140s } 1140s ) 1140s if self.zarr_group.metadata.zarr_format == 3: 1140s encoding.update({"serializer": zarr_array.serializer}) 1140s else: 1140s encoding.update( 1140s { 1140s "compressor": zarr_array.compressor, 1140s "filters": zarr_array.filters, 1140s } 1140s ) 1140s 1140s if self._use_zarr_fill_value_as_mask: 1140s # Setting this attribute triggers CF decoding for missing values 1140s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1140s if zarr_array.fill_value is not None: 1140s attributes["_FillValue"] = zarr_array.fill_value 1140s elif "_FillValue" in attributes: 1140s original_zarr_dtype = zarr_array.metadata.data_type 1140s attributes["_FillValue"] = FillValueCoder.decode( 1140s > attributes["_FillValue"], original_zarr_dtype.value 1140s ) 1140s E AttributeError: 'Float64' object has no attribute 'value' 1140s 1140s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1140s _____________ TestZarrDatatreeIO.test_open_datatree[zarr_format=3] _____________ 1140s 1140s self = 1140s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0xec4d5cef5a60> 1140s zarr_format = 3 1140s 1140s @pytest.mark.filterwarnings( 1140s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1140s ) 1140s def test_open_datatree(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 1140s """Test if `open_datatree` fails to open a zarr store with an unaligned group hierarchy.""" 1140s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 1140s 1140s with pytest.raises( 1140s ValueError, 1140s match=( 1141s re.escape("group '/Group2' is not aligned with its parents:") + ".*" 1141s ), 1141s ): 1141s > open_datatree(storepath, engine="zarr") 1141s 1141s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:653: 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1141s backend_tree = backend.open_datatree( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1141s groups_dict = self.open_groups_as_dict( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1141s group_ds = store_entrypoint.open_dataset( 1141s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1141s vars, attrs = filename_or_obj.load() 1141s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1141s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1141s return Frozen(dict(*args, **kwargs)) 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s 1141s self = , name = 'b' 1141s 1141s def open_store_variable(self, name): 1141s zarr_array = self.members[name] 1141s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1141s try_nczarr = self._mode == "r" 1141s dimensions, attributes = _get_zarr_dims_and_attrs( 1141s zarr_array, DIMENSION_KEY, try_nczarr 1141s ) 1141s attributes = dict(attributes) 1141s 1141s encoding = { 1141s "chunks": zarr_array.chunks, 1141s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1141s } 1141s 1141s if _zarr_v3(): 1141s encoding.update( 1141s { 1141s "compressors": zarr_array.compressors, 1141s "filters": zarr_array.filters, 1141s "shards": zarr_array.shards, 1141s } 1141s ) 1141s if self.zarr_group.metadata.zarr_format == 3: 1141s encoding.update({"serializer": zarr_array.serializer}) 1141s else: 1141s encoding.update( 1141s { 1141s "compressor": zarr_array.compressor, 1141s "filters": zarr_array.filters, 1141s } 1141s ) 1141s 1141s if self._use_zarr_fill_value_as_mask: 1141s # Setting this attribute triggers CF decoding for missing values 1141s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1141s if zarr_array.fill_value is not None: 1141s attributes["_FillValue"] = zarr_array.fill_value 1141s elif "_FillValue" in attributes: 1141s original_zarr_dtype = zarr_array.metadata.data_type 1141s attributes["_FillValue"] = FillValueCoder.decode( 1141s > attributes["_FillValue"], original_zarr_dtype.value 1141s ) 1141s E AttributeError: 'Float64' object has no attribute 'value' 1141s 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1141s _________ TestZarrDatatreeIO.test_open_datatree_chunks[zarr_format=3] __________ 1141s 1141s self = 1141s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_chunks_zarr1') 1141s zarr_format = 3 1141s 1141s @requires_dask 1141s def test_open_datatree_chunks(self, tmpdir, zarr_format) -> None: 1141s filepath = str(tmpdir / "test.zarr") 1141s 1141s chunks = {"x": 2, "y": 1} 1141s 1141s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 1141s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 1141s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 1141s original_tree = DataTree.from_dict( 1141s { 1141s "/": root_data.chunk(chunks), 1141s "/group1": set1_data.chunk(chunks), 1141s "/group2": set2_data.chunk(chunks), 1141s } 1141s ) 1141s original_tree.to_zarr(filepath, zarr_format=zarr_format) 1141s 1141s > with open_datatree(filepath, engine="zarr", chunks=chunks) as tree: 1141s 1141s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:673: 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1141s backend_tree = backend.open_datatree( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1141s groups_dict = self.open_groups_as_dict( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1141s group_ds = store_entrypoint.open_dataset( 1141s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1141s vars, attrs = filename_or_obj.load() 1141s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1141s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1141s return Frozen(dict(*args, **kwargs)) 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s 1141s self = , name = 'b' 1141s 1141s def open_store_variable(self, name): 1141s zarr_array = self.members[name] 1141s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1141s try_nczarr = self._mode == "r" 1141s dimensions, attributes = _get_zarr_dims_and_attrs( 1141s zarr_array, DIMENSION_KEY, try_nczarr 1141s ) 1141s attributes = dict(attributes) 1141s 1141s encoding = { 1141s "chunks": zarr_array.chunks, 1141s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1141s } 1141s 1141s if _zarr_v3(): 1141s encoding.update( 1141s { 1141s "compressors": zarr_array.compressors, 1141s "filters": zarr_array.filters, 1141s "shards": zarr_array.shards, 1141s } 1141s ) 1141s if self.zarr_group.metadata.zarr_format == 3: 1141s encoding.update({"serializer": zarr_array.serializer}) 1141s else: 1141s encoding.update( 1141s { 1141s "compressor": zarr_array.compressor, 1141s "filters": zarr_array.filters, 1141s } 1141s ) 1141s 1141s if self._use_zarr_fill_value_as_mask: 1141s # Setting this attribute triggers CF decoding for missing values 1141s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1141s if zarr_array.fill_value is not None: 1141s attributes["_FillValue"] = zarr_array.fill_value 1141s elif "_FillValue" in attributes: 1141s original_zarr_dtype = zarr_array.metadata.data_type 1141s attributes["_FillValue"] = FillValueCoder.decode( 1141s > attributes["_FillValue"], original_zarr_dtype.value 1141s ) 1141s E AttributeError: 'Float64' object has no attribute 'value' 1141s 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1141s ______________ TestZarrDatatreeIO.test_open_groups[zarr_format=3] ______________ 1141s 1141s self = 1141s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0xec4d5cef5a60> 1141s zarr_format = 3 1141s 1141s @pytest.mark.filterwarnings( 1141s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1141s ) 1141s def test_open_groups(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 1141s """Test `open_groups` with a zarr store of an unaligned group hierarchy.""" 1141s 1141s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 1141s > unaligned_dict_of_datasets = open_groups(storepath, engine="zarr") 1141s 1141s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:689: 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1141s backend_groups = backend.open_groups_as_dict( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1141s group_ds = store_entrypoint.open_dataset( 1141s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1141s vars, attrs = filename_or_obj.load() 1141s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1141s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1141s return Frozen(dict(*args, **kwargs)) 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s 1141s self = , name = 'b' 1141s 1141s def open_store_variable(self, name): 1141s zarr_array = self.members[name] 1141s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1141s try_nczarr = self._mode == "r" 1141s dimensions, attributes = _get_zarr_dims_and_attrs( 1141s zarr_array, DIMENSION_KEY, try_nczarr 1141s ) 1141s attributes = dict(attributes) 1141s 1141s encoding = { 1141s "chunks": zarr_array.chunks, 1141s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1141s } 1141s 1141s if _zarr_v3(): 1141s encoding.update( 1141s { 1141s "compressors": zarr_array.compressors, 1141s "filters": zarr_array.filters, 1141s "shards": zarr_array.shards, 1141s } 1141s ) 1141s if self.zarr_group.metadata.zarr_format == 3: 1141s encoding.update({"serializer": zarr_array.serializer}) 1141s else: 1141s encoding.update( 1141s { 1141s "compressor": zarr_array.compressor, 1141s "filters": zarr_array.filters, 1141s } 1141s ) 1141s 1141s if self._use_zarr_fill_value_as_mask: 1141s # Setting this attribute triggers CF decoding for missing values 1141s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1141s if zarr_array.fill_value is not None: 1141s attributes["_FillValue"] = zarr_array.fill_value 1141s elif "_FillValue" in attributes: 1141s original_zarr_dtype = zarr_array.metadata.data_type 1141s attributes["_FillValue"] = FillValueCoder.decode( 1141s > attributes["_FillValue"], original_zarr_dtype.value 1141s ) 1141s E AttributeError: 'Float64' object has no attribute 'value' 1141s 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1141s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[True-zarr_format=3] ___ 1141s 1141s self = 1141s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_specific_gr1') 1141s simple_datatree = 1141s Group: / 1141s │ Dimensions: (y: 3, x: 2) 1141s │ Dimensions without coordinates: y, x 1141s │ Data variables: 1141s ... a (x) int64 16B 2 3 1141s │ │ b (x) float64 16B 0.1 0.2 1141s │ └── Group: /set2/set1 1141s └── Group: /set3 1141s write_consolidated_metadata = True, zarr_format = 3 1141s 1141s @pytest.mark.filterwarnings( 1141s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1141s ) 1141s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1141s def test_open_datatree_specific_group( 1141s self, 1141s tmpdir, 1141s simple_datatree, 1141s write_consolidated_metadata, 1141s zarr_format, 1141s ) -> None: 1141s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1141s filepath = str(tmpdir / "test.zarr") 1141s group = "/set2" 1141s original_dt = simple_datatree 1141s original_dt.to_zarr( 1141s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1141s ) 1141s expected_subtree = original_dt[group].copy() 1141s expected_subtree.orphan() 1141s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1141s 1141s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1141s backend_tree = backend.open_datatree( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1141s groups_dict = self.open_groups_as_dict( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1141s group_ds = store_entrypoint.open_dataset( 1141s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1141s vars, attrs = filename_or_obj.load() 1141s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1141s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1141s return Frozen(dict(*args, **kwargs)) 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s 1141s self = , name = 'b' 1141s 1141s def open_store_variable(self, name): 1141s zarr_array = self.members[name] 1141s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1141s try_nczarr = self._mode == "r" 1141s dimensions, attributes = _get_zarr_dims_and_attrs( 1141s zarr_array, DIMENSION_KEY, try_nczarr 1141s ) 1141s attributes = dict(attributes) 1141s 1141s encoding = { 1141s "chunks": zarr_array.chunks, 1141s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1141s } 1141s 1141s if _zarr_v3(): 1141s encoding.update( 1141s { 1141s "compressors": zarr_array.compressors, 1141s "filters": zarr_array.filters, 1141s "shards": zarr_array.shards, 1141s } 1141s ) 1141s if self.zarr_group.metadata.zarr_format == 3: 1141s encoding.update({"serializer": zarr_array.serializer}) 1141s else: 1141s encoding.update( 1141s { 1141s "compressor": zarr_array.compressor, 1141s "filters": zarr_array.filters, 1141s } 1141s ) 1141s 1141s if self._use_zarr_fill_value_as_mask: 1141s # Setting this attribute triggers CF decoding for missing values 1141s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1141s if zarr_array.fill_value is not None: 1141s attributes["_FillValue"] = zarr_array.fill_value 1141s elif "_FillValue" in attributes: 1141s original_zarr_dtype = zarr_array.metadata.data_type 1141s attributes["_FillValue"] = FillValueCoder.decode( 1141s > attributes["_FillValue"], original_zarr_dtype.value 1141s ) 1141s E AttributeError: 'Float64' object has no attribute 'value' 1141s 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1141s __ TestZarrDatatreeIO.test_open_datatree_specific_group[False-zarr_format=3] ___ 1141s 1141s self = 1141s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_specific_gr3') 1141s simple_datatree = 1141s Group: / 1141s │ Dimensions: (y: 3, x: 2) 1141s │ Dimensions without coordinates: y, x 1141s │ Data variables: 1141s ... a (x) int64 16B 2 3 1141s │ │ b (x) float64 16B 0.1 0.2 1141s │ └── Group: /set2/set1 1141s └── Group: /set3 1141s write_consolidated_metadata = False, zarr_format = 3 1141s 1141s @pytest.mark.filterwarnings( 1141s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1141s ) 1141s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1141s def test_open_datatree_specific_group( 1141s self, 1141s tmpdir, 1141s simple_datatree, 1141s write_consolidated_metadata, 1141s zarr_format, 1141s ) -> None: 1141s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1141s filepath = str(tmpdir / "test.zarr") 1141s group = "/set2" 1141s original_dt = simple_datatree 1141s original_dt.to_zarr( 1141s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1141s ) 1141s expected_subtree = original_dt[group].copy() 1141s expected_subtree.orphan() 1141s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1141s 1141s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1141s backend_tree = backend.open_datatree( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1141s groups_dict = self.open_groups_as_dict( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1141s group_ds = store_entrypoint.open_dataset( 1141s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1141s vars, attrs = filename_or_obj.load() 1141s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1141s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1141s return Frozen(dict(*args, **kwargs)) 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s 1141s self = , name = 'b' 1141s 1141s def open_store_variable(self, name): 1141s zarr_array = self.members[name] 1141s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1141s try_nczarr = self._mode == "r" 1141s dimensions, attributes = _get_zarr_dims_and_attrs( 1141s zarr_array, DIMENSION_KEY, try_nczarr 1141s ) 1141s attributes = dict(attributes) 1141s 1141s encoding = { 1141s "chunks": zarr_array.chunks, 1141s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1141s } 1141s 1141s if _zarr_v3(): 1141s encoding.update( 1141s { 1141s "compressors": zarr_array.compressors, 1141s "filters": zarr_array.filters, 1141s "shards": zarr_array.shards, 1141s } 1141s ) 1141s if self.zarr_group.metadata.zarr_format == 3: 1141s encoding.update({"serializer": zarr_array.serializer}) 1141s else: 1141s encoding.update( 1141s { 1141s "compressor": zarr_array.compressor, 1141s "filters": zarr_array.filters, 1141s } 1141s ) 1141s 1141s if self._use_zarr_fill_value_as_mask: 1141s # Setting this attribute triggers CF decoding for missing values 1141s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1141s if zarr_array.fill_value is not None: 1141s attributes["_FillValue"] = zarr_array.fill_value 1141s elif "_FillValue" in attributes: 1141s original_zarr_dtype = zarr_array.metadata.data_type 1141s attributes["_FillValue"] = FillValueCoder.decode( 1141s > attributes["_FillValue"], original_zarr_dtype.value 1141s ) 1141s E AttributeError: 'Float64' object has no attribute 'value' 1141s 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1141s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[None-zarr_format=3] ___ 1141s 1141s self = 1141s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_datatree_specific_gr5') 1141s simple_datatree = 1141s Group: / 1141s │ Dimensions: (y: 3, x: 2) 1141s │ Dimensions without coordinates: y, x 1141s │ Data variables: 1141s ... a (x) int64 16B 2 3 1141s │ │ b (x) float64 16B 0.1 0.2 1141s │ └── Group: /set2/set1 1141s └── Group: /set3 1141s write_consolidated_metadata = None, zarr_format = 3 1141s 1141s @pytest.mark.filterwarnings( 1141s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1141s ) 1141s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1141s def test_open_datatree_specific_group( 1141s self, 1141s tmpdir, 1141s simple_datatree, 1141s write_consolidated_metadata, 1141s zarr_format, 1141s ) -> None: 1141s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1141s filepath = str(tmpdir / "test.zarr") 1141s group = "/set2" 1141s original_dt = simple_datatree 1141s original_dt.to_zarr( 1141s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1141s ) 1141s expected_subtree = original_dt[group].copy() 1141s expected_subtree.orphan() 1141s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1141s 1141s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1141s backend_tree = backend.open_datatree( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1141s groups_dict = self.open_groups_as_dict( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1141s group_ds = store_entrypoint.open_dataset( 1141s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1141s vars, attrs = filename_or_obj.load() 1141s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1141s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1141s return Frozen(dict(*args, **kwargs)) 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s 1141s self = , name = 'b' 1141s 1141s def open_store_variable(self, name): 1141s zarr_array = self.members[name] 1141s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1141s try_nczarr = self._mode == "r" 1141s dimensions, attributes = _get_zarr_dims_and_attrs( 1141s zarr_array, DIMENSION_KEY, try_nczarr 1141s ) 1141s attributes = dict(attributes) 1141s 1141s encoding = { 1141s "chunks": zarr_array.chunks, 1141s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1141s } 1141s 1141s if _zarr_v3(): 1141s encoding.update( 1141s { 1141s "compressors": zarr_array.compressors, 1141s "filters": zarr_array.filters, 1141s "shards": zarr_array.shards, 1141s } 1141s ) 1141s if self.zarr_group.metadata.zarr_format == 3: 1141s encoding.update({"serializer": zarr_array.serializer}) 1141s else: 1141s encoding.update( 1141s { 1141s "compressor": zarr_array.compressor, 1141s "filters": zarr_array.filters, 1141s } 1141s ) 1141s 1141s if self._use_zarr_fill_value_as_mask: 1141s # Setting this attribute triggers CF decoding for missing values 1141s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1141s if zarr_array.fill_value is not None: 1141s attributes["_FillValue"] = zarr_array.fill_value 1141s elif "_FillValue" in attributes: 1141s original_zarr_dtype = zarr_array.metadata.data_type 1141s attributes["_FillValue"] = FillValueCoder.decode( 1141s > attributes["_FillValue"], original_zarr_dtype.value 1141s ) 1141s E AttributeError: 'Float64' object has no attribute 'value' 1141s 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1141s __________ TestZarrDatatreeIO.test_open_groups_chunks[zarr_format=3] ___________ 1141s 1141s self = 1141s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-0/test_open_groups_chunks_zarr_f1') 1141s zarr_format = 3 1141s 1141s @requires_dask 1141s def test_open_groups_chunks(self, tmpdir, zarr_format) -> None: 1141s """Test `open_groups` with chunks on a zarr store.""" 1141s 1141s chunks = {"x": 2, "y": 1} 1141s filepath = str(tmpdir / "test.zarr") 1141s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 1141s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 1141s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 1141s original_tree = DataTree.from_dict( 1141s { 1141s "/": root_data.chunk(chunks), 1141s "/group1": set1_data.chunk(chunks), 1141s "/group2": set2_data.chunk(chunks), 1141s } 1141s ) 1141s original_tree.to_zarr(filepath, mode="w", zarr_format=zarr_format) 1141s 1141s > dict_of_datasets = open_groups(filepath, engine="zarr", chunks=chunks) 1141s 1141s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:752: 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1141s backend_groups = backend.open_groups_as_dict( 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1141s group_ds = store_entrypoint.open_dataset( 1141s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1141s vars, attrs = filename_or_obj.load() 1141s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1141s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1141s return Frozen(dict(*args, **kwargs)) 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1141s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s 1141s self = , name = 'b' 1141s 1141s def open_store_variable(self, name): 1141s zarr_array = self.members[name] 1141s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1141s try_nczarr = self._mode == "r" 1141s dimensions, attributes = _get_zarr_dims_and_attrs( 1141s zarr_array, DIMENSION_KEY, try_nczarr 1141s ) 1141s attributes = dict(attributes) 1141s 1141s encoding = { 1141s "chunks": zarr_array.chunks, 1141s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1141s } 1141s 1141s if _zarr_v3(): 1141s encoding.update( 1141s { 1141s "compressors": zarr_array.compressors, 1141s "filters": zarr_array.filters, 1141s "shards": zarr_array.shards, 1141s } 1141s ) 1141s if self.zarr_group.metadata.zarr_format == 3: 1141s encoding.update({"serializer": zarr_array.serializer}) 1141s else: 1141s encoding.update( 1141s { 1141s "compressor": zarr_array.compressor, 1141s "filters": zarr_array.filters, 1141s } 1141s ) 1141s 1141s if self._use_zarr_fill_value_as_mask: 1141s # Setting this attribute triggers CF decoding for missing values 1141s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1141s if zarr_array.fill_value is not None: 1141s attributes["_FillValue"] = zarr_array.fill_value 1141s elif "_FillValue" in attributes: 1141s original_zarr_dtype = zarr_array.metadata.data_type 1141s attributes["_FillValue"] = FillValueCoder.decode( 1141s > attributes["_FillValue"], original_zarr_dtype.value 1141s ) 1141s E AttributeError: 'Float64' object has no attribute 'value' 1141s 1141s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1141s ______________________ test_normalize_token_with_backend _______________________ 1141s 1141s map_ds = Size: 9kB 1141s Dimensions: (x: 10, y: 20, z: 4) 1141s Coordinates: 1141s * x (x) int64 80B 0 1 2 3 4 5 6 7 8...2B 1 1 1 1 1141s e (x, y) int64 2kB 100 101 102 103 104 105 ... 124 125 126 127 128 1141s Attributes: 1141s test: test 1141s 1141s @requires_scipy_or_netCDF4 1141s def test_normalize_token_with_backend(map_ds): 1141s with create_tmp_file(allow_cleanup_failure=ON_WINDOWS) as tmp_file: 1141s map_ds.to_netcdf(tmp_file) 1141s > read = xr.open_dataset(tmp_file) 1141s 1141s /usr/lib/python3/dist-packages/xarray/tests/test_dask.py:1648: 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1141s backend_ds = backend.open_dataset( 1141s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:666: in open_dataset 1141s store = NetCDF4DataStore.open( 1141s /usr/lib/python3/dist-packages/xarray/backends/netCDF4_.py:414: in open 1141s import netCDF4 1141s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1141s 1141s # init for netCDF4. package 1141s # Docstring comes from extension module _netCDF4. 1141s > from ._netCDF4 import * 1141s E ModuleNotFoundError: No module named 'netCDF4._netCDF4' 1141s 1141s /usr/lib/python3/dist-packages/netCDF4/__init__.py:3: ModuleNotFoundError 1141s ______________________________ test_list_engines _______________________________ 1141s 1141s def test_list_engines() -> None: 1141s from xarray.backends import list_engines 1141s 1141s engines = list_engines() 1141s assert list_engines.cache_info().currsize == 1 1141s 1141s assert ("scipy" in engines) == has_scipy 1141s > assert ("h5netcdf" in engines) == has_h5netcdf 1141s E AssertionError: assert ('h5netcdf' in {'cfgrib': \n Open GRIB files (.grib, .grib2, .grb and .grb2) in Xarray\n Learn more at https://github....in Xarray\n Learn more at https://docs.xarray.dev/en/stable/generated/xarray.backends.ScipyBackendEntrypoint.html, ...}) == False 1141s 1141s /usr/lib/python3/dist-packages/xarray/tests/test_plugins.py:272: AssertionError 1141s =============================== warnings summary =============================== 1141s ../../../../usr/lib/python3/dist-packages/pyparsing/core.py:5637 1141s /usr/lib/python3/dist-packages/pyparsing/core.py:5637: SyntaxWarning: 'return' in a 'finally' block 1141s return f"{type(self).__name__}: {retString}" 1141s 1141s tests/test_backends.py: 539 warnings 1141s tests/test_backends_datatree.py: 15 warnings 1141s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:244: ZarrUserWarning: Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future. 1141s warnings.warn( 1141s 1141s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1141s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1141s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1141s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=6, endianness='little')) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1141s v3_unstable_dtype_warning(self) 1141s 1141s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1141s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1141s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1141s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/bytes.py:383: UnstableSpecificationWarning: The data type (NullTerminatedBytes(length=6)) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1141s v3_unstable_dtype_warning(self) 1141s 1141s tests/test_backends.py: 117 warnings 1141s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=1, endianness='little')) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1141s v3_unstable_dtype_warning(self) 1141s 1141s tests/test_backends.py: 12 warnings 1141s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/bytes.py:383: UnstableSpecificationWarning: The data type (NullTerminatedBytes(length=4)) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1141s v3_unstable_dtype_warning(self) 1141s 1141s tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_data[3] 1141s tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_string_data[3] 1141s tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_string_data[3] 1141s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=4, endianness='little')) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1141s v3_unstable_dtype_warning(self) 1141s 1141s tests/test_backends.py: 33 warnings 1141s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/bytes.py:383: UnstableSpecificationWarning: The data type (NullTerminatedBytes(length=2)) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1141s v3_unstable_dtype_warning(self) 1141s 1141s tests/test_backends.py: 33 warnings 1141s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=2, endianness='little')) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1141s v3_unstable_dtype_warning(self) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1141s /usr/lib/python3/dist-packages/numcodecs/zarr3.py:164: UserWarning: Numcodecs codecs are not in the Zarr version 3 specification and may not be supported by other zarr implementations. 1141s super().__init__(**codec_config) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1141s /usr/lib/python3/dist-packages/zarr/codecs/numcodecs/_codecs.py:139: ZarrUserWarning: Numcodecs codecs are not in the Zarr version 3 specification and may not be supported by other zarr implementations. 1141s super().__init__(**codec_config) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: '.zgroup' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: '.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'a/.zarray' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'a/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set0/.zarray' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set0/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/.zgroup' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/a/.zarray' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/a/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/b/.zarray' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/b/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/.zgroup' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/a/.zarray' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/a/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/b/.zarray' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/b/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set3/.zgroup' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set3/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set1/.zgroup' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set1/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set2/.zgroup' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set2/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/set1/.zgroup' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/set1/.zattrs' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'a/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set0/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/a/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/b/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/a/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/b/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set3/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set1/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set1/set2/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s /usr/lib/python3.14/zipfile/__init__.py:1739: UserWarning: Duplicate name: 'set2/set1/zarr.json' 1141s return self._open_to_write(zinfo, force_zip64=force_zip64) 1141s 1141s tests/test_conventions.py: 1 warning 1141s tests/test_rolling.py: 36 warnings 1141s /usr/lib/python3/dist-packages/xarray/core/duck_array_ops.py:237: RuntimeWarning: invalid value encountered in cast 1141s return data.astype(dtype, **kwargs) 1141s 1141s tests/test_dask.py: 12 warnings 1141s tests/test_units.py: 10 warnings 1141s /usr/lib/python3/dist-packages/numpy/_core/numeric.py:476: RuntimeWarning: invalid value encountered in cast 1141s multiarray.copyto(res, fill_value, casting='unsafe') 1141s 1141s tests/test_duck_array_ops.py: 16 warnings 1141s /usr/lib/python3/dist-packages/dask/array/core.py:5083: RuntimeWarning: overflow encountered in scalar add 1141s result = function(*args, **kwargs) 1141s 1141s tests/test_duck_array_ops.py::test_cftime_datetime_mean[True] 1141s /usr/lib/python3/dist-packages/dask/array/core.py:5083: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int. 1141s result = function(*args, **kwargs) 1141s 1141s tests/test_duck_array_wrapping.py::TestDataArrayMethods::test_astype[pint] 1141s /usr/lib/python3/dist-packages/pint/facets/numpy/quantity.py:88: RuntimeWarning: invalid value encountered in cast 1141s value = func(*args, **kwargs) 1141s 1141s tests/test_strategies.py: 12 warnings 1141s /usr/lib/python3/dist-packages/numpy/_core/fromnumeric.py:86: RuntimeWarning: invalid value encountered in reduce 1141s return ufunc.reduce(obj, axis, dtype, out, **passkwargs) 1141s 1141s tests/test_strategies.py::TestReduction::test_mean 1141s /usr/lib/python3/dist-packages/xarray/tests/test_strategies.py:277: RuntimeWarning: Mean of empty slice 1141s expected = np.nanmean(var.data, axis=reduction_axes) 1141s 1141s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-compatible_unit-function_clip] 1141s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-identical_unit-function_clip] 1141s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int64-compatible_unit-function_clip] 1141s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int64-identical_unit-function_clip] 1141s /usr/lib/python3/dist-packages/numpy/_core/fromnumeric.py:48: DeprecationWarning: __array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0) 1141s return conv.wrap(result, to_scalar=False) 1141s 1141s tests/test_units.py::TestDataArray::test_missing_value_filling[int64-method_ffill] 1141s tests/test_units.py::TestDataArray::test_missing_value_filling[int64-method_bfill] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2766: RuntimeWarning: invalid value encountered in cast 1141s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1141s 1141s tests/test_units.py: 15 warnings 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2803: RuntimeWarning: invalid value encountered in cast 1141s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataArray::test_dropna[int64] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2831: RuntimeWarning: invalid value encountered in cast 1141s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataArray::test_isin[int64-no_unit] 1141s tests/test_units.py::TestDataArray::test_isin[int64-dimensionless] 1141s tests/test_units.py::TestDataArray::test_isin[int64-incompatible_unit] 1141s tests/test_units.py::TestDataArray::test_isin[int64-compatible_unit] 1141s tests/test_units.py::TestDataArray::test_isin[int64-identical_unit] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2856: RuntimeWarning: invalid value encountered in cast 1141s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataArray::test_isin[int64-no_unit] 1141s tests/test_units.py::TestDataArray::test_isin[int64-dimensionless] 1141s tests/test_units.py::TestDataArray::test_isin[int64-incompatible_unit] 1141s tests/test_units.py::TestDataArray::test_isin[int64-compatible_unit] 1141s tests/test_units.py::TestDataArray::test_isin[int64-identical_unit] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2861: RuntimeWarning: invalid value encountered in cast 1141s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_ffill] 1141s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_bfill] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4252: RuntimeWarning: invalid value encountered in cast 1141s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_ffill] 1141s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_bfill] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4256: RuntimeWarning: invalid value encountered in cast 1141s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1141s 1141s tests/test_units.py: 15 warnings 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4295: RuntimeWarning: invalid value encountered in cast 1141s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1141s 1141s tests/test_units.py: 15 warnings 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4299: RuntimeWarning: invalid value encountered in cast 1141s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataset::test_dropna[int64] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4325: RuntimeWarning: invalid value encountered in cast 1141s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataset::test_dropna[int64] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4329: RuntimeWarning: invalid value encountered in cast 1141s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 1141s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 1141s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 1141s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 1141s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4353: RuntimeWarning: invalid value encountered in cast 1141s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 1141s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 1141s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 1141s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 1141s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4357: RuntimeWarning: invalid value encountered in cast 1141s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 1141s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 1141s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 1141s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 1141s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4362: RuntimeWarning: invalid value encountered in cast 1141s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataset::test_interpolate_na[int64] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4438: RuntimeWarning: invalid value encountered in cast 1141s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataset::test_interpolate_na[int64] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4442: RuntimeWarning: invalid value encountered in cast 1141s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1141s 1141s tests/test_units.py::TestDataset::test_combine_first[int64-data-no_unit] 1141s tests/test_units.py::TestDataset::test_combine_first[int64-data-dimensionless] 1141s tests/test_units.py::TestDataset::test_combine_first[int64-data-incompatible_unit] 1141s tests/test_units.py::TestDataset::test_combine_first[int64-data-compatible_unit] 1141s tests/test_units.py::TestDataset::test_combine_first[int64-data-same_unit] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4487: RuntimeWarning: invalid value encountered in cast 1141s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) * data_unit 1141s 1141s tests/test_units.py::TestDataset::test_combine_first[int64-data-no_unit] 1141s tests/test_units.py::TestDataset::test_combine_first[int64-data-dimensionless] 1141s tests/test_units.py::TestDataset::test_combine_first[int64-data-incompatible_unit] 1141s tests/test_units.py::TestDataset::test_combine_first[int64-data-compatible_unit] 1141s tests/test_units.py::TestDataset::test_combine_first[int64-data-same_unit] 1141s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4490: RuntimeWarning: invalid value encountered in cast 1141s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) * data_unit 1141s 1141s tests/test_variable.py::TestIndexVariable::test_to_index_multiindex_level 1141s /usr/lib/python3/dist-packages/xarray/tests/test_variable.py:2447: FutureWarning: the `pandas.MultiIndex` object(s) passed as 'x' coordinate(s) or data variable(s) will no longer be implicitly promoted and wrapped into multiple indexed coordinates in the future (i.e., one coordinate for each multi-index level + one dimension coordinate). If you want to keep this behavior, you need to first wrap it explicitly using `mindex_coords = xarray.Coordinates.from_pandas_multiindex(mindex_obj, 'dim')` and pass it as coordinates, e.g., `xarray.Dataset(coords=mindex_coords)`, `dataset.assign_coords(mindex_coords)` or `dataarray.assign_coords(mindex_coords)`. 1141s ds = Dataset(coords={"x": midx}) 1141s 1141s tests/test_weighted.py::test_weighted_quantile_3D[None-True-q1-a] 1141s tests/test_weighted.py::test_weighted_quantile_3D[True-True-0.5-a] 1141s /usr/lib/python3/dist-packages/numpy/lib/_nanfunctions_impl.py:1617: RuntimeWarning: All-NaN slice encountered 1141s return fnb._ureduce(a, 1141s 1141s -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 1141s =========================== short test summary info ============================ 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[2] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[2] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[2] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_store[3] - Attri... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_test_data[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_load[3] - AttributeErr... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_dataset_compute[3] - A... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_object_dtype[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_float64_data[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_orthogonal_indexing[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing_negative_step[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_outer_indexing_reversed[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_isel_dataarray[3] - At... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_array_type_after_indexing[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_dropna[3] - AttributeE... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_ondisk_after_print[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_bytes_with_fill_value[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value0-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value1-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3--1-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-255-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_coordinate_variables_after_dataset_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_kwarg[3] - At... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_default_fill_value[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_same_dtype[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_append_overwrite_values[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_read_non_consolidated_warning[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_auto_chunk[3] - Attrib... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_manual_chunk[3] - Attr... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_warning_on_bad_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_uneven_dask_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding[3] - At... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_shard_encoding[3] - At... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-group1] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_compressor_encoding[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_group[3] - AttributeEr... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_append_write[3] - Attr... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_not_set_raises[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-U] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-S] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_check_encoding_is_consistent_after_append[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_new_variable[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_no_overwrite[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_compute_false_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_append_compute_false_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_no_warning_from_open_emptydim_with_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-False] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-True] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-None] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-r+] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-a] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_preexisting_override_metadata[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_chunksizes[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_partial_dask_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_open_zarr_use_cftime[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_write_read_select_write[3] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_attributes[3-obj1] - A... 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1141s FAILED tests/test_backends.py::TestZarrDictStore::test_zarr_fill_value_setting[3-float] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_store[3] - ... 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_test_data[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_load[3] - Attribu... 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dataset_compute[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_object_dtype[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_float64_data[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_orthogonal_indexing[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing_negative_step[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_outer_indexing_reversed[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_isel_dataarray[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_array_type_after_indexing[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dropna[3] - Attri... 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_ondisk_after_print[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_bytes_with_fill_value[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value0-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value1-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3--1-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-255-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_coordinate_variables_after_dataset_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_kwarg[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_default_fill_value[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_same_dtype[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_overwrite_values[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_read_non_consolidated_warning[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_auto_chunk[3] - A... 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_manual_chunk[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_warning_on_bad_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_uneven_dask_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_shard_encoding[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-group1] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_compressor_encoding[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_group[3] - Attrib... 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_write[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_not_set_raises[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-U] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-S] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_check_encoding_is_consistent_after_append[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_new_variable[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_no_overwrite[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_compute_false_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_append_compute_false_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_no_warning_from_open_emptydim_with_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-False] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-True] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-None] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-r+] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-a] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_preexisting_override_metadata[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_chunksizes[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding_with_partial_dask_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_open_zarr_use_cftime[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_read_select_write[3] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_attributes[3-obj1] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1141s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zarr_fill_value_setting[3-float] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_store[3] - Attr... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_test_data[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_load[3] - AttributeEr... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dataset_compute[3] - ... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_object_dtype[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_float64_data[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_orthogonal_indexing[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing_negative_step[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_outer_indexing_reversed[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_isel_dataarray[3] - A... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_array_type_after_indexing[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dropna[3] - Attribute... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_ondisk_after_print[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_bytes_with_fill_value[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value0-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value1-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3--1-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-255-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_coordinate_variables_after_dataset_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_kwarg[3] - A... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_default_fill_value[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_same_dtype[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_overwrite_values[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_read_non_consolidated_warning[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_auto_chunk[3] - Attri... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_manual_chunk[3] - Att... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_warning_on_bad_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_uneven_dask_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding[3] - A... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_shard_encoding[3] - A... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-group1] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_compressor_encoding[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_group[3] - AttributeE... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_write[3] - Att... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_not_set_raises[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-U] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-S] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_check_encoding_is_consistent_after_append[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_new_variable[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_no_overwrite[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_compute_false_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_append_compute_false_roundtrip[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_no_warning_from_open_emptydim_with_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-r+] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-a] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_preexisting_override_metadata[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_chunksizes[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding_with_partial_dask_chunks[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_open_zarr_use_cftime[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_read_select_write[3] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_attributes[3-obj1] - ... 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zarr_fill_value_setting[3-float] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-None] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-True] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-False] 1141s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-None] 1141s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-full-auto] 1141s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-mixed-auto] 1141s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_index_write[3] 1141s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region[3] - Attr... 1141s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_append_chunk_partial[3] 1141s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_chunk_partial_offset[3] 1141s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_append_dim[3] 1141s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-r+] 1141s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-a] 1141s FAILED tests/test_backends.py::TestScipyFilePath::test_roundtrip_example_1_netcdf_gz 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_zero_dimensional_variable 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_test_data 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_load - ModuleNotFo... 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_dataset_compute - ... 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_pickle - ModuleNot... 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_pickle_dataarray 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_dataset_caching - ... 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_None_variable 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_object_dtype 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_string_data 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_string_encoded_characters 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_numpy_datetime_data 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_cftime_datetime_data 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_timedelta_data 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_float64_data 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_coordinates 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_global_coordinates 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_coordinates_with_space 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_boolean_dtype 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_orthogonal_indexing 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_vectorized_indexing 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_vectorized_indexing_negative_step 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_outer_indexing_reversed 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_isel_dataarray - M... 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_array_type_after_indexing 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_dropna - ModuleNot... 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_ondisk_after_print 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_bytes_with_fill_value 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_empty_vlen_string_array 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[fill_value0-False] 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[fill_value1-True] 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[-1-False] 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_roundtrip_unsigned[255-True] 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_grid_mapping_and_bounds_are_not_coordinates_in_file 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_coordinate_variables_after_dataset_roundtrip 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_coordinates_encoding 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_kwarg - M... 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_kwarg_dates 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_kwarg_fixed_width_string 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_default_fill_value 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value_via_encoding_kwarg 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value_in_coord 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_same_dtype 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_append_write - Mod... 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_append_overwrite_values 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_multiindex_not_implemented 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_string_object_warning 1141s FAILED tests/test_backends.py::TestGenericNetCDFData::test_encoding_unlimited_dims 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-all-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-all-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-minimal-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-minimal-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-different-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[outer-different-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-all-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-all-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-minimal-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-minimal-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-different-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[inner-different-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-all-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-all-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-minimal-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-minimal-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-different-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[left-different-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-all-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-all-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-minimal-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-minimal-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-different-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_does_same_as_concat[right-different-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[drop] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[override] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[no_conflicts] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[identical] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_combine_attrs[drop_conflicts] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataset_attr_by_coords 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_dataarray_attr_by_coords 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[all-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[all-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[minimal-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[minimal-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[different-nested-t] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_open_mfdataset_exact_join_raises_error[different-by_coords-None] 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_common_coord_when_datavars_all 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_common_coord_when_datavars_minimal 1141s FAILED tests/test_backends.py::TestOpenMFDatasetWithDataVarsAndCoordsKw::test_invalid_data_vars_value_should_fail 1141s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_no_name 1141s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_with_name 1141s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_coord_name_clash 1141s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_open_dataarray_options 1141s FAILED tests/test_backends.py::TestDataArrayToNetCDF::test_dataarray_to_netcdf_no_name_pathlib 1141s FAILED tests/test_backends.py::test_source_encoding_always_present - ModuleNo... 1141s FAILED tests/test_backends.py::test_source_encoding_always_present_with_pathlib 1141s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_in_range[gregorian] 1141s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_in_range[proleptic_gregorian] 1141s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_in_range[standard] 1141s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_out_of_range[standard] 1141s FAILED tests/test_backends.py::test_use_cftime_standard_calendar_default_out_of_range[gregorian] 1141s FAILED tests/test_backends.py::test_use_cftime_true[1500-360_day] - ModuleNot... 1141s FAILED tests/test_backends.py::test_use_cftime_true[1500-365_day] - ModuleNot... 1141s FAILED tests/test_backends.py::test_use_cftime_true[1500-366_day] - ModuleNot... 1141s FAILED tests/test_backends.py::test_use_cftime_true[1500-all_leap] - ModuleNo... 1141s FAILED tests/test_backends.py::test_use_cftime_true[1500-gregorian] - ModuleN... 1141s FAILED tests/test_backends.py::test_use_cftime_true[1500-julian] - ModuleNotF... 1141s FAILED tests/test_backends.py::test_use_cftime_true[1500-noleap] - ModuleNotF... 1141s FAILED tests/test_backends.py::test_use_cftime_true[1500-proleptic_gregorian] 1141s FAILED tests/test_backends.py::test_use_cftime_true[1500-standard] - ModuleNo... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2000-360_day] - ModuleNot... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2000-365_day] - ModuleNot... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2000-366_day] - ModuleNot... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2000-all_leap] - ModuleNo... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2000-gregorian] - ModuleN... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2000-julian] - ModuleNotF... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2000-noleap] - ModuleNotF... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2000-proleptic_gregorian] 1141s FAILED tests/test_backends.py::test_use_cftime_true[2000-standard] - ModuleNo... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2500-360_day] - ModuleNot... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2500-365_day] - ModuleNot... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2500-366_day] - ModuleNot... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2500-all_leap] - ModuleNo... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2500-gregorian] - ModuleN... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2500-julian] - ModuleNotF... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2500-noleap] - ModuleNotF... 1141s FAILED tests/test_backends.py::test_use_cftime_true[2500-proleptic_gregorian] 1141s FAILED tests/test_backends.py::test_use_cftime_true[2500-standard] - ModuleNo... 1141s FAILED tests/test_backends.py::test_use_cftime_false_standard_calendar_out_of_range[standard] 1141s FAILED tests/test_backends.py::test_use_cftime_false_standard_calendar_out_of_range[gregorian] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-360_day] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-365_day] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-366_day] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-all_leap] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-julian] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[1500-noleap] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-360_day] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-365_day] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-366_day] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-all_leap] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-julian] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2000-noleap] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-360_day] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-365_day] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-366_day] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-all_leap] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-julian] 1141s FAILED tests/test_backends.py::test_use_cftime_false_nonstandard_calendar[2500-noleap] 1141s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[auto] - Attrib... 1141s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[-1] - Attribut... 1141s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks2] - Att... 1141s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks3] - Att... 1141s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks4] - Att... 1141s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks5] - Att... 1141s FAILED tests/test_backends.py::test_chunking_consintency[auto] - AttributeErr... 1141s FAILED tests/test_backends.py::test_chunking_consintency[-1] - AttributeError... 1141s FAILED tests/test_backends.py::test_chunking_consintency[chunks2] - Attribute... 1141s FAILED tests/test_backends.py::test_chunking_consintency[chunks3] - Attribute... 1141s FAILED tests/test_backends.py::test_chunking_consintency[chunks4] - Attribute... 1141s FAILED tests/test_backends.py::test_chunking_consintency[chunks5] - Attribute... 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr[zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_not_consolidated[zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_round_trip[zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree[zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_chunks[zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups[zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[True-zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[False-zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[None-zarr_format=3] 1141s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_chunks[zarr_format=3] 1141s FAILED tests/test_dask.py::test_normalize_token_with_backend - ModuleNotFound... 1141s FAILED tests/test_plugins.py::test_list_engines - AssertionError: assert ('h5... 1141s = 514 failed, 18347 passed, 2690 skipped, 51 deselected, 234 xfailed, 56 xpassed, 988 warnings in 856.64s (0:14:16) = 1145s E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build; python3.14 -m pytest --deselect=tests/test_weighted.py::test_weighted_operations_keep_attr --deselect=tests/test_variable.py::TestVariable::test_reduce_keepdims --deselect=tests/test_backends.py::test_zarr_region_chunk_partial_offset --deselect=tests/test_backends.py::test_chunk_encoding_with_dask --pyargs xarray 1145s I: pybuild base:311: cd /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build; python3.13 -m pytest --deselect=tests/test_weighted.py::test_weighted_operations_keep_attr --deselect=tests/test_variable.py::TestVariable::test_reduce_keepdims --deselect=tests/test_backends.py::test_zarr_region_chunk_partial_offset --deselect=tests/test_backends.py::test_chunk_encoding_with_dask --pyargs xarray 1157s ============================= test session starts ============================== 1157s platform linux -- Python 3.13.9, pytest-8.3.5, pluggy-1.6.0 1157s rootdir: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build 1157s configfile: pyproject.toml 1157s plugins: typeguard-4.4.2, hypothesis-6.130.5, mypy-plugins-3.2.0, zarr-3.1.3, xdist-3.8.0 1157s collected 21888 items / 51 deselected / 4 skipped / 21837 selected 1157s 1158s tests/test_accessor_dt.py .............................................. [ 0%] 1158s ........................................................................ [ 0%] 1159s ........................................................................ [ 0%] 1160s ........................................................................ [ 1%] 1161s ........................................................................ [ 1%] 1161s .................... [ 1%] 1162s tests/test_accessor_str.py ............................................. [ 1%] 1162s ........................................................................ [ 2%] 1162s ........................................................................ [ 2%] 1162s ...................................... [ 2%] 1162s tests/test_assertions.py .............................. [ 2%] 1164s tests/test_backends.py .................s...............XxXxXXxXxX...... [ 3%] 1166s .s.s....................................................s............... [ 3%] 1169s ....s..............XxXxXXxXxX.......s.s................................. [ 3%] 1171s ..................s..s...................s...............XxXsXsssss..... [ 4%] 1177s ..s..................Fs........s.s.................ss................... [ 4%] 1183s ..........................................................s............. [ 4%] 1191s ..XxXsXsssss.......s..................Fs........s.s.................ss.. [ 5%] 1199s ........................................................................ [ 5%] 1208s ...s...............XxXsXsssss.......s..................Fs........s.s.... [ 5%] 1216s .............ss......................................................... [ 5%] 1228s .....FFF......................FFFFF...F.....Fs....FFFFFFFFF..xxxsxsssssF [ 6%] 1247s FFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ssFFFFFFFFFFFFFFFFF [ 6%] 1267s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF...F.....Fs....FFFFF [ 6%] 1284s FFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss.FFFF...F....F..ss [ 7%] 1308s FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.FF.FFF...FFFFFF... [ 7%] 1327s F.....Fs....FFFFFFFFF..xxxsxsssssFFFFFFFs.s.F.F..FFFF..FFFFFsFFF.FFF.ss. [ 7%] 1349s FFFF...F....F..ssFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FF.F [ 8%] 1361s F.FFF...FFFFFFFFFF....FF.F.F.FFFFFs..................s...............XxX [ 8%] 1363s sXXxXsX.......s.s................................s...............XxXsXXx [ 8%] 1365s XsX.......s.s...............ss.................s...............XxXsXXxXs [ 9%] 1366s X.......s.s....................................s...............XxXsXXxXs [ 9%] 1368s X.......s.s.................................s...............XxXsXXxXsX.. [ 9%] 1370s .....s.s...............................s...............XxXsXXxXsX....... [ 10%] 1374s s.s...................................s...............XxXsXXxXsX.......s [ 10%] 1376s .s.............................................sss...................... [ 10%] 1380s .......s...............XxXsXXxXsX.......s.s............................. [ 11%] 1385s ................sss.............................s...............XxXsXXxX [ 11%] 1388s sX.......s.s.............................................sss...........s [ 11%] 1389s ..ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.... [ 12%] 1391s .................................................s..................s... [ 12%] 1392s ..........................sssssss..x........s..s..s..s.sss.............. [ 12%] 1397s ......................XXX........................s.FFFFFFFFFFFF......Fss [ 13%] 1398s . [ 13%] 1398s tests/test_backends_api.py ........................ [ 13%] 1398s tests/test_backends_common.py ... [ 13%] 1402s tests/test_backends_datatree.py ..................F.FFF.F.......F.F.F.F. [ 13%] 1403s F.F.F.F...... [ 13%] 1406s tests/test_backends_file_manager.py ............................... [ 13%] 1406s tests/test_backends_locks.py . [ 13%] 1406s tests/test_backends_lru_cache.py ........ [ 13%] 1408s tests/test_calendar_ops.py ........................... [ 13%] 1408s tests/test_cftime_offsets.py ........................................... [ 14%] 1408s ........................................................................ [ 14%] 1408s ........................................................................ [ 14%] 1409s ........................................................................ [ 15%] 1409s ........................................................................ [ 15%] 1409s ........................................................................ [ 15%] 1409s ........................................................................ [ 16%] 1409s ........................................................................ [ 16%] 1409s ........................................................................ [ 16%] 1409s ........................................................................ [ 17%] 1409s ........................................................................ [ 17%] 1409s ........................................................................ [ 17%] 1409s ........................................................................ [ 18%] 1409s ........................................................................ [ 18%] 1409s ........................................................................ [ 18%] 1409s ........................................................................ [ 19%] 1409s ........................................................................ [ 19%] 1409s ........................................................................ [ 19%] 1410s ........................................................................ [ 20%] 1410s ........................................................................ [ 20%] 1410s ........................................................................ [ 20%] 1410s ........................................................................ [ 21%] 1410s ........................................................................ [ 21%] 1410s ........................................................................ [ 21%] 1410s ........................................................................ [ 22%] 1410s ........................................................................ [ 22%] 1410s ........................................................................ [ 22%] 1410s ........................................................................ [ 23%] 1410s ........................................................................ [ 23%] 1410s ........................................................................ [ 23%] 1410s ........................................................................ [ 24%] 1410s ........................................................................ [ 24%] 1410s ........................................................................ [ 24%] 1411s ........................................................................ [ 24%] 1411s ........................................................................ [ 25%] 1411s ........................................................................ [ 25%] 1411s ........................................................................ [ 25%] 1411s ........................................................................ [ 26%] 1411s ........................................................................ [ 26%] 1411s .............ssssssssssssssssssssssssssssssssssssssssssssssssssssssss... [ 26%] 1411s .ssss....ssss....ssss....ssss.................................. [ 27%] 1411s tests/test_cftimeindex.py .............................................. [ 27%] 1411s ........................................................................ [ 27%] 1411s ........................................................................ [ 28%] 1411s ........................................................................ [ 28%] 1411s ........................................................................ [ 28%] 1412s ........................................................................ [ 29%] 1412s ........................................................................ [ 29%] 1412s ........................................................................ [ 29%] 1412s ........................................................................ [ 30%] 1412s ........................................................................ [ 30%] 1412s ........................................................................ [ 30%] 1413s ........................................................................ [ 31%] 1413s ...........................................x............................ [ 31%] 1413s ........................................................................ [ 31%] 1413s ................................................ [ 31%] 1413s tests/test_cftimeindex_resample.py ..................................... [ 32%] 1414s ........................................................................ [ 32%] 1415s ........................................................................ [ 32%] 1415s ........................................................................ [ 33%] 1416s ........................................................................ [ 33%] 1417s ........................................................................ [ 33%] 1417s ........................................................................ [ 34%] 1418s ................................................ [ 34%] 1418s tests/test_coarsen.py .................................................. [ 34%] 1419s ........................................................................ [ 34%] 1420s ..........s.......s.......s.......s.......s.......s.......s.......s..... [ 35%] 1420s .... [ 35%] 1420s tests/test_coding.py ............................... [ 35%] 1420s tests/test_coding_strings.py ....................... [ 35%] 1420s tests/test_coding_times.py ............................................. [ 35%] 1420s ........................................................................ [ 36%] 1420s ........................................................................ [ 36%] 1421s ........................................................................ [ 36%] 1421s ........................................................................ [ 37%] 1421s ........................................................................ [ 37%] 1421s ........................................................................ [ 37%] 1421s ........................................................................ [ 38%] 1422s ........................................................................ [ 38%] 1422s ........................................................................ [ 38%] 1422s ...................s..................................................XX [ 39%] 1422s X....................................................................... [ 39%] 1422s ........................................................................ [ 39%] 1422s ......................................ssssssss......s......s......s..... [ 39%] 1424s .s......s............................................................... [ 40%] 1424s .......................................................... [ 40%] 1425s tests/test_combine.py .......................................x.......... [ 40%] 1425s ...................................................... [ 41%] 1425s tests/test_computation.py .............................................. [ 41%] 1426s ........................................................................ [ 41%] 1429s ........................................................................ [ 41%] 1431s ........................................................................ [ 42%] 1432s ..................................XxXx. [ 42%] 1432s tests/test_concat.py ................................................... [ 42%] 1433s ................................................. [ 42%] 1433s tests/test_conventions.py .............................................. [ 43%] 1434s ...s..............XxXsXXxXsX.......s.s............s........... [ 43%] 1434s tests/test_coordinate_transform.py ............ [ 43%] 1434s tests/test_coordinates.py ...................... [ 43%] 1436s tests/test_dask.py ..................................................... [ 43%] 1450s ..........XXx.X......................................................... [ 44%] 1451s ........................................................................ [ 44%] 1452s ...................... [ 44%] 1452s tests/test_dataarray.py ................................................ [ 44%] 1453s ........................................................................ [ 45%] 1453s ........................................................................ [ 45%] 1454s ........................................................................ [ 45%] 1455s s...ss......................................Xx.......................... [ 46%] 1456s ..........................ss....ss...................................... [ 46%] 1459s ............x.....................................x.......x............. [ 46%] 1460s ................sssssssssssss.................ss...... [ 47%] 1508s tests/test_dataarray_typing.yml .............. [ 47%] 1511s tests/test_dataset.py .................................................. [ 47%] 1511s ........................................................................ [ 47%] 1512s ......Xx...................................................s............ [ 47%] 1512s ..............................................s......................... [ 48%] 1513s ........................................................................ [ 48%] 1514s ...............................................................ss....ss. [ 48%] 1515s ......................................................................ss [ 49%] 1515s ... [ 49%] 1561s tests/test_dataset_typing.yml .............. [ 49%] 1562s tests/test_datatree.py ............................xx..........x......x. [ 49%] 1562s ........................................................................ [ 49%] 1562s ........x.......... [ 49%] 1562s tests/test_datatree_mapping.py .............x........ [ 50%] 1610s tests/test_datatree_typing.yml .............. [ 50%] 1610s tests/test_deprecation_helpers.py .. [ 50%] 1610s tests/test_dtypes.py ................................................... [ 50%] 1610s ...sss... [ 50%] 1611s tests/test_duck_array_ops.py ......s...........s.................XX..... [ 50%] 1611s ................XX.....................XX.....................XX..s..... [ 50%] 1612s ..................................ss..............ss..............ss.... [ 51%] 1613s ..ss......ss..............ss............................................ [ 51%] 1615s ..........ss......ss..............................ss..............ss.... [ 51%] 1616s ..........ss......ss......ss..............ss............................ [ 52%] 1618s ..........................ss......ss................ssssssssss.......... [ 52%] 1618s ssssssssss..........ssssssssss..........ssssssssss..........ssssss...... [ 52%] 1619s ........ssssss..............ssssss..............ssssss..............ssss [ 53%] 1620s sssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s.s.s.sssssssssss.s.s. [ 53%] 1620s s.s.sssssss.s.s.s.s.s.s.sssssss.s.s.s.s.s.s.sssssss.s.s.s.s.s.s.sssssss. [ 53%] 1621s s.s.s.s.s.s............................................................. [ 54%] 1622s ........................................................................ [ 54%] 1623s ........................................................................ [ 54%] 1624s ........................................................................ [ 55%] 1625s ........................................................................ [ 55%] 1626s ........................................................................ [ 55%] 1629s ........................................................ [ 56%] 1629s tests/test_duck_array_wrapping.py s.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.sxss.s [ 56%] 1630s .ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.s.ssXsxss.sxss.sxss.sxss.s.ss.s.s [ 56%] 1630s sxsxssxsxssxsxss.s.ss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.sxssxsxss.s.ss.s.ss. [ 57%] 1631s sxss.sxss.s.ss.s.ss.s.ss.s.ss.sxss.s.ss.s.ss.s.ss.s.ssXsxss.s.ss.sxss.sx [ 57%] 1631s ss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.sxss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss [ 57%] 1631s .s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ss.s.ssxs [ 57%] 1631s xss.s.ss.s.ss.s.ssxs.ss.s.ssxsxss.s.ss.s.ss.s.ssxsxss.s.ss.s.ss.s.ss.s.s [ 58%] 1631s s.s.ss.s.ss.s.ss.s.s [ 58%] 1631s tests/test_error_messages.py .. [ 58%] 1631s tests/test_extensions.py .... [ 58%] 1632s tests/test_formatting.py ............................................... [ 58%] 1632s ..... [ 58%] 1632s tests/test_formatting_html.py ........................ [ 58%] 1634s tests/test_groupby.py ......................s........................... [ 59%] 1635s ...............................ss....................................... [ 59%] 1636s ........................................................................ [ 59%] 1637s .............................................................sssssssss.. [ 60%] 1638s ..s..............sssssssssss............. [ 60%] 1638s tests/test_hashable.py ........ [ 60%] 1638s tests/test_indexes.py .................................................. [ 60%] 1638s ........................ [ 60%] 1639s tests/test_indexing.py ................................................. [ 60%] 1639s ........................................................................ [ 61%] 1639s ............... [ 61%] 1648s tests/test_interp.py ................................................... [ 61%] 1656s .x...................................................................... [ 61%] 1672s ................................................................sss..sss [ 62%] 1693s ..sss..sss..sss..sss..sss..sss............... [ 62%] 1693s tests/test_merge.py .................................................... [ 62%] 1693s ... [ 62%] 1696s tests/test_missing.py .................................................. [ 62%] 1696s ..................s...........................................x.. [ 63%] 1697s tests/test_namedarray.py ....x...........................s.............. [ 63%] 1697s .. [ 63%] 1697s tests/test_nputils.py .. [ 63%] 1697s tests/test_options.py ................... [ 63%] 1697s tests/test_pandas_to_xarray.py xxxxxxxxxxxxxxxxxxxxxxxsxxxxxx........... [ 63%] 1697s ....................... [ 63%] 1697s tests/test_parallelcompat.py ............... [ 63%] 1699s tests/test_plot.py ..................................................... [ 63%] 1701s ........................................................................ [ 64%] 1706s ........................................................................ [ 64%] 1710s ...............................................s........................ [ 64%] 1715s .............X.......................................................x.. [ 65%] 1735s ss.ssss................................................................. [ 65%] 1736s .......sss.............................................................. [ 65%] 1737s .......................................... [ 66%] 1737s tests/test_plugins.py ............. [ 66%] 1738s tests/test_print_versions.py . [ 66%] 1742s tests/test_rolling.py .................................................. [ 66%] 1745s ........................................................................ [ 66%] 1748s ........................................................................ [ 67%] 1749s ........................................................................ [ 67%] 1753s ........................................................................ [ 67%] 1755s ........................................................................ [ 68%] 1756s ........................................................................ [ 68%] 1756s ........................................................................ [ 68%] 1757s ........................................................................ [ 69%] 1757s ........................................................................ [ 69%] 1759s ........................................................................ [ 69%] 1765s ........................................................................ [ 70%] 1768s ........................................................................ [ 70%] 1772s ........................................................................ [ 70%] 1773s ........................................................................ [ 71%] 1773s ........................................................................ [ 71%] 1773s ........................................................................ [ 71%] 1775s ........................................................................ [ 72%] 1778s ........................................................................ [ 72%] 1781s ........................................................................ [ 72%] 1785s ........................................................................ [ 73%] 1786s ........................................................................ [ 73%] 1786s ........................................................................ [ 73%] 1787s ........................................................................ [ 74%] 1788s ........................................................................ [ 74%] 1793s ........................................................................ [ 74%] 1797s ........................................................................ [ 75%] 1801s ........................................................................ [ 75%] 1802s ........................................................................ [ 75%] 1802s ........................................................................ [ 76%] 1803s ........................................................................ [ 76%] 1810s ........................................................................ [ 76%] 1812s ...........ssssssssssssssssssssssssssssssssssssssssss................... [ 77%] 1813s ........................................................................ [ 77%] 1813s ........................................................................ [ 77%] 1814s ........................................................................ [ 78%] 1814s ........................................................................ [ 78%] 1815s ........................................................................ [ 78%] 1816s ........................................................ssssssssssssssss [ 78%] 1816s ........................................................................ [ 79%] 1817s ........................................................................ [ 79%] 1818s ........................................................................ [ 79%] 1818s ........................................................................ [ 80%] 1822s ........................................................................ [ 80%] 1828s ........................................................................ [ 80%] 1833s ssssssssssssssss........................................................ [ 81%] 1838s ........................................................................ [ 81%] 1844s ........................................................................ [ 81%] 1849s ........................................................................ [ 82%] 1856s ........................................................................ [ 82%] 1856s ........sss [ 82%] 1871s tests/test_strategies.py ..................... [ 82%] 1871s tests/test_treenode.py .................................. [ 82%] 1874s tests/test_tutorial.py XXss [ 82%] 1874s tests/test_typed_ops.py ..... [ 82%] 1874s tests/test_ufuncs.py ................................................... [ 83%] 1874s .......................................................................x [ 83%] 1874s .. [ 83%] 1875s tests/test_units.py .s..s..s..s......sssssxxxxx.....sssss.xxxx.....sssss [ 83%] 1879s xxxxx.....sssss.xxxx.....sssssxxxxx.....sssss.xxxx.....sssssxxxxx.....ss [ 84%] 1880s sss.xxxx.........sssss..........sssss..........sssss..........sssss..... [ 84%] 1881s .....sssss..........sssss..........sssss..........sssss..........sssss.. [ 84%] 1881s ........sssss..........sssss..........sssss......s..s..s..s..s..s..s..s. [ 85%] 1882s .sx.sx.sx.sx............................................................ [ 85%] 1882s ........................................................................ [ 85%] 1883s ...................ssssssssss..........ssssssssss....................... [ 86%] 1883s ........................................................................ [ 86%] 1883s ...................................ss..XX............ss..XX............. [ 86%] 1883s ........................................................................ [ 87%] 1883s .....................s..s..ss....ss......ss..s.......................ss. [ 87%] 1883s .s...................................................................... [ 87%] 1891s ....x....x......................xxxxx.....xxxxx.x.x.x.x.x.x.x.x.x.x..... [ 88%] 1893s .xxxx................................................................... [ 88%] 1893s ...............x...............sssss.....sssssssssssssss.....sssss.....s [ 88%] 1893s ssssssssssssss.....sssss..........sssss..................s..s..s..s.ssss [ 89%] 1894s ss.s..s..s..s..s..s..s..s.ssssss.s..s..s..s...........ssssssssssssssssss [ 89%] 1894s ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 89%] 1897s ........................................................xx..xx..ssssssss [ 90%] 1899s ssssssssssssxx..xx..ssssssssssssssssssss......ss....s......s..s.s.s.s.s. [ 90%] 1900s s...ss....ss....ss....ss....ss....ss....ss....ss...s..s..s.xs.sss.s..s.. [ 90%] 1900s s..s.xs.sss.s.....ss....ss....ss....ss....ss....ss....ss....ss.......sss [ 91%] 1901s ss..........sssss.......ss....ss........................................ [ 91%] 1902s ....................xxxx................................................ [ 91%] 1904s ..................................xx.....sssss.....sssss.....sssss.....s [ 92%] 1904s ssssssssssssss.....sssss.....sssssssssssssss.....sssss.....sssss........ [ 92%] 1904s .......sss...sssxx....s......s......ssssssssssssssssssssssssssssssssssss [ 92%] 1905s ssssssssssssssssssssssssssssssssssssssssssssssssssssss...sss......sss... [ 93%] 1907s ..................................................xx..xx..ssssssssssssss [ 93%] 1910s ssssssxx..xx..ssssssssssssssssssss............ssssssssssss.............. [ 93%] 1911s ..........ssssssssssss...............xx.ssssss...Xx....xx.ssssss...Xx..s [ 93%] 1912s ..s...........ssssssssss....................ssssssssss.................. [ 94%] 1913s s.....ssssssssssssss........s.............s.....ssssssssssssss........s. [ 94%] 1914s .........sssss..........sssss.......x.x.x.... [ 94%] 1914s tests/test_utils.py .................................................... [ 95%] 1914s .............. [ 95%] 1914s tests/test_variable.py ................................................. [ 95%] 1914s ........................................................................ [ 95%] 1914s ........................................................................ [ 96%] 1914s ........................................................................ [ 96%] 1916s ........................................................................ [ 96%] 1925s .................ssss...............x.xX.......xX.......xx.......xx..... [ 97%] 1926s ..xx.......s............................................................ [ 97%] 1926s ........................ssssssssssssssssssssssssssssssssssssssssssssssss [ 97%] 1926s sssssss..........................ssss....................... [ 97%] 1927s tests/test_weighted.py ................................................. [ 98%] 1927s ........................................................ssssssssssssssss [ 98%] 1927s ssssssssssssssssssssssssssssssssssssssssssssssssssssssss................ [ 98%] 1930s ........................................................................ [ 99%] 1931s ........................................................................ [ 99%] 1934s ........................................................................ [ 99%] 1936s ................................... [100%] 1936s 1936s =================================== FAILURES =================================== 1936s _________________ TestZarrDictStore.test_non_existent_store[2] _________________ 1936s 1936s self = 1936s 1936s def test_non_existent_store(self) -> None: 1936s with pytest.raises( 1936s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1936s ): 1936s > xr.open_zarr(f"{uuid.uuid4()}") 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1936s store = ZarrStore.open_group( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1936s ) = _get_open_params( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1936s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1936s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1936s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1936s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1936s raise return_result 1936s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1936s return await coro 1936s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1936s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1936s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1936s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1936s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1936s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1936s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1936s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1936s await store._open() 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/ea7e3ec3-e1b1-4ea8-a884-a68bcb5c8072') 1936s 1936s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1936s if not self.read_only: 1936s self.root.mkdir(parents=True, exist_ok=True) 1936s 1936s if not self.root.exists(): 1936s > raise FileNotFoundError(f"{self.root} does not exist") 1936s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/ea7e3ec3-e1b1-4ea8-a884-a68bcb5c8072 does not exist 1936s 1936s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1936s 1936s During handling of the above exception, another exception occurred: 1936s 1936s self = 1936s 1936s def test_non_existent_store(self) -> None: 1936s > with pytest.raises( 1936s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1936s ): 1936s E AssertionError: Regex pattern did not match. 1936s E Regex: '(No such file or directory|Unable to find group)' 1936s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/ea7e3ec3-e1b1-4ea8-a884-a68bcb5c8072 does not exist' 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1936s ______________ TestZarrDirectoryStore.test_non_existent_store[2] _______________ 1936s 1936s self = 1936s 1936s def test_non_existent_store(self) -> None: 1936s with pytest.raises( 1936s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1936s ): 1936s > xr.open_zarr(f"{uuid.uuid4()}") 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1936s store = ZarrStore.open_group( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1936s ) = _get_open_params( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1936s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1936s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1936s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1936s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1936s raise return_result 1936s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1936s return await coro 1936s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1936s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1936s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1936s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1936s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1936s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1936s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1936s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1936s await store._open() 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/ea21b882-cb65-4107-b40d-3f6ddbed73ab') 1936s 1936s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1936s if not self.read_only: 1936s self.root.mkdir(parents=True, exist_ok=True) 1936s 1936s if not self.root.exists(): 1936s > raise FileNotFoundError(f"{self.root} does not exist") 1936s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/ea21b882-cb65-4107-b40d-3f6ddbed73ab does not exist 1936s 1936s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1936s 1936s During handling of the above exception, another exception occurred: 1936s 1936s self = 1936s 1936s def test_non_existent_store(self) -> None: 1936s > with pytest.raises( 1936s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1936s ): 1936s E AssertionError: Regex pattern did not match. 1936s E Regex: '(No such file or directory|Unable to find group)' 1936s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/ea21b882-cb65-4107-b40d-3f6ddbed73ab does not exist' 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1936s ________________ TestZarrWriteEmpty.test_non_existent_store[2] _________________ 1936s 1936s self = 1936s 1936s def test_non_existent_store(self) -> None: 1936s with pytest.raises( 1936s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1936s ): 1936s > xr.open_zarr(f"{uuid.uuid4()}") 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1936s store = ZarrStore.open_group( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1936s ) = _get_open_params( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1936s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1936s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1936s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1936s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1936s raise return_result 1936s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1936s return await coro 1936s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1936s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1936s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1936s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1936s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1936s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1936s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1936s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1936s await store._open() 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/da6c2d6e-dc34-4781-be59-fff584d79219') 1936s 1936s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1936s if not self.read_only: 1936s self.root.mkdir(parents=True, exist_ok=True) 1936s 1936s if not self.root.exists(): 1936s > raise FileNotFoundError(f"{self.root} does not exist") 1936s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/da6c2d6e-dc34-4781-be59-fff584d79219 does not exist 1936s 1936s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1936s 1936s During handling of the above exception, another exception occurred: 1936s 1936s self = 1936s 1936s def test_non_existent_store(self) -> None: 1936s > with pytest.raises( 1936s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1936s ): 1936s E AssertionError: Regex pattern did not match. 1936s E Regex: '(No such file or directory|Unable to find group)' 1936s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/da6c2d6e-dc34-4781-be59-fff584d79219 does not exist' 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1936s _______________ TestZarrWriteEmpty.test_write_empty[2-True-True] _______________ 1936s 1936s self = 1936s consolidated = True, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [True, False, None]) 1936s @pytest.mark.parametrize("write_empty", [True, False, None]) 1936s def test_write_empty( 1936s self, 1936s consolidated: bool | None, 1936s write_empty: bool | None, 1936s ) -> None: 1936s def assert_expected_files(expected: list[str], store: str) -> None: 1936s """Convenience for comparing with actual files written""" 1936s ls = [] 1936s test_root = os.path.join(store, "test") 1936s for root, _, files in os.walk(test_root): 1936s ls.extend( 1936s [ 1936s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1936s for f in files 1936s ] 1936s ) 1936s 1936s assert set(expected) == set( 1936s [ 1936s file.lstrip("c/") 1936s for file in ls 1936s if (file not in (".zattrs", ".zarray", "zarr.json")) 1936s ] 1936s ) 1936s 1936s # The zarr format is set by the `default_zarr_format` 1936s # pytest fixture that acts on a superclass 1936s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1936s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1936s expected = ["0.1.0"] 1936s else: 1936s expected = [ 1936s "0.0.0", 1936s "0.0.1", 1936s "0.1.0", 1936s "0.1.1", 1936s ] 1936s 1936s if zarr_format_3: 1936s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1936s # transform to the path style of zarr 3 1936s # e.g. 0/0/1 1936s expected = [e.replace(".", "/") for e in expected] 1936s else: 1936s # use nan for default fill_value behaviour 1936s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1936s 1936s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1936s 1936s if has_dask: 1936s ds["test"] = ds["test"].chunk(1) 1936s encoding = None 1936s else: 1936s encoding = {"test": {"chunks": (1, 1, 1)}} 1936s 1936s with self.temp_dir() as (d, store): 1936s ds.to_zarr( 1936s store, 1936s mode="w", 1936s encoding=encoding, 1936s write_empty_chunks=write_empty, 1936s ) 1936s 1936s # check expected files after a write 1936s assert_expected_files(expected, store) 1936s 1936s with self.roundtrip_dir( 1936s ds, 1936s store, 1936s save_kwargs={ 1936s "mode": "a", 1936s "append_dim": "Z", 1936s "write_empty_chunks": write_empty, 1936s }, 1936s ) as a_ds: 1936s expected_ds = xr.concat([ds, ds], dim="Z") 1936s 1936s assert_identical(a_ds, expected_ds.compute()) 1936s # add the new files we expect to be created by the append 1936s # that was performed by the roundtrip_dir 1936s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1936s expected.append("1.1.0") 1936s else: 1936s if not has_zarr_v3: 1936s # TODO: remove zarr3 if once zarr issue is fixed 1936s # https://github.com/zarr-developers/zarr-python/issues/2931 1936s expected.extend( 1936s [ 1936s "1.1.0", 1936s "1.0.0", 1936s "1.0.1", 1936s "1.1.1", 1936s ] 1936s ) 1936s else: 1936s expected.append("1.1.0") 1936s if zarr_format_3: 1936s expected = [e.replace(".", "/") for e in expected] 1936s > assert_expected_files(expected, store) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1936s store = '/tmp/tmplvj_ogss/test.zarr' 1936s 1936s def assert_expected_files(expected: list[str], store: str) -> None: 1936s """Convenience for comparing with actual files written""" 1936s ls = [] 1936s test_root = os.path.join(store, "test") 1936s for root, _, files in os.walk(test_root): 1936s ls.extend( 1936s [ 1936s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1936s for f in files 1936s ] 1936s ) 1936s 1936s > assert set(expected) == set( 1936s [ 1936s file.lstrip("c/") 1936s for file in ls 1936s if (file not in (".zattrs", ".zarray", "zarr.json")) 1936s ] 1936s ) 1936s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1936s E 1936s E Extra items in the right set: 1936s E '1.0.0' 1936s E '1.1.1' 1936s E '1.0.1' 1936s E Use -v to get more diff 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1936s ______________ TestZarrWriteEmpty.test_write_empty[2-True-False] _______________ 1936s 1936s self = 1936s consolidated = False, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [True, False, None]) 1936s @pytest.mark.parametrize("write_empty", [True, False, None]) 1936s def test_write_empty( 1936s self, 1936s consolidated: bool | None, 1936s write_empty: bool | None, 1936s ) -> None: 1936s def assert_expected_files(expected: list[str], store: str) -> None: 1936s """Convenience for comparing with actual files written""" 1936s ls = [] 1936s test_root = os.path.join(store, "test") 1936s for root, _, files in os.walk(test_root): 1936s ls.extend( 1936s [ 1936s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1936s for f in files 1936s ] 1936s ) 1936s 1936s assert set(expected) == set( 1936s [ 1936s file.lstrip("c/") 1936s for file in ls 1936s if (file not in (".zattrs", ".zarray", "zarr.json")) 1936s ] 1936s ) 1936s 1936s # The zarr format is set by the `default_zarr_format` 1936s # pytest fixture that acts on a superclass 1936s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1936s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1936s expected = ["0.1.0"] 1936s else: 1936s expected = [ 1936s "0.0.0", 1936s "0.0.1", 1936s "0.1.0", 1936s "0.1.1", 1936s ] 1936s 1936s if zarr_format_3: 1936s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1936s # transform to the path style of zarr 3 1936s # e.g. 0/0/1 1936s expected = [e.replace(".", "/") for e in expected] 1936s else: 1936s # use nan for default fill_value behaviour 1936s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1936s 1936s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1936s 1936s if has_dask: 1936s ds["test"] = ds["test"].chunk(1) 1936s encoding = None 1936s else: 1936s encoding = {"test": {"chunks": (1, 1, 1)}} 1936s 1936s with self.temp_dir() as (d, store): 1936s ds.to_zarr( 1936s store, 1936s mode="w", 1936s encoding=encoding, 1936s write_empty_chunks=write_empty, 1936s ) 1936s 1936s # check expected files after a write 1936s assert_expected_files(expected, store) 1936s 1936s with self.roundtrip_dir( 1936s ds, 1936s store, 1936s save_kwargs={ 1936s "mode": "a", 1936s "append_dim": "Z", 1936s "write_empty_chunks": write_empty, 1936s }, 1936s ) as a_ds: 1936s expected_ds = xr.concat([ds, ds], dim="Z") 1936s 1936s assert_identical(a_ds, expected_ds.compute()) 1936s # add the new files we expect to be created by the append 1936s # that was performed by the roundtrip_dir 1936s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1936s expected.append("1.1.0") 1936s else: 1936s if not has_zarr_v3: 1936s # TODO: remove zarr3 if once zarr issue is fixed 1936s # https://github.com/zarr-developers/zarr-python/issues/2931 1936s expected.extend( 1936s [ 1936s "1.1.0", 1936s "1.0.0", 1936s "1.0.1", 1936s "1.1.1", 1936s ] 1936s ) 1936s else: 1936s expected.append("1.1.0") 1936s if zarr_format_3: 1936s expected = [e.replace(".", "/") for e in expected] 1936s > assert_expected_files(expected, store) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1936s store = '/tmp/tmppvi_2k78/test.zarr' 1936s 1936s def assert_expected_files(expected: list[str], store: str) -> None: 1936s """Convenience for comparing with actual files written""" 1936s ls = [] 1936s test_root = os.path.join(store, "test") 1936s for root, _, files in os.walk(test_root): 1936s ls.extend( 1936s [ 1936s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1936s for f in files 1936s ] 1936s ) 1936s 1936s > assert set(expected) == set( 1936s [ 1936s file.lstrip("c/") 1936s for file in ls 1936s if (file not in (".zattrs", ".zarray", "zarr.json")) 1936s ] 1936s ) 1936s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1936s E 1936s E Extra items in the right set: 1936s E '1.0.0' 1936s E '1.1.1' 1936s E '1.0.1' 1936s E Use -v to get more diff 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1936s _______________ TestZarrWriteEmpty.test_write_empty[2-True-None] _______________ 1936s 1936s self = 1936s consolidated = None, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [True, False, None]) 1936s @pytest.mark.parametrize("write_empty", [True, False, None]) 1936s def test_write_empty( 1936s self, 1936s consolidated: bool | None, 1936s write_empty: bool | None, 1936s ) -> None: 1936s def assert_expected_files(expected: list[str], store: str) -> None: 1936s """Convenience for comparing with actual files written""" 1936s ls = [] 1936s test_root = os.path.join(store, "test") 1936s for root, _, files in os.walk(test_root): 1936s ls.extend( 1936s [ 1936s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1936s for f in files 1936s ] 1936s ) 1936s 1936s assert set(expected) == set( 1936s [ 1936s file.lstrip("c/") 1936s for file in ls 1936s if (file not in (".zattrs", ".zarray", "zarr.json")) 1936s ] 1936s ) 1936s 1936s # The zarr format is set by the `default_zarr_format` 1936s # pytest fixture that acts on a superclass 1936s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1936s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1936s expected = ["0.1.0"] 1936s else: 1936s expected = [ 1936s "0.0.0", 1936s "0.0.1", 1936s "0.1.0", 1936s "0.1.1", 1936s ] 1936s 1936s if zarr_format_3: 1936s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1936s # transform to the path style of zarr 3 1936s # e.g. 0/0/1 1936s expected = [e.replace(".", "/") for e in expected] 1936s else: 1936s # use nan for default fill_value behaviour 1936s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1936s 1936s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1936s 1936s if has_dask: 1936s ds["test"] = ds["test"].chunk(1) 1936s encoding = None 1936s else: 1936s encoding = {"test": {"chunks": (1, 1, 1)}} 1936s 1936s with self.temp_dir() as (d, store): 1936s ds.to_zarr( 1936s store, 1936s mode="w", 1936s encoding=encoding, 1936s write_empty_chunks=write_empty, 1936s ) 1936s 1936s # check expected files after a write 1936s assert_expected_files(expected, store) 1936s 1936s with self.roundtrip_dir( 1936s ds, 1936s store, 1936s save_kwargs={ 1936s "mode": "a", 1936s "append_dim": "Z", 1936s "write_empty_chunks": write_empty, 1936s }, 1936s ) as a_ds: 1936s expected_ds = xr.concat([ds, ds], dim="Z") 1936s 1936s assert_identical(a_ds, expected_ds.compute()) 1936s # add the new files we expect to be created by the append 1936s # that was performed by the roundtrip_dir 1936s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1936s expected.append("1.1.0") 1936s else: 1936s if not has_zarr_v3: 1936s # TODO: remove zarr3 if once zarr issue is fixed 1936s # https://github.com/zarr-developers/zarr-python/issues/2931 1936s expected.extend( 1936s [ 1936s "1.1.0", 1936s "1.0.0", 1936s "1.0.1", 1936s "1.1.1", 1936s ] 1936s ) 1936s else: 1936s expected.append("1.1.0") 1936s if zarr_format_3: 1936s expected = [e.replace(".", "/") for e in expected] 1936s > assert_expected_files(expected, store) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3793: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s expected = ['0.0.0', '0.0.1', '0.1.0', '0.1.1', '1.1.0'] 1936s store = '/tmp/tmp3s36z3uj/test.zarr' 1936s 1936s def assert_expected_files(expected: list[str], store: str) -> None: 1936s """Convenience for comparing with actual files written""" 1936s ls = [] 1936s test_root = os.path.join(store, "test") 1936s for root, _, files in os.walk(test_root): 1936s ls.extend( 1936s [ 1936s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1936s for f in files 1936s ] 1936s ) 1936s 1936s > assert set(expected) == set( 1936s [ 1936s file.lstrip("c/") 1936s for file in ls 1936s if (file not in (".zattrs", ".zarray", "zarr.json")) 1936s ] 1936s ) 1936s E AssertionError: assert {'0.0.0', '0....1.1', '1.1.0'} == {'0.0.0', '0.... '1.0.1', ...} 1936s E 1936s E Extra items in the right set: 1936s E '1.0.0' 1936s E '1.1.1' 1936s E '1.0.1' 1936s E Use -v to get more diff 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3712: AssertionError 1936s _____________ TestZarrDictStore.test_zero_dimensional_variable[3] ______________ 1936s 1936s self = 1936s 1936s def test_zero_dimensional_variable(self) -> None: 1936s expected = create_test_data() 1936s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1936s expected["bytes_var"] = ([], b"foobar") 1936s expected["string_var"] = ([], "foobar") 1936s > with self.roundtrip(expected) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ____________________ TestZarrDictStore.test_write_store[3] _____________________ 1936s 1936s self = 1936s 1936s def test_write_store(self) -> None: 1936s expected = create_test_data() 1936s with self.create_store() as store: 1936s expected.dump_to_store(store) 1936s # we need to cf decode the store because it has time and 1936s # non-dimension coordinates 1936s > with xr.decode_cf(store) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1936s vars, attrs = obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________________ TestZarrDictStore.test_roundtrip_test_data[3] _________________ 1936s 1936s self = 1936s 1936s def test_roundtrip_test_data(self) -> None: 1936s expected = create_test_data() 1936s > with self.roundtrip(expected) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________________________ TestZarrDictStore.test_load[3] ________________________ 1936s 1936s self = 1936s 1936s def test_load(self) -> None: 1936s expected = create_test_data() 1936s 1936s @contextlib.contextmanager 1936s def assert_loads(vars=None): 1936s if vars is None: 1936s vars = expected 1936s with self.roundtrip(expected) as actual: 1936s for k, v in actual.variables.items(): 1936s # IndexVariables are eagerly loaded into memory 1936s assert v._in_memory == (k in actual.dims) 1936s yield actual 1936s for k, v in actual.variables.items(): 1936s if k in vars: 1936s assert v._in_memory 1936s assert_identical(expected, actual) 1936s 1936s with pytest.raises(AssertionError): 1936s # make sure the contextmanager works! 1936s > with assert_loads() as ds: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1936s with self.roundtrip(expected) as actual: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s __________________ TestZarrDictStore.test_dataset_compute[3] ___________________ 1936s 1936s self = 1936s 1936s def test_dataset_compute(self) -> None: 1936s expected = create_test_data() 1936s 1936s > with self.roundtrip(expected) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _______________ TestZarrDictStore.test_roundtrip_object_dtype[3] _______________ 1936s 1936s self = 1936s 1936s def test_roundtrip_object_dtype(self) -> None: 1936s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1936s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1936s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1936s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1936s strings = np.array(["ab", "cdef", "g"], dtype=object) 1936s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1936s all_nans = np.array([np.nan, np.nan], dtype=object) 1936s original = Dataset( 1936s { 1936s "floats": ("a", floats), 1936s "floats_nans": ("a", floats_nans), 1936s "bytes": ("b", bytes_), 1936s "bytes_nans": ("b", bytes_nans), 1936s "strings": ("b", strings), 1936s "strings_nans": ("b", strings_nans), 1936s "all_nans": ("c", all_nans), 1936s "nan": ([], np.nan), 1936s } 1936s ) 1936s expected = original.copy(deep=True) 1936s > with self.roundtrip(original) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'nan' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _______________ TestZarrDictStore.test_roundtrip_float64_data[3] _______________ 1936s 1936s self = 1936s 1936s def test_roundtrip_float64_data(self) -> None: 1936s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1936s > with self.roundtrip(expected) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________________ TestZarrDictStore.test_orthogonal_indexing[3] _________________ 1936s 1936s self = 1936s 1936s def test_orthogonal_indexing(self) -> None: 1936s in_memory = create_test_data() 1936s > with self.roundtrip(in_memory) as on_disk: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________________ TestZarrDictStore.test_vectorized_indexing[3] _________________ 1936s 1936s self = 1936s 1936s def test_vectorized_indexing(self) -> None: 1936s in_memory = create_test_data() 1936s > with self.roundtrip(in_memory) as on_disk: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_vectorized_indexing_negative_step[3] __________ 1936s 1936s self = 1936s 1936s def test_vectorized_indexing_negative_step(self) -> None: 1936s # use dask explicitly when present 1936s open_kwargs: dict[str, Any] | None 1936s if has_dask: 1936s open_kwargs = {"chunks": {}} 1936s else: 1936s open_kwargs = None 1936s in_memory = create_test_data() 1936s 1936s def multiple_indexing(indexers): 1936s # make sure a sequence of lazy indexings certainly works. 1936s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1936s actual = on_disk["var3"] 1936s expected = in_memory["var3"] 1936s for ind in indexers: 1936s actual = actual.isel(ind) 1936s expected = expected.isel(ind) 1936s # make sure the array is not yet loaded into memory 1936s assert not actual.variable._in_memory 1936s assert_identical(expected, actual.load()) 1936s 1936s # with negative step slice. 1936s indexers = [ 1936s { 1936s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1936s "dim3": slice(-1, 1, -1), 1936s } 1936s ] 1936s > multiple_indexing(indexers) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1936s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ______________ TestZarrDictStore.test_outer_indexing_reversed[3] _______________ 1936s 1936s self = 1936s 1936s def test_outer_indexing_reversed(self) -> None: 1936s # regression test for GH6560 1936s ds = xr.Dataset( 1936s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1936s ) 1936s 1936s > with self.roundtrip(ds) as on_disk: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'z' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ___________________ TestZarrDictStore.test_isel_dataarray[3] ___________________ 1936s 1936s self = 1936s 1936s def test_isel_dataarray(self) -> None: 1936s # Make sure isel works lazily. GH:issue:1688 1936s in_memory = create_test_data() 1936s > with self.roundtrip(in_memory) as on_disk: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _____________ TestZarrDictStore.test_array_type_after_indexing[3] ______________ 1936s 1936s self = 1936s 1936s def test_array_type_after_indexing(self) -> None: 1936s in_memory = create_test_data() 1936s > with self.roundtrip(in_memory) as on_disk: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _______________________ TestZarrDictStore.test_dropna[3] _______________________ 1936s 1936s self = 1936s 1936s def test_dropna(self) -> None: 1936s # regression test for GH:issue:1694 1936s a = np.random.randn(4, 3) 1936s a[1, 1] = np.nan 1936s in_memory = xr.Dataset( 1936s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1936s ) 1936s 1936s assert_identical( 1936s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1936s ) 1936s 1936s > with self.roundtrip(in_memory) as on_disk: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'a' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________________ TestZarrDictStore.test_ondisk_after_print[3] _________________ 1936s 1936s self = 1936s 1936s def test_ondisk_after_print(self) -> None: 1936s """Make sure print does not load file into memory""" 1936s in_memory = create_test_data() 1936s > with self.roundtrip(in_memory) as on_disk: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s __________ TestZarrDictStore.test_roundtrip_bytes_with_fill_value[3] ___________ 1936s 1936s self = 1936s 1936s def test_roundtrip_bytes_with_fill_value(self) -> None: 1936s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1936s encoding = {"_FillValue": b"X", "dtype": "S1"} 1936s original = Dataset({"x": ("t", values, {}, encoding)}) 1936s expected = original.copy(deep=True) 1936s > with self.roundtrip(original) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value0-False] ________ 1936s 1936s self = 1936s fill_value = np.int8(-1), exp_fill_warning = False 1936s 1936s @pytest.mark.parametrize( 1936s ("fill_value", "exp_fill_warning"), 1936s [ 1936s (np.int8(-1), False), 1936s (np.uint8(255), True), 1936s (-1, False), 1936s (255, True), 1936s ], 1936s ) 1936s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1936s @contextlib.contextmanager 1936s def _roundtrip_with_warnings(*args, **kwargs): 1936s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1936s if exp_fill_warning and is_np2: 1936s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1936s SerializationWarning, 1936s match="_FillValue attribute can't be represented", 1936s ) 1936s else: 1936s warn_checker = contextlib.nullcontext() 1936s with warn_checker: 1936s with self.roundtrip(*args, **kwargs) as actual: 1936s yield actual 1936s 1936s # regression/numpy2 test for 1936s encoding = { 1936s "_FillValue": fill_value, 1936s "_Unsigned": "true", 1936s "dtype": "i1", 1936s } 1936s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1936s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1936s 1936s attributes = { 1936s "_FillValue": fill_value, 1936s "_Unsigned": "true", 1936s } 1936s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1936s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1936s encoded = Dataset({"x": ("t", sb, attributes)}) 1936s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1936s 1936s > with _roundtrip_with_warnings(decoded) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1936s with self.roundtrip(*args, **kwargs) as actual: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Int8' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_roundtrip_unsigned[3-fill_value1-True] _________ 1936s 1936s self = 1936s fill_value = np.uint8(255), exp_fill_warning = True 1936s 1936s @pytest.mark.parametrize( 1936s ("fill_value", "exp_fill_warning"), 1936s [ 1936s (np.int8(-1), False), 1936s (np.uint8(255), True), 1936s (-1, False), 1936s (255, True), 1936s ], 1936s ) 1936s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1936s @contextlib.contextmanager 1936s def _roundtrip_with_warnings(*args, **kwargs): 1936s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1936s if exp_fill_warning and is_np2: 1936s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1936s SerializationWarning, 1936s match="_FillValue attribute can't be represented", 1936s ) 1936s else: 1936s warn_checker = contextlib.nullcontext() 1936s with warn_checker: 1936s with self.roundtrip(*args, **kwargs) as actual: 1936s yield actual 1936s 1936s # regression/numpy2 test for 1936s encoding = { 1936s "_FillValue": fill_value, 1936s "_Unsigned": "true", 1936s "dtype": "i1", 1936s } 1936s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1936s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1936s 1936s attributes = { 1936s "_FillValue": fill_value, 1936s "_Unsigned": "true", 1936s } 1936s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1936s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1936s encoded = Dataset({"x": ("t", sb, attributes)}) 1936s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1936s 1936s > with _roundtrip_with_warnings(decoded) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1936s with self.roundtrip(*args, **kwargs) as actual: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Int8' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ____________ TestZarrDictStore.test_roundtrip_unsigned[3--1-False] _____________ 1936s 1936s self = 1936s fill_value = -1, exp_fill_warning = False 1936s 1936s @pytest.mark.parametrize( 1936s ("fill_value", "exp_fill_warning"), 1936s [ 1936s (np.int8(-1), False), 1936s (np.uint8(255), True), 1936s (-1, False), 1936s (255, True), 1936s ], 1936s ) 1936s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1936s @contextlib.contextmanager 1936s def _roundtrip_with_warnings(*args, **kwargs): 1936s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1936s if exp_fill_warning and is_np2: 1936s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1936s SerializationWarning, 1936s match="_FillValue attribute can't be represented", 1936s ) 1936s else: 1936s warn_checker = contextlib.nullcontext() 1936s with warn_checker: 1936s with self.roundtrip(*args, **kwargs) as actual: 1936s yield actual 1936s 1936s # regression/numpy2 test for 1936s encoding = { 1936s "_FillValue": fill_value, 1936s "_Unsigned": "true", 1936s "dtype": "i1", 1936s } 1936s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1936s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1936s 1936s attributes = { 1936s "_FillValue": fill_value, 1936s "_Unsigned": "true", 1936s } 1936s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1936s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1936s encoded = Dataset({"x": ("t", sb, attributes)}) 1936s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1936s 1936s > with _roundtrip_with_warnings(decoded) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1936s with self.roundtrip(*args, **kwargs) as actual: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Int8' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ____________ TestZarrDictStore.test_roundtrip_unsigned[3-255-True] _____________ 1936s 1936s self = 1936s fill_value = 255, exp_fill_warning = True 1936s 1936s @pytest.mark.parametrize( 1936s ("fill_value", "exp_fill_warning"), 1936s [ 1936s (np.int8(-1), False), 1936s (np.uint8(255), True), 1936s (-1, False), 1936s (255, True), 1936s ], 1936s ) 1936s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1936s @contextlib.contextmanager 1936s def _roundtrip_with_warnings(*args, **kwargs): 1936s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1936s if exp_fill_warning and is_np2: 1936s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1936s SerializationWarning, 1936s match="_FillValue attribute can't be represented", 1936s ) 1936s else: 1936s warn_checker = contextlib.nullcontext() 1936s with warn_checker: 1936s with self.roundtrip(*args, **kwargs) as actual: 1936s yield actual 1936s 1936s # regression/numpy2 test for 1936s encoding = { 1936s "_FillValue": fill_value, 1936s "_Unsigned": "true", 1936s "dtype": "i1", 1936s } 1936s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1936s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1936s 1936s attributes = { 1936s "_FillValue": fill_value, 1936s "_Unsigned": "true", 1936s } 1936s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1936s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1936s encoded = Dataset({"x": ("t", sb, attributes)}) 1936s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1936s 1936s > with _roundtrip_with_warnings(decoded) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1936s with self.roundtrip(*args, **kwargs) as actual: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Int8' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1936s 1936s self = 1936s 1936s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1936s original = self._create_cf_dataset() 1936s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = 1936s name = 'det_lim' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ____ TestZarrDictStore.test_coordinate_variables_after_dataset_roundtrip[3] ____ 1936s 1936s self = 1936s 1936s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1936s original = self._create_cf_dataset() 1936s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = 1936s name = 'det_lim' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _ TestZarrDictStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1936s 1936s self = 1936s 1936s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1936s self, 1936s ) -> None: 1936s original = self._create_cf_dataset() 1936s # The DataArray roundtrip should have the same warnings as the 1936s # Dataset, but we already tested for those, so just go for the 1936s # new warnings. It would appear that there is no way to tell 1936s # pytest "This warning and also this warning should both be 1936s # present". 1936s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1936s # needs the to_dataset. The other backends should be fine 1936s # without it. 1936s with pytest.warns( 1936s UserWarning, 1936s match=( 1936s r"Variable\(s\) referenced in bounds not in variables: " 1936s r"\['l(at|ong)itude_bnds'\]" 1936s ), 1936s ): 1936s > with self.roundtrip( 1936s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'ln_p' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s 1936s During handling of the above exception, another exception occurred: 1936s 1936s self = 1936s 1936s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1936s self, 1936s ) -> None: 1936s original = self._create_cf_dataset() 1936s # The DataArray roundtrip should have the same warnings as the 1936s # Dataset, but we already tested for those, so just go for the 1936s # new warnings. It would appear that there is no way to tell 1936s # pytest "This warning and also this warning should both be 1936s # present". 1936s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1936s # needs the to_dataset. The other backends should be fine 1936s # without it. 1936s > with pytest.warns( 1936s UserWarning, 1936s match=( 1936s r"Variable\(s\) referenced in bounds not in variables: " 1936s r"\['l(at|ong)itude_bnds'\]" 1936s ), 1936s ): 1936s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1936s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1936s E Emitted warnings: [ ZarrUserWarning('Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future.')]. 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1936s ___________________ TestZarrDictStore.test_encoding_kwarg[3] ___________________ 1936s 1936s self = 1936s 1936s def test_encoding_kwarg(self) -> None: 1936s ds = Dataset({"x": ("y", np.arange(10.0))}) 1936s 1936s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1936s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float32' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________________ TestZarrDictStore.test_default_fill_value[3] _________________ 1936s 1936s self = 1936s 1936s def test_default_fill_value(self) -> None: 1936s # Test default encoding for float: 1936s ds = Dataset({"x": ("y", np.arange(10.0))}) 1936s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1936s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float32' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord[3] _________ 1936s 1936s self = 1936s 1936s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1936s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1936s ds.y.encoding["_FillValue"] = None 1936s > with self.roundtrip(ds) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _ TestZarrDictStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1936s 1936s self = 1936s 1936s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1936s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1936s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1936s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________________ TestZarrDictStore.test_encoding_same_dtype[3] _________________ 1936s 1936s self = 1936s 1936s def test_encoding_same_dtype(self) -> None: 1936s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1936s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1936s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float32' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ______________ TestZarrDictStore.test_append_overwrite_values[3] _______________ 1936s 1936s self = 1936s 1936s def test_append_overwrite_values(self) -> None: 1936s # regression for GH1215 1936s data = create_test_data() 1936s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1936s self.save(data, tmp_file, mode="w") 1936s data["var2"][:] = -999 1936s data["var9"] = data["var2"] * 3 1936s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1936s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-False] ____________ 1936s 1936s self = 1936s consolidated = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s def test_roundtrip_consolidated(self, consolidated) -> None: 1936s expected = create_test_data() 1936s > with self.roundtrip( 1936s expected, 1936s save_kwargs={"consolidated": consolidated}, 1936s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-True] _____________ 1936s 1936s self = 1936s consolidated = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s def test_roundtrip_consolidated(self, consolidated) -> None: 1936s expected = create_test_data() 1936s > with self.roundtrip( 1936s expected, 1936s save_kwargs={"consolidated": consolidated}, 1936s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ____________ TestZarrDictStore.test_roundtrip_consolidated[3-None] _____________ 1936s 1936s self = 1936s consolidated = None 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s def test_roundtrip_consolidated(self, consolidated) -> None: 1936s expected = create_test_data() 1936s > with self.roundtrip( 1936s expected, 1936s save_kwargs={"consolidated": consolidated}, 1936s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ___________ TestZarrDictStore.test_read_non_consolidated_warning[3] ____________ 1936s 1936s self = 1936s 1936s def test_read_non_consolidated_warning(self) -> None: 1936s expected = create_test_data() 1936s with self.create_zarr_target() as store: 1936s self.save( 1936s expected, store_target=store, consolidated=False, **self.version_kwargs 1936s ) 1936s with pytest.warns( 1936s RuntimeWarning, 1936s match="Failed to open Zarr store with consolidated", 1936s ): 1936s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________________ TestZarrDictStore.test_non_existent_store[3] _________________ 1936s 1936s self = 1936s 1936s def test_non_existent_store(self) -> None: 1936s with pytest.raises( 1936s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1936s ): 1936s > xr.open_zarr(f"{uuid.uuid4()}") 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1936s store = ZarrStore.open_group( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1936s ) = _get_open_params( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1936s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1936s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1936s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1936s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1936s raise return_result 1936s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1936s return await coro 1936s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1936s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1936s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1936s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1936s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1936s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1936s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1936s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1936s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1936s await store._open() 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/b3b9e8fa-175f-43c4-bc3f-6616f29e78e8') 1936s 1936s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1936s if not self.read_only: 1936s self.root.mkdir(parents=True, exist_ok=True) 1936s 1936s if not self.root.exists(): 1936s > raise FileNotFoundError(f"{self.root} does not exist") 1936s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/b3b9e8fa-175f-43c4-bc3f-6616f29e78e8 does not exist 1936s 1936s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1936s 1936s During handling of the above exception, another exception occurred: 1936s 1936s self = 1936s 1936s def test_non_existent_store(self) -> None: 1936s > with pytest.raises( 1936s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1936s ): 1936s E AssertionError: Regex pattern did not match. 1936s E Regex: '(No such file or directory|Unable to find group)' 1936s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/b3b9e8fa-175f-43c4-bc3f-6616f29e78e8 does not exist' 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1936s _____________________ TestZarrDictStore.test_auto_chunk[3] _____________________ 1936s 1936s self = 1936s 1936s @requires_dask 1936s def test_auto_chunk(self) -> None: 1936s original = create_test_data().chunk() 1936s 1936s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ____________________ TestZarrDictStore.test_manual_chunk[3] ____________________ 1936s 1936s self = 1936s 1936s @requires_dask 1936s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1936s def test_manual_chunk(self) -> None: 1936s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1936s 1936s # Using chunks = None should return non-chunked arrays 1936s open_kwargs: dict[str, Any] = {"chunks": None} 1936s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _______________ TestZarrDictStore.test_warning_on_bad_chunks[3] ________________ 1936s 1936s self = 1936s 1936s @requires_dask 1936s def test_warning_on_bad_chunks(self) -> None: 1936s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1936s 1936s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1936s for chunks in bad_chunks: 1936s kwargs = {"chunks": chunks} 1936s with pytest.warns(UserWarning): 1936s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ______________ TestZarrDictStore.test_write_uneven_dask_chunks[3] ______________ 1936s 1936s self = 1936s 1936s @requires_dask 1936s def test_write_uneven_dask_chunks(self) -> None: 1936s # regression for GH#2225 1936s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1936s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ___________________ TestZarrDictStore.test_chunk_encoding[3] ___________________ 1936s 1936s self = 1936s 1936s def test_chunk_encoding(self) -> None: 1936s # These datasets have no dask chunks. All chunking specified in 1936s # encoding 1936s data = create_test_data() 1936s chunks = (5, 5) 1936s data["var2"].encoding.update({"chunks": chunks}) 1936s 1936s > with self.roundtrip(data) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ___________________ TestZarrDictStore.test_shard_encoding[3] ___________________ 1936s 1936s self = 1936s 1936s def test_shard_encoding(self) -> None: 1936s # These datasets have no dask chunks. All chunking/sharding specified in 1936s # encoding 1936s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1936s data = create_test_data() 1936s chunks = (1, 1) 1936s shards = (5, 5) 1936s data["var2"].encoding.update({"chunks": chunks}) 1936s data["var2"].encoding.update({"shards": shards}) 1936s > with self.roundtrip(data) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ____________ TestZarrDictStore.test_write_persistence_modes[3-None] ____________ 1936s 1936s self = 1936s group = None 1936s 1936s @pytest.mark.parametrize("group", [None, "group1"]) 1936s def test_write_persistence_modes(self, group) -> None: 1936s original = create_test_data() 1936s 1936s # overwrite mode 1936s > with self.roundtrip( 1936s original, 1936s save_kwargs={"mode": "w", "group": group}, 1936s open_kwargs={"group": group}, 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ___________ TestZarrDictStore.test_write_persistence_modes[3-group1] ___________ 1936s 1936s self = 1936s group = 'group1' 1936s 1936s @pytest.mark.parametrize("group", [None, "group1"]) 1936s def test_write_persistence_modes(self, group) -> None: 1936s original = create_test_data() 1936s 1936s # overwrite mode 1936s > with self.roundtrip( 1936s original, 1936s save_kwargs={"mode": "w", "group": group}, 1936s open_kwargs={"group": group}, 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________________ TestZarrDictStore.test_compressor_encoding[3] _________________ 1936s 1936s self = 1936s 1936s def test_compressor_encoding(self) -> None: 1936s # specify a custom compressor 1936s original = create_test_data() 1936s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1936s encoding_key = "compressors" 1936s # all parameters need to be explicitly specified in order for the comparison to pass below 1936s encoding = { 1936s "serializer": zarr.codecs.BytesCodec(endian="little"), 1936s encoding_key: ( 1936s zarr.codecs.BloscCodec( 1936s cname="zstd", 1936s clevel=3, 1936s shuffle="shuffle", 1936s typesize=8, 1936s blocksize=0, 1936s ), 1936s ), 1936s } 1936s else: 1936s from numcodecs.blosc import Blosc 1936s 1936s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1936s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1936s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1936s 1936s save_kwargs = dict(encoding={"var1": encoding}) 1936s 1936s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _______________________ TestZarrDictStore.test_group[3] ________________________ 1936s 1936s self = 1936s 1936s def test_group(self) -> None: 1936s original = create_test_data() 1936s group = "some/random/path" 1936s > with self.roundtrip( 1936s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ____________________ TestZarrDictStore.test_append_write[3] ____________________ 1936s 1936s self = 1936s 1936s def test_append_write(self) -> None: 1936s > super().test_append_write() 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1936s with self.roundtrip_append(data) as actual: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1936s self.save(data[[key]], path, mode=mode, **save_kwargs) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1936s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _______ TestZarrDictStore.test_append_with_append_dim_not_set_raises[3] ________ 1936s 1936s self = 1936s 1936s def test_append_with_append_dim_not_set_raises(self) -> None: 1936s ds, ds_to_append, _ = create_append_test_data() 1936s with self.create_zarr_target() as store_target: 1936s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1936s with pytest.raises(ValueError, match="different dimension sizes"): 1936s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'da' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _______ TestZarrDictStore.test_append_string_length_mismatch_works[3-U] ________ 1936s 1936s self = 1936s dtype = 'U' 1936s 1936s @pytest.mark.parametrize("dtype", ["U", "S"]) 1936s def test_append_string_length_mismatch_works(self, dtype) -> None: 1936s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1936s # ...but it probably would if we used object dtype 1936s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1936s expected = xr.concat([ds, ds_to_append], dim="time") 1936s with self.create_zarr_target() as store_target: 1936s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1936s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1936s _validate_datatypes_for_zarr_append( 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s vname = 'temperature' 1936s existing_var = Size: 24B 1936s [3 values with dtype= Size: 60B 1936s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 1936s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1936s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1936s f"dataset to append has dtype {new_var.dtype}." 1936s ) 1936s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 1936s dtype = 'S' 1936s 1936s @pytest.mark.parametrize("dtype", ["U", "S"]) 1936s def test_append_string_length_mismatch_works(self, dtype) -> None: 1936s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1936s # ...but it probably would if we used object dtype 1936s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1936s expected = xr.concat([ds, ds_to_append], dim="time") 1936s with self.create_zarr_target() as store_target: 1936s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1936s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1936s _validate_datatypes_for_zarr_append( 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s vname = 'temperature' 1936s existing_var = Size: 6B 1936s [3 values with dtype=|S2] 1936s new_var = Size: 9B 1936s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1936s 1936s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1936s """If variable exists in the store, confirm dtype of the data to append is compatible with 1936s existing dtype. 1936s """ 1936s if ( 1936s np.issubdtype(new_var.dtype, np.number) 1936s or np.issubdtype(new_var.dtype, np.datetime64) 1936s or np.issubdtype(new_var.dtype, np.bool_) 1936s or new_var.dtype == object 1936s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1936s ): 1936s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1936s # new to the dataset, because in this case there is no existing var to compare it to; 1936s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1936s # we can be confident appending won't cause problems. Examples of dtypes which are not 1936s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1936s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1936s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1936s f"dataset to append has dtype {new_var.dtype}." 1936s ) 1936s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype |S2 but dataset to append has dtype |S3. 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1936s _____ TestZarrDictStore.test_check_encoding_is_consistent_after_append[3] ______ 1936s 1936s self = 1936s 1936s def test_check_encoding_is_consistent_after_append(self) -> None: 1936s ds, ds_to_append, _ = create_append_test_data() 1936s 1936s # check encoding consistency 1936s with self.create_zarr_target() as store_target: 1936s import numcodecs 1936s 1936s encoding_value: Any 1936s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1936s compressor = zarr.codecs.BloscCodec() 1936s else: 1936s compressor = numcodecs.Blosc() 1936s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1936s encoding_value = (compressor,) if has_zarr_v3 else compressor 1936s 1936s encoding = {"da": {encoding_key: encoding_value}} 1936s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1936s > original_ds = xr.open_dataset( 1936s store_target, engine="zarr", **self.version_kwargs 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'da' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ______________ TestZarrDictStore.test_append_with_new_variable[3] ______________ 1936s 1936s self = 1936s 1936s def test_append_with_new_variable(self) -> None: 1936s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1936s 1936s # check append mode for new variable 1936s with self.create_zarr_target() as store_target: 1936s combined = xr.concat([ds, ds_to_append], dim="time") 1936s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1936s assert_identical( 1936s combined, 1936s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'da' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_append_with_append_dim_no_overwrite[3] _________ 1936s 1936s self = 1936s 1936s def test_append_with_append_dim_no_overwrite(self) -> None: 1936s ds, ds_to_append, _ = create_append_test_data() 1936s with self.create_zarr_target() as store_target: 1936s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1936s original = xr.concat([ds, ds_to_append], dim="time") 1936s original2 = xr.concat([original, ds_to_append], dim="time") 1936s 1936s # overwrite a coordinate; 1936s # for mode='a-', this will not get written to the store 1936s # because it does not have the append_dim as a dim 1936s lon = ds_to_append.lon.to_numpy().copy() 1936s lon[:] = -999 1936s ds_to_append["lon"] = lon 1936s > ds_to_append.to_zarr( 1936s store_target, mode="a-", append_dim="time", **self.version_kwargs 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'da' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s __________ TestZarrDictStore.test_to_zarr_compute_false_roundtrip[3] ___________ 1936s 1936s self = 1936s 1936s @requires_dask 1936s def test_to_zarr_compute_false_roundtrip(self) -> None: 1936s from dask.delayed import Delayed 1936s 1936s original = create_test_data().chunk() 1936s 1936s with self.create_zarr_target() as store: 1936s delayed_obj = self.save(original, store, compute=False) 1936s assert isinstance(delayed_obj, Delayed) 1936s 1936s # make sure target store has not been written to yet 1936s with pytest.raises(AssertionError): 1936s > with self.open(store) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'dim2' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _______ TestZarrDictStore.test_to_zarr_append_compute_false_roundtrip[3] _______ 1936s 1936s self = 1936s 1936s @requires_dask 1936s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1936s from dask.delayed import Delayed 1936s 1936s ds, ds_to_append, _ = create_append_test_data() 1936s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1936s 1936s with pytest.warns(SerializationWarning): 1936s with self.create_zarr_target() as store: 1936s delayed_obj = self.save(ds, store, compute=False, mode="w") 1936s assert isinstance(delayed_obj, Delayed) 1936s 1936s with pytest.raises(AssertionError): 1936s > with self.open(store) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'da' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________________ TestZarrDictStore.test_save_emptydim[3-False] _________________ 1936s 1936s self = 1936s chunk = False 1936s 1936s @pytest.mark.parametrize("chunk", [False, True]) 1936s def test_save_emptydim(self, chunk) -> None: 1936s if chunk and not has_dask: 1936s pytest.skip("requires dask") 1936s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1936s if chunk: 1936s ds = ds.chunk({}) # chunk dataset to save dask array 1936s > with self.roundtrip(ds) as ds_reload: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________________ TestZarrDictStore.test_save_emptydim[3-True] _________________ 1936s 1936s self = 1936s chunk = True 1936s 1936s @pytest.mark.parametrize("chunk", [False, True]) 1936s def test_save_emptydim(self, chunk) -> None: 1936s if chunk and not has_dask: 1936s pytest.skip("requires dask") 1936s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1936s if chunk: 1936s ds = ds.chunk({}) # chunk dataset to save dask array 1936s > with self.roundtrip(ds) as ds_reload: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _____ TestZarrDictStore.test_no_warning_from_open_emptydim_with_chunks[3] ______ 1936s 1936s self = 1936s 1936s @requires_dask 1936s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1936s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1936s with assert_no_warnings(): 1936s with warnings.catch_warnings(): 1936s warnings.filterwarnings( 1936s "ignore", 1936s message=".*Zarr format 3 specification.*", 1936s category=UserWarning, 1936s ) 1936s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1936s with self.open(store_target, **open_kwargs) as ds: 1936s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1936s return next(self.gen) 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1936s with xr.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'x' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_write_region[3-False-False-False-False] ________ 1936s 1936s self = 1936s consolidated = False, compute = False, use_dask = False, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_write_region[3-False-False-False-True] _________ 1936s 1936s self = 1936s consolidated = True, compute = False, use_dask = False, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_write_region[3-False-False-False-None] _________ 1936s 1936s self = 1936s consolidated = None, compute = False, use_dask = False, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_write_region[3-False-False-True-False] _________ 1936s 1936s self = 1936s consolidated = False, compute = True, use_dask = False, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-False-False-True-True] _________ 1936s 1936s self = 1936s consolidated = True, compute = True, use_dask = False, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-False-False-True-None] _________ 1936s 1936s self = 1936s consolidated = None, compute = True, use_dask = False, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_write_region[3-False-True-False-False] _________ 1936s 1936s self = 1936s consolidated = False, compute = False, use_dask = True, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-False-True-False-True] _________ 1936s 1936s self = 1936s consolidated = True, compute = False, use_dask = True, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-False-True-False-None] _________ 1936s 1936s self = 1936s consolidated = None, compute = False, use_dask = True, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-False-True-True-False] _________ 1936s 1936s self = 1936s consolidated = False, compute = True, use_dask = True, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-False-True-True-True] __________ 1936s 1936s self = 1936s consolidated = True, compute = True, use_dask = True, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-False-True-True-None] __________ 1936s 1936s self = 1936s consolidated = None, compute = True, use_dask = True, write_empty = False 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_write_region[3-True-False-False-False] _________ 1936s 1936s self = 1936s consolidated = False, compute = False, use_dask = False, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-True-False-False-True] _________ 1936s 1936s self = 1936s consolidated = True, compute = False, use_dask = False, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-True-False-False-None] _________ 1936s 1936s self = 1936s consolidated = None, compute = False, use_dask = False, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-True-False-True-False] _________ 1936s 1936s self = 1936s consolidated = False, compute = True, use_dask = False, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-True-False-True-True] __________ 1936s 1936s self = 1936s consolidated = True, compute = True, use_dask = False, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-True-False-True-None] __________ 1936s 1936s self = 1936s consolidated = None, compute = True, use_dask = False, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-True-True-False-False] _________ 1936s 1936s self = 1936s consolidated = False, compute = False, use_dask = True, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-True-True-False-True] __________ 1936s 1936s self = 1936s consolidated = True, compute = False, use_dask = True, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-True-True-False-None] __________ 1936s 1936s self = 1936s consolidated = None, compute = False, use_dask = True, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-True-True-True-False] __________ 1936s 1936s self = 1936s consolidated = False, compute = True, use_dask = True, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s __________ TestZarrDictStore.test_write_region[3-True-True-True-True] __________ 1936s 1936s self = 1936s consolidated = True, compute = True, use_dask = True, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s __________ TestZarrDictStore.test_write_region[3-True-True-True-None] __________ 1936s 1936s self = 1936s consolidated = None, compute = True, use_dask = True, write_empty = True 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s ________ TestZarrDictStore.test_write_region[3-None-False-False-False] _________ 1936s 1936s self = 1936s consolidated = False, compute = False, use_dask = False, write_empty = None 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-None-False-False-True] _________ 1936s 1936s self = 1936s consolidated = True, compute = False, use_dask = False, write_empty = None 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-None-False-False-None] _________ 1936s 1936s self = 1936s consolidated = None, compute = False, use_dask = False, write_empty = None 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-None-False-True-False] _________ 1936s 1936s self = 1936s consolidated = False, compute = True, use_dask = False, write_empty = None 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-None-False-True-True] __________ 1936s 1936s self = 1936s consolidated = True, compute = True, use_dask = False, write_empty = None 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-None-False-True-None] __________ 1936s 1936s self = 1936s consolidated = None, compute = True, use_dask = False, write_empty = None 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s > with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1936s ds = open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1936s backend_ds = backend.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1936s ds = store_entrypoint.open_dataset( 1936s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1936s vars, attrs = filename_or_obj.load() 1936s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1936s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1936s return Frozen(dict(*args, **kwargs)) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1936s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-None-True-False-False] _________ 1936s 1936s self = 1936s consolidated = False, compute = False, use_dask = True, write_empty = None 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1936s store, consolidated=consolidated, **self.version_kwargs 1936s ) as actual: 1936s assert_identical(actual, zeros) 1936s for i in range(0, 10, 2): 1936s region = {"x": slice(i, i + 2)} 1936s > nonzeros.isel(region).to_zarr( 1936s store, 1936s region=region, 1936s consolidated=consolidated, 1936s write_empty_chunks=write_empty, 1936s **self.version_kwargs, 1936s ) 1936s 1936s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1936s return to_zarr( # type: ignore[call-overload,misc] 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1936s dump_to_store(dataset, zstore, writer, encoding=encoding) 1936s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1936s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1936s k: self.open_store_variable(name=k) for k in existing_variable_names 1936s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1936s 1936s self = , name = 'u' 1936s 1936s def open_store_variable(self, name): 1936s zarr_array = self.members[name] 1936s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1936s try_nczarr = self._mode == "r" 1936s dimensions, attributes = _get_zarr_dims_and_attrs( 1936s zarr_array, DIMENSION_KEY, try_nczarr 1936s ) 1936s attributes = dict(attributes) 1936s 1936s encoding = { 1936s "chunks": zarr_array.chunks, 1936s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1936s } 1936s 1936s if _zarr_v3(): 1936s encoding.update( 1936s { 1936s "compressors": zarr_array.compressors, 1936s "filters": zarr_array.filters, 1936s "shards": zarr_array.shards, 1936s } 1936s ) 1936s if self.zarr_group.metadata.zarr_format == 3: 1936s encoding.update({"serializer": zarr_array.serializer}) 1936s else: 1936s encoding.update( 1936s { 1936s "compressor": zarr_array.compressor, 1936s "filters": zarr_array.filters, 1936s } 1936s ) 1936s 1936s if self._use_zarr_fill_value_as_mask: 1936s # Setting this attribute triggers CF decoding for missing values 1936s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1936s if zarr_array.fill_value is not None: 1936s attributes["_FillValue"] = zarr_array.fill_value 1936s elif "_FillValue" in attributes: 1936s original_zarr_dtype = zarr_array.metadata.data_type 1936s attributes["_FillValue"] = FillValueCoder.decode( 1936s > attributes["_FillValue"], original_zarr_dtype.value 1936s ) 1936s E AttributeError: 'Float64' object has no attribute 'value' 1936s 1936s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1936s _________ TestZarrDictStore.test_write_region[3-None-True-False-True] __________ 1936s 1936s self = 1936s consolidated = True, compute = False, use_dask = True, write_empty = None 1936s 1936s @pytest.mark.parametrize("consolidated", [False, True, None]) 1936s @pytest.mark.parametrize("compute", [False, True]) 1936s @pytest.mark.parametrize("use_dask", [False, True]) 1936s @pytest.mark.parametrize("write_empty", [False, True, None]) 1936s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1936s if (use_dask or not compute) and not has_dask: 1936s pytest.skip("requires dask") 1936s 1936s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1936s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1936s 1936s if use_dask: 1936s zeros = zeros.chunk(2) 1936s nonzeros = nonzeros.chunk(2) 1936s 1936s with self.create_zarr_target() as store: 1936s zeros.to_zarr( 1936s store, 1936s consolidated=consolidated, 1936s compute=compute, 1936s encoding={"u": dict(chunks=2)}, 1936s **self.version_kwargs, 1936s ) 1936s if compute: 1936s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _________ TestZarrDictStore.test_write_region[3-None-True-False-None] __________ 1937s 1937s self = 1937s consolidated = None, compute = False, use_dask = True, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _________ TestZarrDictStore.test_write_region[3-None-True-True-False] __________ 1937s 1937s self = 1937s consolidated = False, compute = True, use_dask = True, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s __________ TestZarrDictStore.test_write_region[3-None-True-True-True] __________ 1937s 1937s self = 1937s consolidated = True, compute = True, use_dask = True, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s __________ TestZarrDictStore.test_write_region[3-None-True-True-None] __________ 1937s 1937s self = 1937s consolidated = None, compute = True, use_dask = True, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______________ TestZarrDictStore.test_write_region_mode[3-None] _______________ 1937s 1937s self = 1937s mode = None 1937s 1937s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1937s def test_write_region_mode(self, mode) -> None: 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr(store, **self.version_kwargs) 1937s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1937s > nonzeros.isel(region).to_zarr( 1937s store, region=region, mode=mode, **self.version_kwargs 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrDictStore.test_write_region_mode[3-r+] ________________ 1937s 1937s self = 1937s mode = 'r+' 1937s 1937s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1937s def test_write_region_mode(self, mode) -> None: 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr(store, **self.version_kwargs) 1937s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1937s > nonzeros.isel(region).to_zarr( 1937s store, region=region, mode=mode, **self.version_kwargs 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrDictStore.test_write_region_mode[3-a] _________________ 1937s 1937s self = 1937s mode = 'a' 1937s 1937s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1937s def test_write_region_mode(self, mode) -> None: 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr(store, **self.version_kwargs) 1937s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1937s > nonzeros.isel(region).to_zarr( 1937s store, region=region, mode=mode, **self.version_kwargs 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________ TestZarrDictStore.test_write_preexisting_override_metadata[3] _________ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_write_preexisting_override_metadata(self) -> None: 1937s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1937s original = Dataset( 1937s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1937s attrs={"global": "original"}, 1937s ) 1937s both_modified = Dataset( 1937s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1937s attrs={"global": "modified"}, 1937s ) 1937s global_modified = Dataset( 1937s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1937s attrs={"global": "modified"}, 1937s ) 1937s only_new_data = Dataset( 1937s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1937s attrs={"global": "original"}, 1937s ) 1937s 1937s with self.create_zarr_target() as store: 1937s original.to_zarr(store, compute=False, **self.version_kwargs) 1937s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrDictStore.test_encoding_chunksizes[3] _________________ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_encoding_chunksizes(self) -> None: 1937s # regression test for GH2278 1937s # see also test_encoding_chunksizes_unlimited 1937s nx, ny, nt = 4, 4, 5 1937s original = xr.Dataset( 1937s {}, 1937s coords={ 1937s "x": np.arange(nx), 1937s "y": np.arange(ny), 1937s "t": np.arange(nt), 1937s }, 1937s ) 1937s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1937s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1937s 1937s > with self.roundtrip(original) as ds1: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'v' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDictStore.test_chunk_encoding_with_partial_dask_chunks[3] _______ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1937s original = xr.Dataset( 1937s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1937s ).chunk({"a": 3}) 1937s 1937s > with self.roundtrip( 1937s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1937s ) as ds1: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrDictStore.test_open_zarr_use_cftime[3] ________________ 1937s 1937s self = 1937s 1937s @requires_cftime 1937s def test_open_zarr_use_cftime(self) -> None: 1937s ds = create_test_data() 1937s with self.create_zarr_target() as store_target: 1937s ds.to_zarr(store_target, **self.version_kwargs) 1937s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDictStore.test_write_read_select_write[3] _______________ 1937s 1937s self = 1937s 1937s def test_write_read_select_write(self) -> None: 1937s # Test for https://github.com/pydata/xarray/issues/4084 1937s ds = create_test_data() 1937s 1937s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1937s with self.create_zarr_target() as initial_store: 1937s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1937s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s __________________ TestZarrDictStore.test_attributes[3-obj1] ___________________ 1937s 1937s self = 1937s obj = Size: 8B 1937s array(nan) 1937s Attributes: 1937s good: {'key': 'value'} 1937s 1937s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1937s def test_attributes(self, obj) -> None: 1937s obj = obj.copy() 1937s 1937s obj.attrs["good"] = {"key": "value"} 1937s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1937s with self.create_zarr_target() as store_target: 1937s ds.to_zarr(store_target, **self.version_kwargs) 1937s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'foo' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s __ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 1937s 1937s self = 1937s dtype = 'datetime64[ns]' 1937s 1937s @requires_dask 1937s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1937s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1937s # Generalized from @malmans2's test in PR #8253 1937s original = create_test_data().astype(dtype).chunk(1) 1937s > with self.roundtrip( 1937s original, 1937s open_kwargs={ 1937s "chunks": {}, 1937s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1937s }, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _ TestZarrDictStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] __ 1937s 1937s self = 1937s dtype = 'timedelta64[ns]' 1937s 1937s @requires_dask 1937s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1937s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1937s # Generalized from @malmans2's test in PR #8253 1937s original = create_test_data().astype(dtype).chunk(1) 1937s > with self.roundtrip( 1937s original, 1937s open_kwargs={ 1937s "chunks": {}, 1937s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1937s }, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ___________ TestZarrDictStore.test_zarr_fill_value_setting[3-float] ____________ 1937s 1937s self = 1937s dtype = 1937s 1937s @requires_dask 1937s @pytest.mark.parametrize("dtype", [int, float]) 1937s def test_zarr_fill_value_setting(self, dtype): 1937s # When zarr_format=2, _FillValue sets fill_value 1937s # When zarr_format=3, fill_value is set independently 1937s # We test this by writing a dask array with compute=False, 1937s # on read we should receive chunks filled with `fill_value` 1937s fv = -1 1937s ds = xr.Dataset( 1937s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1937s ) 1937s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1937s 1937s zarr_format_2 = ( 1937s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1937s ) or not has_zarr_v3 1937s if zarr_format_2: 1937s attr = "_FillValue" 1937s expected.foo.attrs[attr] = fv 1937s else: 1937s attr = "fill_value" 1937s if dtype is float: 1937s # for floats, Xarray inserts a default `np.nan` 1937s expected.foo.attrs["_FillValue"] = np.nan 1937s 1937s # turn off all decoding so we see what Zarr returns to us. 1937s # Since chunks, are not written, we should receive on `fill_value` 1937s open_kwargs = { 1937s "mask_and_scale": False, 1937s "consolidated": False, 1937s "use_zarr_fill_value_as_mask": False, 1937s } 1937s save_kwargs = dict(compute=False, consolidated=False) 1937s > with self.roundtrip( 1937s ds, 1937s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1937s open_kwargs=open_kwargs, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'foo' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ___________ TestZarrDirectoryStore.test_zero_dimensional_variable[3] ___________ 1937s 1937s self = 1937s 1937s def test_zero_dimensional_variable(self) -> None: 1937s expected = create_test_data() 1937s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1937s expected["bytes_var"] = ([], b"foobar") 1937s expected["string_var"] = ([], "foobar") 1937s > with self.roundtrip(expected) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s __________________ TestZarrDirectoryStore.test_write_store[3] __________________ 1937s 1937s self = 1937s 1937s def test_write_store(self) -> None: 1937s expected = create_test_data() 1937s with self.create_store() as store: 1937s expected.dump_to_store(store) 1937s # we need to cf decode the store because it has time and 1937s # non-dimension coordinates 1937s > with xr.decode_cf(store) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1937s vars, attrs = obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'var2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_roundtrip_test_data[3] ______________ 1937s 1937s self = 1937s 1937s def test_roundtrip_test_data(self) -> None: 1937s expected = create_test_data() 1937s > with self.roundtrip(expected) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _____________________ TestZarrDirectoryStore.test_load[3] ______________________ 1937s 1937s self = 1937s 1937s def test_load(self) -> None: 1937s expected = create_test_data() 1937s 1937s @contextlib.contextmanager 1937s def assert_loads(vars=None): 1937s if vars is None: 1937s vars = expected 1937s with self.roundtrip(expected) as actual: 1937s for k, v in actual.variables.items(): 1937s # IndexVariables are eagerly loaded into memory 1937s assert v._in_memory == (k in actual.dims) 1937s yield actual 1937s for k, v in actual.variables.items(): 1937s if k in vars: 1937s assert v._in_memory 1937s assert_identical(expected, actual) 1937s 1937s with pytest.raises(AssertionError): 1937s # make sure the contextmanager works! 1937s > with assert_loads() as ds: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1937s with self.roundtrip(expected) as actual: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrDirectoryStore.test_dataset_compute[3] ________________ 1937s 1937s self = 1937s 1937s def test_dataset_compute(self) -> None: 1937s expected = create_test_data() 1937s 1937s > with self.roundtrip(expected) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ____________ TestZarrDirectoryStore.test_roundtrip_object_dtype[3] _____________ 1937s 1937s self = 1937s 1937s def test_roundtrip_object_dtype(self) -> None: 1937s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1937s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1937s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1937s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1937s strings = np.array(["ab", "cdef", "g"], dtype=object) 1937s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1937s all_nans = np.array([np.nan, np.nan], dtype=object) 1937s original = Dataset( 1937s { 1937s "floats": ("a", floats), 1937s "floats_nans": ("a", floats_nans), 1937s "bytes": ("b", bytes_), 1937s "bytes_nans": ("b", bytes_nans), 1937s "strings": ("b", strings), 1937s "strings_nans": ("b", strings_nans), 1937s "all_nans": ("c", all_nans), 1937s "nan": ([], np.nan), 1937s } 1937s ) 1937s expected = original.copy(deep=True) 1937s > with self.roundtrip(original) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'nan' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ____________ TestZarrDirectoryStore.test_roundtrip_float64_data[3] _____________ 1937s 1937s self = 1937s 1937s def test_roundtrip_float64_data(self) -> None: 1937s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1937s > with self.roundtrip(expected) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_orthogonal_indexing[3] ______________ 1937s 1937s self = 1937s 1937s def test_orthogonal_indexing(self) -> None: 1937s in_memory = create_test_data() 1937s > with self.roundtrip(in_memory) as on_disk: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_vectorized_indexing[3] ______________ 1937s 1937s self = 1937s 1937s def test_vectorized_indexing(self) -> None: 1937s in_memory = create_test_data() 1937s > with self.roundtrip(in_memory) as on_disk: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_vectorized_indexing_negative_step[3] _______ 1937s 1937s self = 1937s 1937s def test_vectorized_indexing_negative_step(self) -> None: 1937s # use dask explicitly when present 1937s open_kwargs: dict[str, Any] | None 1937s if has_dask: 1937s open_kwargs = {"chunks": {}} 1937s else: 1937s open_kwargs = None 1937s in_memory = create_test_data() 1937s 1937s def multiple_indexing(indexers): 1937s # make sure a sequence of lazy indexings certainly works. 1937s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1937s actual = on_disk["var3"] 1937s expected = in_memory["var3"] 1937s for ind in indexers: 1937s actual = actual.isel(ind) 1937s expected = expected.isel(ind) 1937s # make sure the array is not yet loaded into memory 1937s assert not actual.variable._in_memory 1937s assert_identical(expected, actual.load()) 1937s 1937s # with negative step slice. 1937s indexers = [ 1937s { 1937s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1937s "dim3": slice(-1, 1, -1), 1937s } 1937s ] 1937s > multiple_indexing(indexers) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1937s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ____________ TestZarrDirectoryStore.test_outer_indexing_reversed[3] ____________ 1937s 1937s self = 1937s 1937s def test_outer_indexing_reversed(self) -> None: 1937s # regression test for GH6560 1937s ds = xr.Dataset( 1937s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1937s ) 1937s 1937s > with self.roundtrip(ds) as on_disk: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'z' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrDirectoryStore.test_isel_dataarray[3] _________________ 1937s 1937s self = 1937s 1937s def test_isel_dataarray(self) -> None: 1937s # Make sure isel works lazily. GH:issue:1688 1937s in_memory = create_test_data() 1937s > with self.roundtrip(in_memory) as on_disk: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ___________ TestZarrDirectoryStore.test_array_type_after_indexing[3] ___________ 1937s 1937s self = 1937s 1937s def test_array_type_after_indexing(self) -> None: 1937s in_memory = create_test_data() 1937s > with self.roundtrip(in_memory) as on_disk: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ____________________ TestZarrDirectoryStore.test_dropna[3] _____________________ 1937s 1937s self = 1937s 1937s def test_dropna(self) -> None: 1937s # regression test for GH:issue:1694 1937s a = np.random.randn(4, 3) 1937s a[1, 1] = np.nan 1937s in_memory = xr.Dataset( 1937s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1937s ) 1937s 1937s assert_identical( 1937s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1937s ) 1937s 1937s > with self.roundtrip(in_memory) as on_disk: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'a' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_ondisk_after_print[3] _______________ 1937s 1937s self = 1937s 1937s def test_ondisk_after_print(self) -> None: 1937s """Make sure print does not load file into memory""" 1937s in_memory = create_test_data() 1937s > with self.roundtrip(in_memory) as on_disk: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________ TestZarrDirectoryStore.test_roundtrip_bytes_with_fill_value[3] ________ 1937s 1937s self = 1937s 1937s def test_roundtrip_bytes_with_fill_value(self) -> None: 1937s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1937s encoding = {"_FillValue": b"X", "dtype": "S1"} 1937s original = Dataset({"x": ("t", values, {}, encoding)}) 1937s expected = original.copy(deep=True) 1937s > with self.roundtrip(original) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _____ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value0-False] ______ 1937s 1937s self = 1937s fill_value = np.int8(-1), exp_fill_warning = False 1937s 1937s @pytest.mark.parametrize( 1937s ("fill_value", "exp_fill_warning"), 1937s [ 1937s (np.int8(-1), False), 1937s (np.uint8(255), True), 1937s (-1, False), 1937s (255, True), 1937s ], 1937s ) 1937s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1937s @contextlib.contextmanager 1937s def _roundtrip_with_warnings(*args, **kwargs): 1937s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1937s if exp_fill_warning and is_np2: 1937s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1937s SerializationWarning, 1937s match="_FillValue attribute can't be represented", 1937s ) 1937s else: 1937s warn_checker = contextlib.nullcontext() 1937s with warn_checker: 1937s with self.roundtrip(*args, **kwargs) as actual: 1937s yield actual 1937s 1937s # regression/numpy2 test for 1937s encoding = { 1937s "_FillValue": fill_value, 1937s "_Unsigned": "true", 1937s "dtype": "i1", 1937s } 1937s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1937s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1937s 1937s attributes = { 1937s "_FillValue": fill_value, 1937s "_Unsigned": "true", 1937s } 1937s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1937s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1937s encoded = Dataset({"x": ("t", sb, attributes)}) 1937s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1937s 1937s > with _roundtrip_with_warnings(decoded) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1937s with self.roundtrip(*args, **kwargs) as actual: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Int8' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_roundtrip_unsigned[3-fill_value1-True] ______ 1937s 1937s self = 1937s fill_value = np.uint8(255), exp_fill_warning = True 1937s 1937s @pytest.mark.parametrize( 1937s ("fill_value", "exp_fill_warning"), 1937s [ 1937s (np.int8(-1), False), 1937s (np.uint8(255), True), 1937s (-1, False), 1937s (255, True), 1937s ], 1937s ) 1937s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1937s @contextlib.contextmanager 1937s def _roundtrip_with_warnings(*args, **kwargs): 1937s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1937s if exp_fill_warning and is_np2: 1937s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1937s SerializationWarning, 1937s match="_FillValue attribute can't be represented", 1937s ) 1937s else: 1937s warn_checker = contextlib.nullcontext() 1937s with warn_checker: 1937s with self.roundtrip(*args, **kwargs) as actual: 1937s yield actual 1937s 1937s # regression/numpy2 test for 1937s encoding = { 1937s "_FillValue": fill_value, 1937s "_Unsigned": "true", 1937s "dtype": "i1", 1937s } 1937s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1937s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1937s 1937s attributes = { 1937s "_FillValue": fill_value, 1937s "_Unsigned": "true", 1937s } 1937s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1937s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1937s encoded = Dataset({"x": ("t", sb, attributes)}) 1937s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1937s 1937s > with _roundtrip_with_warnings(decoded) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1937s with self.roundtrip(*args, **kwargs) as actual: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Int8' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3--1-False] __________ 1937s 1937s self = 1937s fill_value = -1, exp_fill_warning = False 1937s 1937s @pytest.mark.parametrize( 1937s ("fill_value", "exp_fill_warning"), 1937s [ 1937s (np.int8(-1), False), 1937s (np.uint8(255), True), 1937s (-1, False), 1937s (255, True), 1937s ], 1937s ) 1937s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1937s @contextlib.contextmanager 1937s def _roundtrip_with_warnings(*args, **kwargs): 1937s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1937s if exp_fill_warning and is_np2: 1937s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1937s SerializationWarning, 1937s match="_FillValue attribute can't be represented", 1937s ) 1937s else: 1937s warn_checker = contextlib.nullcontext() 1937s with warn_checker: 1937s with self.roundtrip(*args, **kwargs) as actual: 1937s yield actual 1937s 1937s # regression/numpy2 test for 1937s encoding = { 1937s "_FillValue": fill_value, 1937s "_Unsigned": "true", 1937s "dtype": "i1", 1937s } 1937s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1937s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1937s 1937s attributes = { 1937s "_FillValue": fill_value, 1937s "_Unsigned": "true", 1937s } 1937s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1937s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1937s encoded = Dataset({"x": ("t", sb, attributes)}) 1937s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1937s 1937s > with _roundtrip_with_warnings(decoded) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1937s with self.roundtrip(*args, **kwargs) as actual: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Int8' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s __________ TestZarrDirectoryStore.test_roundtrip_unsigned[3-255-True] __________ 1937s 1937s self = 1937s fill_value = 255, exp_fill_warning = True 1937s 1937s @pytest.mark.parametrize( 1937s ("fill_value", "exp_fill_warning"), 1937s [ 1937s (np.int8(-1), False), 1937s (np.uint8(255), True), 1937s (-1, False), 1937s (255, True), 1937s ], 1937s ) 1937s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1937s @contextlib.contextmanager 1937s def _roundtrip_with_warnings(*args, **kwargs): 1937s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1937s if exp_fill_warning and is_np2: 1937s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1937s SerializationWarning, 1937s match="_FillValue attribute can't be represented", 1937s ) 1937s else: 1937s warn_checker = contextlib.nullcontext() 1937s with warn_checker: 1937s with self.roundtrip(*args, **kwargs) as actual: 1937s yield actual 1937s 1937s # regression/numpy2 test for 1937s encoding = { 1937s "_FillValue": fill_value, 1937s "_Unsigned": "true", 1937s "dtype": "i1", 1937s } 1937s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1937s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1937s 1937s attributes = { 1937s "_FillValue": fill_value, 1937s "_Unsigned": "true", 1937s } 1937s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1937s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1937s encoded = Dataset({"x": ("t", sb, attributes)}) 1937s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1937s 1937s > with _roundtrip_with_warnings(decoded) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1937s with self.roundtrip(*args, **kwargs) as actual: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Int8' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1937s 1937s self = 1937s 1937s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1937s original = self._create_cf_dataset() 1937s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = 1937s name = 'det_lim' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _ TestZarrDirectoryStore.test_coordinate_variables_after_dataset_roundtrip[3] __ 1937s 1937s self = 1937s 1937s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1937s original = self._create_cf_dataset() 1937s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = 1937s name = 'det_lim' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _ TestZarrDirectoryStore.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1937s 1937s self = 1937s 1937s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1937s self, 1937s ) -> None: 1937s original = self._create_cf_dataset() 1937s # The DataArray roundtrip should have the same warnings as the 1937s # Dataset, but we already tested for those, so just go for the 1937s # new warnings. It would appear that there is no way to tell 1937s # pytest "This warning and also this warning should both be 1937s # present". 1937s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1937s # needs the to_dataset. The other backends should be fine 1937s # without it. 1937s with pytest.warns( 1937s UserWarning, 1937s match=( 1937s r"Variable\(s\) referenced in bounds not in variables: " 1937s r"\['l(at|ong)itude_bnds'\]" 1937s ), 1937s ): 1937s > with self.roundtrip( 1937s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'ln_p' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s 1937s During handling of the above exception, another exception occurred: 1937s 1937s self = 1937s 1937s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1937s self, 1937s ) -> None: 1937s original = self._create_cf_dataset() 1937s # The DataArray roundtrip should have the same warnings as the 1937s # Dataset, but we already tested for those, so just go for the 1937s # new warnings. It would appear that there is no way to tell 1937s # pytest "This warning and also this warning should both be 1937s # present". 1937s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1937s # needs the to_dataset. The other backends should be fine 1937s # without it. 1937s > with pytest.warns( 1937s UserWarning, 1937s match=( 1937s r"Variable\(s\) referenced in bounds not in variables: " 1937s r"\['l(at|ong)itude_bnds'\]" 1937s ), 1937s ): 1937s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1937s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1937s E Emitted warnings: [ ZarrUserWarning('Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future.')]. 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1937s ________________ TestZarrDirectoryStore.test_encoding_kwarg[3] _________________ 1937s 1937s self = 1937s 1937s def test_encoding_kwarg(self) -> None: 1937s ds = Dataset({"x": ("y", np.arange(10.0))}) 1937s 1937s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1937s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float32' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_default_fill_value[3] _______________ 1937s 1937s self = 1937s 1937s def test_default_fill_value(self) -> None: 1937s # Test default encoding for float: 1937s ds = Dataset({"x": ("y", np.arange(10.0))}) 1937s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1937s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float32' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord[3] ______ 1937s 1937s self = 1937s 1937s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1937s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1937s ds.y.encoding["_FillValue"] = None 1937s > with self.roundtrip(ds) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _ TestZarrDirectoryStore.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1937s 1937s self = 1937s 1937s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1937s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1937s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1937s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_encoding_same_dtype[3] ______________ 1937s 1937s self = 1937s 1937s def test_encoding_same_dtype(self) -> None: 1937s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1937s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1937s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float32' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ____________ TestZarrDirectoryStore.test_append_overwrite_values[3] ____________ 1937s 1937s self = 1937s 1937s def test_append_overwrite_values(self) -> None: 1937s # regression for GH1215 1937s data = create_test_data() 1937s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1937s self.save(data, tmp_file, mode="w") 1937s data["var2"][:] = -999 1937s data["var9"] = data["var2"] * 3 1937s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1937s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-False] __________ 1937s 1937s self = 1937s consolidated = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s def test_roundtrip_consolidated(self, consolidated) -> None: 1937s expected = create_test_data() 1937s > with self.roundtrip( 1937s expected, 1937s save_kwargs={"consolidated": consolidated}, 1937s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-True] __________ 1937s 1937s self = 1937s consolidated = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s def test_roundtrip_consolidated(self, consolidated) -> None: 1937s expected = create_test_data() 1937s > with self.roundtrip( 1937s expected, 1937s save_kwargs={"consolidated": consolidated}, 1937s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s __________ TestZarrDirectoryStore.test_roundtrip_consolidated[3-None] __________ 1937s 1937s self = 1937s consolidated = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s def test_roundtrip_consolidated(self, consolidated) -> None: 1937s expected = create_test_data() 1937s > with self.roundtrip( 1937s expected, 1937s save_kwargs={"consolidated": consolidated}, 1937s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _________ TestZarrDirectoryStore.test_read_non_consolidated_warning[3] _________ 1937s 1937s self = 1937s 1937s def test_read_non_consolidated_warning(self) -> None: 1937s expected = create_test_data() 1937s with self.create_zarr_target() as store: 1937s self.save( 1937s expected, store_target=store, consolidated=False, **self.version_kwargs 1937s ) 1937s with pytest.warns( 1937s RuntimeWarning, 1937s match="Failed to open Zarr store with consolidated", 1937s ): 1937s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_non_existent_store[3] _______________ 1937s 1937s self = 1937s 1937s def test_non_existent_store(self) -> None: 1937s with pytest.raises( 1937s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1937s ): 1937s > xr.open_zarr(f"{uuid.uuid4()}") 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1937s store = ZarrStore.open_group( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1937s ) = _get_open_params( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1937s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1937s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1937s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1937s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1937s raise return_result 1937s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1937s return await coro 1937s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1937s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1937s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1937s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1937s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1937s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1937s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1937s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1937s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1937s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1937s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1937s await store._open() 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/0ef81a51-e255-4f77-899e-5b487e9d2dfe') 1937s 1937s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1937s if not self.read_only: 1937s self.root.mkdir(parents=True, exist_ok=True) 1937s 1937s if not self.root.exists(): 1937s > raise FileNotFoundError(f"{self.root} does not exist") 1937s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/0ef81a51-e255-4f77-899e-5b487e9d2dfe does not exist 1937s 1937s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1937s 1937s During handling of the above exception, another exception occurred: 1937s 1937s self = 1937s 1937s def test_non_existent_store(self) -> None: 1937s > with pytest.raises( 1937s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1937s ): 1937s E AssertionError: Regex pattern did not match. 1937s E Regex: '(No such file or directory|Unable to find group)' 1937s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/0ef81a51-e255-4f77-899e-5b487e9d2dfe does not exist' 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1937s __________________ TestZarrDirectoryStore.test_auto_chunk[3] ___________________ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_auto_chunk(self) -> None: 1937s original = create_test_data().chunk() 1937s 1937s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _________________ TestZarrDirectoryStore.test_manual_chunk[3] __________________ 1937s 1937s self = 1937s 1937s @requires_dask 1937s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1937s def test_manual_chunk(self) -> None: 1937s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1937s 1937s # Using chunks = None should return non-chunked arrays 1937s open_kwargs: dict[str, Any] = {"chunks": None} 1937s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _____________ TestZarrDirectoryStore.test_warning_on_bad_chunks[3] _____________ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_warning_on_bad_chunks(self) -> None: 1937s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1937s 1937s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1937s for chunks in bad_chunks: 1937s kwargs = {"chunks": chunks} 1937s with pytest.warns(UserWarning): 1937s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ___________ TestZarrDirectoryStore.test_write_uneven_dask_chunks[3] ____________ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_write_uneven_dask_chunks(self) -> None: 1937s # regression for GH#2225 1937s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1937s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrDirectoryStore.test_chunk_encoding[3] _________________ 1937s 1937s self = 1937s 1937s def test_chunk_encoding(self) -> None: 1937s # These datasets have no dask chunks. All chunking specified in 1937s # encoding 1937s data = create_test_data() 1937s chunks = (5, 5) 1937s data["var2"].encoding.update({"chunks": chunks}) 1937s 1937s > with self.roundtrip(data) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrDirectoryStore.test_shard_encoding[3] _________________ 1937s 1937s self = 1937s 1937s def test_shard_encoding(self) -> None: 1937s # These datasets have no dask chunks. All chunking/sharding specified in 1937s # encoding 1937s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1937s data = create_test_data() 1937s chunks = (1, 1) 1937s shards = (5, 5) 1937s data["var2"].encoding.update({"chunks": chunks}) 1937s data["var2"].encoding.update({"shards": shards}) 1937s > with self.roundtrip(data) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _________ TestZarrDirectoryStore.test_write_persistence_modes[3-None] __________ 1937s 1937s self = 1937s group = None 1937s 1937s @pytest.mark.parametrize("group", [None, "group1"]) 1937s def test_write_persistence_modes(self, group) -> None: 1937s original = create_test_data() 1937s 1937s # overwrite mode 1937s > with self.roundtrip( 1937s original, 1937s save_kwargs={"mode": "w", "group": group}, 1937s open_kwargs={"group": group}, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________ TestZarrDirectoryStore.test_write_persistence_modes[3-group1] _________ 1937s 1937s self = 1937s group = 'group1' 1937s 1937s @pytest.mark.parametrize("group", [None, "group1"]) 1937s def test_write_persistence_modes(self, group) -> None: 1937s original = create_test_data() 1937s 1937s # overwrite mode 1937s > with self.roundtrip( 1937s original, 1937s save_kwargs={"mode": "w", "group": group}, 1937s open_kwargs={"group": group}, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_compressor_encoding[3] ______________ 1937s 1937s self = 1937s 1937s def test_compressor_encoding(self) -> None: 1937s # specify a custom compressor 1937s original = create_test_data() 1937s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1937s encoding_key = "compressors" 1937s # all parameters need to be explicitly specified in order for the comparison to pass below 1937s encoding = { 1937s "serializer": zarr.codecs.BytesCodec(endian="little"), 1937s encoding_key: ( 1937s zarr.codecs.BloscCodec( 1937s cname="zstd", 1937s clevel=3, 1937s shuffle="shuffle", 1937s typesize=8, 1937s blocksize=0, 1937s ), 1937s ), 1937s } 1937s else: 1937s from numcodecs.blosc import Blosc 1937s 1937s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1937s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1937s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1937s 1937s save_kwargs = dict(encoding={"var1": encoding}) 1937s 1937s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _____________________ TestZarrDirectoryStore.test_group[3] _____________________ 1937s 1937s self = 1937s 1937s def test_group(self) -> None: 1937s original = create_test_data() 1937s group = "some/random/path" 1937s > with self.roundtrip( 1937s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _________________ TestZarrDirectoryStore.test_append_write[3] __________________ 1937s 1937s self = 1937s 1937s def test_append_write(self) -> None: 1937s > super().test_append_write() 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1937s with self.roundtrip_append(data) as actual: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1937s self.save(data[[key]], path, mode=mode, **save_kwargs) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1937s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _____ TestZarrDirectoryStore.test_append_with_append_dim_not_set_raises[3] _____ 1937s 1937s self = 1937s 1937s def test_append_with_append_dim_not_set_raises(self) -> None: 1937s ds, ds_to_append, _ = create_append_test_data() 1937s with self.create_zarr_target() as store_target: 1937s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1937s with pytest.raises(ValueError, match="different dimension sizes"): 1937s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'da' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _____ TestZarrDirectoryStore.test_append_string_length_mismatch_works[3-U] _____ 1937s 1937s self = 1937s dtype = 'U' 1937s 1937s @pytest.mark.parametrize("dtype", ["U", "S"]) 1937s def test_append_string_length_mismatch_works(self, dtype) -> None: 1937s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1937s # ...but it probably would if we used object dtype 1937s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1937s expected = xr.concat([ds, ds_to_append], dim="time") 1937s with self.create_zarr_target() as store_target: 1937s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1937s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1937s _validate_datatypes_for_zarr_append( 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s vname = 'temperature' 1937s existing_var = Size: 24B 1937s [3 values with dtype= Size: 60B 1937s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 1937s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1937s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1937s f"dataset to append has dtype {new_var.dtype}." 1937s ) 1937s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 1937s dtype = 'S' 1937s 1937s @pytest.mark.parametrize("dtype", ["U", "S"]) 1937s def test_append_string_length_mismatch_works(self, dtype) -> None: 1937s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1937s # ...but it probably would if we used object dtype 1937s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1937s expected = xr.concat([ds, ds_to_append], dim="time") 1937s with self.create_zarr_target() as store_target: 1937s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1937s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1937s _validate_datatypes_for_zarr_append( 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s vname = 'temperature' 1937s existing_var = Size: 6B 1937s [3 values with dtype=|S2] 1937s new_var = Size: 9B 1937s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1937s 1937s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1937s """If variable exists in the store, confirm dtype of the data to append is compatible with 1937s existing dtype. 1937s """ 1937s if ( 1937s np.issubdtype(new_var.dtype, np.number) 1937s or np.issubdtype(new_var.dtype, np.datetime64) 1937s or np.issubdtype(new_var.dtype, np.bool_) 1937s or new_var.dtype == object 1937s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1937s ): 1937s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1937s # new to the dataset, because in this case there is no existing var to compare it to; 1937s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1937s # we can be confident appending won't cause problems. Examples of dtypes which are not 1937s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1937s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1937s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1937s f"dataset to append has dtype {new_var.dtype}." 1937s ) 1937s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype |S2 but dataset to append has dtype |S3. 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1937s ___ TestZarrDirectoryStore.test_check_encoding_is_consistent_after_append[3] ___ 1937s 1937s self = 1937s 1937s def test_check_encoding_is_consistent_after_append(self) -> None: 1937s ds, ds_to_append, _ = create_append_test_data() 1937s 1937s # check encoding consistency 1937s with self.create_zarr_target() as store_target: 1937s import numcodecs 1937s 1937s encoding_value: Any 1937s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1937s compressor = zarr.codecs.BloscCodec() 1937s else: 1937s compressor = numcodecs.Blosc() 1937s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1937s encoding_value = (compressor,) if has_zarr_v3 else compressor 1937s 1937s encoding = {"da": {encoding_key: encoding_value}} 1937s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1937s > original_ds = xr.open_dataset( 1937s store_target, engine="zarr", **self.version_kwargs 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'da' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ___________ TestZarrDirectoryStore.test_append_with_new_variable[3] ____________ 1937s 1937s self = 1937s 1937s def test_append_with_new_variable(self) -> None: 1937s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1937s 1937s # check append mode for new variable 1937s with self.create_zarr_target() as store_target: 1937s combined = xr.concat([ds, ds_to_append], dim="time") 1937s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1937s assert_identical( 1937s combined, 1937s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'da' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_append_with_append_dim_no_overwrite[3] ______ 1937s 1937s self = 1937s 1937s def test_append_with_append_dim_no_overwrite(self) -> None: 1937s ds, ds_to_append, _ = create_append_test_data() 1937s with self.create_zarr_target() as store_target: 1937s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1937s original = xr.concat([ds, ds_to_append], dim="time") 1937s original2 = xr.concat([original, ds_to_append], dim="time") 1937s 1937s # overwrite a coordinate; 1937s # for mode='a-', this will not get written to the store 1937s # because it does not have the append_dim as a dim 1937s lon = ds_to_append.lon.to_numpy().copy() 1937s lon[:] = -999 1937s ds_to_append["lon"] = lon 1937s > ds_to_append.to_zarr( 1937s store_target, mode="a-", append_dim="time", **self.version_kwargs 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'da' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________ TestZarrDirectoryStore.test_to_zarr_compute_false_roundtrip[3] ________ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_to_zarr_compute_false_roundtrip(self) -> None: 1937s from dask.delayed import Delayed 1937s 1937s original = create_test_data().chunk() 1937s 1937s with self.create_zarr_target() as store: 1937s delayed_obj = self.save(original, store, compute=False) 1937s assert isinstance(delayed_obj, Delayed) 1937s 1937s # make sure target store has not been written to yet 1937s with pytest.raises(AssertionError): 1937s > with self.open(store) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ____ TestZarrDirectoryStore.test_to_zarr_append_compute_false_roundtrip[3] _____ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1937s from dask.delayed import Delayed 1937s 1937s ds, ds_to_append, _ = create_append_test_data() 1937s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1937s 1937s with pytest.warns(SerializationWarning): 1937s with self.create_zarr_target() as store: 1937s delayed_obj = self.save(ds, store, compute=False, mode="w") 1937s assert isinstance(delayed_obj, Delayed) 1937s 1937s with pytest.raises(AssertionError): 1937s > with self.open(store) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'da' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_save_emptydim[3-False] ______________ 1937s 1937s self = 1937s chunk = False 1937s 1937s @pytest.mark.parametrize("chunk", [False, True]) 1937s def test_save_emptydim(self, chunk) -> None: 1937s if chunk and not has_dask: 1937s pytest.skip("requires dask") 1937s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1937s if chunk: 1937s ds = ds.chunk({}) # chunk dataset to save dask array 1937s > with self.roundtrip(ds) as ds_reload: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_save_emptydim[3-True] _______________ 1937s 1937s self = 1937s chunk = True 1937s 1937s @pytest.mark.parametrize("chunk", [False, True]) 1937s def test_save_emptydim(self, chunk) -> None: 1937s if chunk and not has_dask: 1937s pytest.skip("requires dask") 1937s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1937s if chunk: 1937s ds = ds.chunk({}) # chunk dataset to save dask array 1937s > with self.roundtrip(ds) as ds_reload: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ___ TestZarrDirectoryStore.test_no_warning_from_open_emptydim_with_chunks[3] ___ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1937s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1937s with assert_no_warnings(): 1937s with warnings.catch_warnings(): 1937s warnings.filterwarnings( 1937s "ignore", 1937s message=".*Zarr format 3 specification.*", 1937s category=UserWarning, 1937s ) 1937s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _____ TestZarrDirectoryStore.test_write_region[3-False-False-False-False] ______ 1937s 1937s self = 1937s consolidated = False, compute = False, use_dask = False, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-True] ______ 1937s 1937s self = 1937s consolidated = True, compute = False, use_dask = False, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-False-False-False-None] ______ 1937s 1937s self = 1937s consolidated = None, compute = False, use_dask = False, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-False] ______ 1937s 1937s self = 1937s consolidated = False, compute = True, use_dask = False, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-True] _______ 1937s 1937s self = 1937s consolidated = True, compute = True, use_dask = False, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-False-False-True-None] _______ 1937s 1937s self = 1937s consolidated = None, compute = True, use_dask = False, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-False] ______ 1937s 1937s self = 1937s consolidated = False, compute = False, use_dask = True, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-True] _______ 1937s 1937s self = 1937s consolidated = True, compute = False, use_dask = True, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-False-True-False-None] _______ 1937s 1937s self = 1937s consolidated = None, compute = False, use_dask = True, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-False-True-True-False] _______ 1937s 1937s self = 1937s consolidated = False, compute = True, use_dask = True, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-True] _______ 1937s 1937s self = 1937s consolidated = True, compute = True, use_dask = True, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-False-True-True-None] _______ 1937s 1937s self = 1937s consolidated = None, compute = True, use_dask = True, write_empty = False 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-False] ______ 1937s 1937s self = 1937s consolidated = False, compute = False, use_dask = False, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-True] _______ 1937s 1937s self = 1937s consolidated = True, compute = False, use_dask = False, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-True-False-False-None] _______ 1937s 1937s self = 1937s consolidated = None, compute = False, use_dask = False, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-True-False-True-False] _______ 1937s 1937s self = 1937s consolidated = False, compute = True, use_dask = False, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-True] _______ 1937s 1937s self = 1937s consolidated = True, compute = True, use_dask = False, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-True-False-True-None] _______ 1937s 1937s self = 1937s consolidated = None, compute = True, use_dask = False, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-True-True-False-False] _______ 1937s 1937s self = 1937s consolidated = False, compute = False, use_dask = True, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-True] _______ 1937s 1937s self = 1937s consolidated = True, compute = False, use_dask = True, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-True-True-False-None] _______ 1937s 1937s self = 1937s consolidated = None, compute = False, use_dask = True, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-False] _______ 1937s 1937s self = 1937s consolidated = False, compute = True, use_dask = True, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-True] ________ 1937s 1937s self = 1937s consolidated = True, compute = True, use_dask = True, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-True-True-True-None] ________ 1937s 1937s self = 1937s consolidated = None, compute = True, use_dask = True, write_empty = True 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-False] ______ 1937s 1937s self = 1937s consolidated = False, compute = False, use_dask = False, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-True] _______ 1937s 1937s self = 1937s consolidated = True, compute = False, use_dask = False, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-None-False-False-None] _______ 1937s 1937s self = 1937s consolidated = None, compute = False, use_dask = False, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-None-False-True-False] _______ 1937s 1937s self = 1937s consolidated = False, compute = True, use_dask = False, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-True] _______ 1937s 1937s self = 1937s consolidated = True, compute = True, use_dask = False, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-None-False-True-None] _______ 1937s 1937s self = 1937s consolidated = None, compute = True, use_dask = False, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_region[3-None-True-False-False] _______ 1937s 1937s self = 1937s consolidated = False, compute = False, use_dask = True, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-True] _______ 1937s 1937s self = 1937s consolidated = True, compute = False, use_dask = True, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-None-True-False-None] _______ 1937s 1937s self = 1937s consolidated = None, compute = False, use_dask = True, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s assert_identical(actual, zeros) 1937s for i in range(0, 10, 2): 1937s region = {"x": slice(i, i + 2)} 1937s > nonzeros.isel(region).to_zarr( 1937s store, 1937s region=region, 1937s consolidated=consolidated, 1937s write_empty_chunks=write_empty, 1937s **self.version_kwargs, 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-False] _______ 1937s 1937s self = 1937s consolidated = False, compute = True, use_dask = True, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-True] ________ 1937s 1937s self = 1937s consolidated = True, compute = True, use_dask = True, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______ TestZarrDirectoryStore.test_write_region[3-None-True-True-None] ________ 1937s 1937s self = 1937s consolidated = None, compute = True, use_dask = True, write_empty = None 1937s 1937s @pytest.mark.parametrize("consolidated", [False, True, None]) 1937s @pytest.mark.parametrize("compute", [False, True]) 1937s @pytest.mark.parametrize("use_dask", [False, True]) 1937s @pytest.mark.parametrize("write_empty", [False, True, None]) 1937s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1937s if (use_dask or not compute) and not has_dask: 1937s pytest.skip("requires dask") 1937s 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s 1937s if use_dask: 1937s zeros = zeros.chunk(2) 1937s nonzeros = nonzeros.chunk(2) 1937s 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr( 1937s store, 1937s consolidated=consolidated, 1937s compute=compute, 1937s encoding={"u": dict(chunks=2)}, 1937s **self.version_kwargs, 1937s ) 1937s if compute: 1937s > with xr.open_zarr( 1937s store, consolidated=consolidated, **self.version_kwargs 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ____________ TestZarrDirectoryStore.test_write_region_mode[3-None] _____________ 1937s 1937s self = 1937s mode = None 1937s 1937s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1937s def test_write_region_mode(self, mode) -> None: 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr(store, **self.version_kwargs) 1937s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1937s > nonzeros.isel(region).to_zarr( 1937s store, region=region, mode=mode, **self.version_kwargs 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _____________ TestZarrDirectoryStore.test_write_region_mode[3-r+] ______________ 1937s 1937s self = 1937s mode = 'r+' 1937s 1937s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1937s def test_write_region_mode(self, mode) -> None: 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr(store, **self.version_kwargs) 1937s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1937s > nonzeros.isel(region).to_zarr( 1937s store, region=region, mode=mode, **self.version_kwargs 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_write_region_mode[3-a] ______________ 1937s 1937s self = 1937s mode = 'a' 1937s 1937s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1937s def test_write_region_mode(self, mode) -> None: 1937s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1937s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1937s with self.create_zarr_target() as store: 1937s zeros.to_zarr(store, **self.version_kwargs) 1937s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1937s > nonzeros.isel(region).to_zarr( 1937s store, region=region, mode=mode, **self.version_kwargs 1937s ) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______ TestZarrDirectoryStore.test_write_preexisting_override_metadata[3] ______ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_write_preexisting_override_metadata(self) -> None: 1937s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1937s original = Dataset( 1937s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1937s attrs={"global": "original"}, 1937s ) 1937s both_modified = Dataset( 1937s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1937s attrs={"global": "modified"}, 1937s ) 1937s global_modified = Dataset( 1937s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1937s attrs={"global": "modified"}, 1937s ) 1937s only_new_data = Dataset( 1937s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1937s attrs={"global": "original"}, 1937s ) 1937s 1937s with self.create_zarr_target() as store: 1937s original.to_zarr(store, compute=False, **self.version_kwargs) 1937s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1937s return to_zarr( # type: ignore[call-overload,misc] 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1937s dump_to_store(dataset, zstore, writer, encoding=encoding) 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1937s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1937s k: self.open_store_variable(name=k) for k in existing_variable_names 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'u' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrDirectoryStore.test_encoding_chunksizes[3] ______________ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_encoding_chunksizes(self) -> None: 1937s # regression test for GH2278 1937s # see also test_encoding_chunksizes_unlimited 1937s nx, ny, nt = 4, 4, 5 1937s original = xr.Dataset( 1937s {}, 1937s coords={ 1937s "x": np.arange(nx), 1937s "y": np.arange(ny), 1937s "t": np.arange(nt), 1937s }, 1937s ) 1937s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1937s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1937s 1937s > with self.roundtrip(original) as ds1: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'v' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ____ TestZarrDirectoryStore.test_chunk_encoding_with_partial_dask_chunks[3] ____ 1937s 1937s self = 1937s 1937s @requires_dask 1937s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1937s original = xr.Dataset( 1937s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1937s ).chunk({"a": 3}) 1937s 1937s > with self.roundtrip( 1937s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1937s ) as ds1: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _____________ TestZarrDirectoryStore.test_open_zarr_use_cftime[3] ______________ 1937s 1937s self = 1937s 1937s @requires_cftime 1937s def test_open_zarr_use_cftime(self) -> None: 1937s ds = create_test_data() 1937s with self.create_zarr_target() as store_target: 1937s ds.to_zarr(store_target, **self.version_kwargs) 1937s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ____________ TestZarrDirectoryStore.test_write_read_select_write[3] ____________ 1937s 1937s self = 1937s 1937s def test_write_read_select_write(self) -> None: 1937s # Test for https://github.com/pydata/xarray/issues/4084 1937s ds = create_test_data() 1937s 1937s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1937s with self.create_zarr_target() as initial_store: 1937s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1937s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrDirectoryStore.test_attributes[3-obj1] ________________ 1937s 1937s self = 1937s obj = Size: 8B 1937s array(nan) 1937s Attributes: 1937s good: {'key': 'value'} 1937s 1937s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1937s def test_attributes(self, obj) -> None: 1937s obj = obj.copy() 1937s 1937s obj.attrs["good"] = {"key": "value"} 1937s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1937s with self.create_zarr_target() as store_target: 1937s ds.to_zarr(store_target, **self.version_kwargs) 1937s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1937s ds = open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'foo' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] _ 1937s 1937s self = 1937s dtype = 'datetime64[ns]' 1937s 1937s @requires_dask 1937s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1937s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1937s # Generalized from @malmans2's test in PR #8253 1937s original = create_test_data().astype(dtype).chunk(1) 1937s > with self.roundtrip( 1937s original, 1937s open_kwargs={ 1937s "chunks": {}, 1937s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1937s }, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _ TestZarrDirectoryStore.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 1937s 1937s self = 1937s dtype = 'timedelta64[ns]' 1937s 1937s @requires_dask 1937s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1937s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1937s # Generalized from @malmans2's test in PR #8253 1937s original = create_test_data().astype(dtype).chunk(1) 1937s > with self.roundtrip( 1937s original, 1937s open_kwargs={ 1937s "chunks": {}, 1937s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1937s }, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _________ TestZarrDirectoryStore.test_zarr_fill_value_setting[3-float] _________ 1937s 1937s self = 1937s dtype = 1937s 1937s @requires_dask 1937s @pytest.mark.parametrize("dtype", [int, float]) 1937s def test_zarr_fill_value_setting(self, dtype): 1937s # When zarr_format=2, _FillValue sets fill_value 1937s # When zarr_format=3, fill_value is set independently 1937s # We test this by writing a dask array with compute=False, 1937s # on read we should receive chunks filled with `fill_value` 1937s fv = -1 1937s ds = xr.Dataset( 1937s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1937s ) 1937s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1937s 1937s zarr_format_2 = ( 1937s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1937s ) or not has_zarr_v3 1937s if zarr_format_2: 1937s attr = "_FillValue" 1937s expected.foo.attrs[attr] = fv 1937s else: 1937s attr = "fill_value" 1937s if dtype is float: 1937s # for floats, Xarray inserts a default `np.nan` 1937s expected.foo.attrs["_FillValue"] = np.nan 1937s 1937s # turn off all decoding so we see what Zarr returns to us. 1937s # Since chunks, are not written, we should receive on `fill_value` 1937s open_kwargs = { 1937s "mask_and_scale": False, 1937s "consolidated": False, 1937s "use_zarr_fill_value_as_mask": False, 1937s } 1937s save_kwargs = dict(compute=False, consolidated=False) 1937s > with self.roundtrip( 1937s ds, 1937s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1937s open_kwargs=open_kwargs, 1937s ) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'foo' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _____________ TestZarrWriteEmpty.test_zero_dimensional_variable[3] _____________ 1937s 1937s self = 1937s 1937s def test_zero_dimensional_variable(self) -> None: 1937s expected = create_test_data() 1937s expected["float_var"] = ([], 1.0e9, {"units": "units of awesome"}) 1937s expected["bytes_var"] = ([], b"foobar") 1937s expected["string_var"] = ([], "foobar") 1937s > with self.roundtrip(expected) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:408: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ____________________ TestZarrWriteEmpty.test_write_store[3] ____________________ 1937s 1937s self = 1937s 1937s def test_write_store(self) -> None: 1937s expected = create_test_data() 1937s with self.create_store() as store: 1937s expected.dump_to_store(store) 1937s # we need to cf decode the store because it has time and 1937s # non-dimension coordinates 1937s > with xr.decode_cf(store) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:417: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3/dist-packages/xarray/conventions.py:570: in decode_cf 1937s vars, attrs = obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'var3' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrWriteEmpty.test_roundtrip_test_data[3] ________________ 1937s 1937s self = 1937s 1937s def test_roundtrip_test_data(self) -> None: 1937s expected = create_test_data() 1937s > with self.roundtrip(expected) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:441: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s _______________________ TestZarrWriteEmpty.test_load[3] ________________________ 1937s 1937s self = 1937s 1937s def test_load(self) -> None: 1937s expected = create_test_data() 1937s 1937s @contextlib.contextmanager 1937s def assert_loads(vars=None): 1937s if vars is None: 1937s vars = expected 1937s with self.roundtrip(expected) as actual: 1937s for k, v in actual.variables.items(): 1937s # IndexVariables are eagerly loaded into memory 1937s assert v._in_memory == (k in actual.dims) 1937s yield actual 1937s for k, v in actual.variables.items(): 1937s if k in vars: 1937s assert v._in_memory 1937s assert_identical(expected, actual) 1937s 1937s with pytest.raises(AssertionError): 1937s # make sure the contextmanager works! 1937s > with assert_loads() as ds: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:464: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:452: in assert_loads 1937s with self.roundtrip(expected) as actual: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s __________________ TestZarrWriteEmpty.test_dataset_compute[3] __________________ 1937s 1937s self = 1937s 1937s def test_dataset_compute(self) -> None: 1937s expected = create_test_data() 1937s 1937s > with self.roundtrip(expected) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:481: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'dim2' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrWriteEmpty.test_roundtrip_object_dtype[3] _______________ 1937s 1937s self = 1937s 1937s def test_roundtrip_object_dtype(self) -> None: 1937s floats = np.array([0.0, 0.0, 1.0, 2.0, 3.0], dtype=object) 1937s floats_nans = np.array([np.nan, np.nan, 1.0, 2.0, 3.0], dtype=object) 1937s bytes_ = np.array([b"ab", b"cdef", b"g"], dtype=object) 1937s bytes_nans = np.array([b"ab", b"cdef", np.nan], dtype=object) 1937s strings = np.array(["ab", "cdef", "g"], dtype=object) 1937s strings_nans = np.array(["ab", "cdef", np.nan], dtype=object) 1937s all_nans = np.array([np.nan, np.nan], dtype=object) 1937s original = Dataset( 1937s { 1937s "floats": ("a", floats), 1937s "floats_nans": ("a", floats_nans), 1937s "bytes": ("b", bytes_), 1937s "bytes_nans": ("b", bytes_nans), 1937s "strings": ("b", strings), 1937s "strings_nans": ("b", strings_nans), 1937s "all_nans": ("c", all_nans), 1937s "nan": ([], np.nan), 1937s } 1937s ) 1937s expected = original.copy(deep=True) 1937s > with self.roundtrip(original) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:558: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'nan' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ______________ TestZarrWriteEmpty.test_roundtrip_float64_data[3] _______________ 1937s 1937s self = 1937s 1937s def test_roundtrip_float64_data(self) -> None: 1937s expected = Dataset({"x": ("y", np.array([1.0, 2.0, np.pi], dtype="float64"))}) 1937s > with self.roundtrip(expected) as actual: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:646: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1937s return Frozen(dict(*args, **kwargs)) 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1937s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s 1937s self = , name = 'x' 1937s 1937s def open_store_variable(self, name): 1937s zarr_array = self.members[name] 1937s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1937s try_nczarr = self._mode == "r" 1937s dimensions, attributes = _get_zarr_dims_and_attrs( 1937s zarr_array, DIMENSION_KEY, try_nczarr 1937s ) 1937s attributes = dict(attributes) 1937s 1937s encoding = { 1937s "chunks": zarr_array.chunks, 1937s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1937s } 1937s 1937s if _zarr_v3(): 1937s encoding.update( 1937s { 1937s "compressors": zarr_array.compressors, 1937s "filters": zarr_array.filters, 1937s "shards": zarr_array.shards, 1937s } 1937s ) 1937s if self.zarr_group.metadata.zarr_format == 3: 1937s encoding.update({"serializer": zarr_array.serializer}) 1937s else: 1937s encoding.update( 1937s { 1937s "compressor": zarr_array.compressor, 1937s "filters": zarr_array.filters, 1937s } 1937s ) 1937s 1937s if self._use_zarr_fill_value_as_mask: 1937s # Setting this attribute triggers CF decoding for missing values 1937s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1937s if zarr_array.fill_value is not None: 1937s attributes["_FillValue"] = zarr_array.fill_value 1937s elif "_FillValue" in attributes: 1937s original_zarr_dtype = zarr_array.metadata.data_type 1937s attributes["_FillValue"] = FillValueCoder.decode( 1937s > attributes["_FillValue"], original_zarr_dtype.value 1937s ) 1937s E AttributeError: 'Float64' object has no attribute 'value' 1937s 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1937s ________________ TestZarrWriteEmpty.test_orthogonal_indexing[3] ________________ 1937s 1937s self = 1937s 1937s def test_orthogonal_indexing(self) -> None: 1937s in_memory = create_test_data() 1937s > with self.roundtrip(in_memory) as on_disk: 1937s 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:713: 1937s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1937s with self.open(store_target, **open_kwargs) as ds: 1937s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1937s return next(self.gen) 1937s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1937s with xr.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1937s backend_ds = backend.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1937s ds = store_entrypoint.open_dataset( 1937s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1937s vars, attrs = filename_or_obj.load() 1937s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1937s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1937s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________ TestZarrWriteEmpty.test_vectorized_indexing[3] ________________ 1938s 1938s self = 1938s 1938s def test_vectorized_indexing(self) -> None: 1938s in_memory = create_test_data() 1938s > with self.roundtrip(in_memory) as on_disk: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:727: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_vectorized_indexing_negative_step[3] _________ 1938s 1938s self = 1938s 1938s def test_vectorized_indexing_negative_step(self) -> None: 1938s # use dask explicitly when present 1938s open_kwargs: dict[str, Any] | None 1938s if has_dask: 1938s open_kwargs = {"chunks": {}} 1938s else: 1938s open_kwargs = None 1938s in_memory = create_test_data() 1938s 1938s def multiple_indexing(indexers): 1938s # make sure a sequence of lazy indexings certainly works. 1938s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1938s actual = on_disk["var3"] 1938s expected = in_memory["var3"] 1938s for ind in indexers: 1938s actual = actual.isel(ind) 1938s expected = expected.isel(ind) 1938s # make sure the array is not yet loaded into memory 1938s assert not actual.variable._in_memory 1938s assert_identical(expected, actual.load()) 1938s 1938s # with negative step slice. 1938s indexers = [ 1938s { 1938s "dim1": DataArray([[0, 7], [2, 6], [3, 5]], dims=["a", "b"]), 1938s "dim3": slice(-1, 1, -1), 1938s } 1938s ] 1938s > multiple_indexing(indexers) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:817: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:800: in multiple_indexing 1938s with self.roundtrip(in_memory, open_kwargs=open_kwargs) as on_disk: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________ TestZarrWriteEmpty.test_outer_indexing_reversed[3] ______________ 1938s 1938s self = 1938s 1938s def test_outer_indexing_reversed(self) -> None: 1938s # regression test for GH6560 1938s ds = xr.Dataset( 1938s {"z": (("t", "p", "y", "x"), np.ones((1, 1, 31, 40)))}, 1938s ) 1938s 1938s > with self.roundtrip(ds) as on_disk: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:834: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'z' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s __________________ TestZarrWriteEmpty.test_isel_dataarray[3] ___________________ 1938s 1938s self = 1938s 1938s def test_isel_dataarray(self) -> None: 1938s # Make sure isel works lazily. GH:issue:1688 1938s in_memory = create_test_data() 1938s > with self.roundtrip(in_memory) as on_disk: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:841: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _____________ TestZarrWriteEmpty.test_array_type_after_indexing[3] _____________ 1938s 1938s self = 1938s 1938s def test_array_type_after_indexing(self) -> None: 1938s in_memory = create_test_data() 1938s > with self.roundtrip(in_memory) as on_disk: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:868: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________________ TestZarrWriteEmpty.test_dropna[3] _______________________ 1938s 1938s self = 1938s 1938s def test_dropna(self) -> None: 1938s # regression test for GH:issue:1694 1938s a = np.random.randn(4, 3) 1938s a[1, 1] = np.nan 1938s in_memory = xr.Dataset( 1938s {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)} 1938s ) 1938s 1938s assert_identical( 1938s in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2)) 1938s ) 1938s 1938s > with self.roundtrip(in_memory) as on_disk: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:893: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'a' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________ TestZarrWriteEmpty.test_ondisk_after_print[3] _________________ 1938s 1938s self = 1938s 1938s def test_ondisk_after_print(self) -> None: 1938s """Make sure print does not load file into memory""" 1938s in_memory = create_test_data() 1938s > with self.roundtrip(in_memory) as on_disk: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:902: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s __________ TestZarrWriteEmpty.test_roundtrip_bytes_with_fill_value[3] __________ 1938s 1938s self = 1938s 1938s def test_roundtrip_bytes_with_fill_value(self) -> None: 1938s values = np.array([b"ab", b"cdef", np.nan], dtype=object) 1938s encoding = {"_FillValue": b"X", "dtype": "S1"} 1938s original = Dataset({"x": ("t", values, {}, encoding)}) 1938s expected = original.copy(deep=True) 1938s > with self.roundtrip(original) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:913: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'NullTerminatedBytes' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value0-False] ________ 1938s 1938s self = 1938s fill_value = np.int8(-1), exp_fill_warning = False 1938s 1938s @pytest.mark.parametrize( 1938s ("fill_value", "exp_fill_warning"), 1938s [ 1938s (np.int8(-1), False), 1938s (np.uint8(255), True), 1938s (-1, False), 1938s (255, True), 1938s ], 1938s ) 1938s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1938s @contextlib.contextmanager 1938s def _roundtrip_with_warnings(*args, **kwargs): 1938s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1938s if exp_fill_warning and is_np2: 1938s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1938s SerializationWarning, 1938s match="_FillValue attribute can't be represented", 1938s ) 1938s else: 1938s warn_checker = contextlib.nullcontext() 1938s with warn_checker: 1938s with self.roundtrip(*args, **kwargs) as actual: 1938s yield actual 1938s 1938s # regression/numpy2 test for 1938s encoding = { 1938s "_FillValue": fill_value, 1938s "_Unsigned": "true", 1938s "dtype": "i1", 1938s } 1938s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1938s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1938s 1938s attributes = { 1938s "_FillValue": fill_value, 1938s "_Unsigned": "true", 1938s } 1938s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1938s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1938s encoded = Dataset({"x": ("t", sb, attributes)}) 1938s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1938s 1938s > with _roundtrip_with_warnings(decoded) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1938s with self.roundtrip(*args, **kwargs) as actual: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Int8' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-fill_value1-True] ________ 1938s 1938s self = 1938s fill_value = np.uint8(255), exp_fill_warning = True 1938s 1938s @pytest.mark.parametrize( 1938s ("fill_value", "exp_fill_warning"), 1938s [ 1938s (np.int8(-1), False), 1938s (np.uint8(255), True), 1938s (-1, False), 1938s (255, True), 1938s ], 1938s ) 1938s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1938s @contextlib.contextmanager 1938s def _roundtrip_with_warnings(*args, **kwargs): 1938s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1938s if exp_fill_warning and is_np2: 1938s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1938s SerializationWarning, 1938s match="_FillValue attribute can't be represented", 1938s ) 1938s else: 1938s warn_checker = contextlib.nullcontext() 1938s with warn_checker: 1938s with self.roundtrip(*args, **kwargs) as actual: 1938s yield actual 1938s 1938s # regression/numpy2 test for 1938s encoding = { 1938s "_FillValue": fill_value, 1938s "_Unsigned": "true", 1938s "dtype": "i1", 1938s } 1938s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1938s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1938s 1938s attributes = { 1938s "_FillValue": fill_value, 1938s "_Unsigned": "true", 1938s } 1938s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1938s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1938s encoded = Dataset({"x": ("t", sb, attributes)}) 1938s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1938s 1938s > with _roundtrip_with_warnings(decoded) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1938s with self.roundtrip(*args, **kwargs) as actual: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Int8' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3--1-False] ____________ 1938s 1938s self = 1938s fill_value = -1, exp_fill_warning = False 1938s 1938s @pytest.mark.parametrize( 1938s ("fill_value", "exp_fill_warning"), 1938s [ 1938s (np.int8(-1), False), 1938s (np.uint8(255), True), 1938s (-1, False), 1938s (255, True), 1938s ], 1938s ) 1938s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1938s @contextlib.contextmanager 1938s def _roundtrip_with_warnings(*args, **kwargs): 1938s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1938s if exp_fill_warning and is_np2: 1938s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1938s SerializationWarning, 1938s match="_FillValue attribute can't be represented", 1938s ) 1938s else: 1938s warn_checker = contextlib.nullcontext() 1938s with warn_checker: 1938s with self.roundtrip(*args, **kwargs) as actual: 1938s yield actual 1938s 1938s # regression/numpy2 test for 1938s encoding = { 1938s "_FillValue": fill_value, 1938s "_Unsigned": "true", 1938s "dtype": "i1", 1938s } 1938s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1938s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1938s 1938s attributes = { 1938s "_FillValue": fill_value, 1938s "_Unsigned": "true", 1938s } 1938s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1938s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1938s encoded = Dataset({"x": ("t", sb, attributes)}) 1938s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1938s 1938s > with _roundtrip_with_warnings(decoded) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1938s with self.roundtrip(*args, **kwargs) as actual: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Int8' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ____________ TestZarrWriteEmpty.test_roundtrip_unsigned[3-255-True] ____________ 1938s 1938s self = 1938s fill_value = 255, exp_fill_warning = True 1938s 1938s @pytest.mark.parametrize( 1938s ("fill_value", "exp_fill_warning"), 1938s [ 1938s (np.int8(-1), False), 1938s (np.uint8(255), True), 1938s (-1, False), 1938s (255, True), 1938s ], 1938s ) 1938s def test_roundtrip_unsigned(self, fill_value, exp_fill_warning): 1938s @contextlib.contextmanager 1938s def _roundtrip_with_warnings(*args, **kwargs): 1938s is_np2 = module_available("numpy", minversion="2.0.0.dev0") 1938s if exp_fill_warning and is_np2: 1938s warn_checker: contextlib.AbstractContextManager = pytest.warns( 1938s SerializationWarning, 1938s match="_FillValue attribute can't be represented", 1938s ) 1938s else: 1938s warn_checker = contextlib.nullcontext() 1938s with warn_checker: 1938s with self.roundtrip(*args, **kwargs) as actual: 1938s yield actual 1938s 1938s # regression/numpy2 test for 1938s encoding = { 1938s "_FillValue": fill_value, 1938s "_Unsigned": "true", 1938s "dtype": "i1", 1938s } 1938s x = np.array([0, 1, 127, 128, 254, np.nan], dtype=np.float32) 1938s decoded = Dataset({"x": ("t", x, {}, encoding)}) 1938s 1938s attributes = { 1938s "_FillValue": fill_value, 1938s "_Unsigned": "true", 1938s } 1938s # Create unsigned data corresponding to [0, 1, 127, 128, 255] unsigned 1938s sb = np.asarray([0, 1, 127, -128, -2, -1], dtype="i1") 1938s encoded = Dataset({"x": ("t", sb, attributes)}) 1938s unsigned_dtype = np.dtype(f"u{sb.dtype.itemsize}") 1938s 1938s > with _roundtrip_with_warnings(decoded) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1066: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1045: in _roundtrip_with_warnings 1938s with self.roundtrip(*args, **kwargs) as actual: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Int8' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] _ 1938s 1938s self = 1938s 1938s def test_grid_mapping_and_bounds_are_not_coordinates_in_file(self) -> None: 1938s original = self._create_cf_dataset() 1938s > with self.roundtrip(original, open_kwargs={"decode_coords": False}) as ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1142: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = 1938s name = 'det_lim' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___ TestZarrWriteEmpty.test_coordinate_variables_after_dataset_roundtrip[3] ____ 1938s 1938s self = 1938s 1938s def test_coordinate_variables_after_dataset_roundtrip(self) -> None: 1938s original = self._create_cf_dataset() 1938s > with self.roundtrip(original, open_kwargs={"decode_coords": "all"}) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1150: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = 1938s name = 'det_lim' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _ TestZarrWriteEmpty.test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] _ 1938s 1938s self = 1938s 1938s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1938s self, 1938s ) -> None: 1938s original = self._create_cf_dataset() 1938s # The DataArray roundtrip should have the same warnings as the 1938s # Dataset, but we already tested for those, so just go for the 1938s # new warnings. It would appear that there is no way to tell 1938s # pytest "This warning and also this warning should both be 1938s # present". 1938s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1938s # needs the to_dataset. The other backends should be fine 1938s # without it. 1938s with pytest.warns( 1938s UserWarning, 1938s match=( 1938s r"Variable\(s\) referenced in bounds not in variables: " 1938s r"\['l(at|ong)itude_bnds'\]" 1938s ), 1938s ): 1938s > with self.roundtrip( 1938s original["variable"].to_dataset(), open_kwargs={"decode_coords": "all"} 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1182: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'ln_p' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s 1938s During handling of the above exception, another exception occurred: 1938s 1938s self = 1938s 1938s def test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip( 1938s self, 1938s ) -> None: 1938s original = self._create_cf_dataset() 1938s # The DataArray roundtrip should have the same warnings as the 1938s # Dataset, but we already tested for those, so just go for the 1938s # new warnings. It would appear that there is no way to tell 1938s # pytest "This warning and also this warning should both be 1938s # present". 1938s # xarray/tests/test_conventions.py::TestCFEncodedDataStore 1938s # needs the to_dataset. The other backends should be fine 1938s # without it. 1938s > with pytest.warns( 1938s UserWarning, 1938s match=( 1938s r"Variable\(s\) referenced in bounds not in variables: " 1938s r"\['l(at|ong)itude_bnds'\]" 1938s ), 1938s ): 1938s E Failed: DID NOT WARN. No warnings of type (,) matching the regex were emitted. 1938s E Regex: Variable\(s\) referenced in bounds not in variables: \['l(at|ong)itude_bnds'\] 1938s E Emitted warnings: [ ZarrUserWarning('Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future.')]. 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1175: Failed 1938s __________________ TestZarrWriteEmpty.test_encoding_kwarg[3] ___________________ 1938s 1938s self = 1938s 1938s def test_encoding_kwarg(self) -> None: 1938s ds = Dataset({"x": ("y", np.arange(10.0))}) 1938s 1938s kwargs: dict[str, Any] = dict(encoding={"x": {"dtype": "f4"}}) 1938s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1277: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float32' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________ TestZarrWriteEmpty.test_default_fill_value[3] _________________ 1938s 1938s self = 1938s 1938s def test_default_fill_value(self) -> None: 1938s # Test default encoding for float: 1938s ds = Dataset({"x": ("y", np.arange(10.0))}) 1938s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1938s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1319: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float32' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord[3] ________ 1938s 1938s self = 1938s 1938s def test_explicitly_omit_fill_value_in_coord(self) -> None: 1938s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1938s ds.y.encoding["_FillValue"] = None 1938s > with self.roundtrip(ds) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1355: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _ TestZarrWriteEmpty.test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] _ 1938s 1938s self = 1938s 1938s def test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg(self) -> None: 1938s ds = Dataset({"x": ("y", [np.pi, -np.pi])}, coords={"y": [0.0, 1.0]}) 1938s kwargs = dict(encoding={"y": {"_FillValue": None}}) 1938s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1361: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________ TestZarrWriteEmpty.test_encoding_same_dtype[3] ________________ 1938s 1938s self = 1938s 1938s def test_encoding_same_dtype(self) -> None: 1938s ds = Dataset({"x": ("y", np.arange(10.0, dtype="f4"))}) 1938s kwargs = dict(encoding={"x": {"dtype": "f4"}}) 1938s > with self.roundtrip(ds, save_kwargs=kwargs) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1368: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float32' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________ TestZarrWriteEmpty.test_append_overwrite_values[3] ______________ 1938s 1938s self = 1938s 1938s def test_append_overwrite_values(self) -> None: 1938s # regression for GH1215 1938s data = create_test_data() 1938s with create_tmp_file(allow_cleanup_failure=False) as tmp_file: 1938s self.save(data, tmp_file, mode="w") 1938s data["var2"][:] = -999 1938s data["var9"] = data["var2"] * 3 1938s > self.save(data[["var2", "var9"]], tmp_file, mode="a") 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1387: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1938s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-False] ____________ 1938s 1938s self = 1938s consolidated = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s def test_roundtrip_consolidated(self, consolidated) -> None: 1938s expected = create_test_data() 1938s > with self.roundtrip( 1938s expected, 1938s save_kwargs={"consolidated": consolidated}, 1938s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'var3' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-True] ____________ 1938s 1938s self = 1938s consolidated = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s def test_roundtrip_consolidated(self, consolidated) -> None: 1938s expected = create_test_data() 1938s > with self.roundtrip( 1938s expected, 1938s save_kwargs={"consolidated": consolidated}, 1938s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ____________ TestZarrWriteEmpty.test_roundtrip_consolidated[3-None] ____________ 1938s 1938s self = 1938s consolidated = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s def test_roundtrip_consolidated(self, consolidated) -> None: 1938s expected = create_test_data() 1938s > with self.roundtrip( 1938s expected, 1938s save_kwargs={"consolidated": consolidated}, 1938s open_kwargs={"backend_kwargs": {"consolidated": consolidated}}, 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2321: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___________ TestZarrWriteEmpty.test_read_non_consolidated_warning[3] ___________ 1938s 1938s self = 1938s 1938s def test_read_non_consolidated_warning(self) -> None: 1938s expected = create_test_data() 1938s with self.create_zarr_target() as store: 1938s self.save( 1938s expected, store_target=store, consolidated=False, **self.version_kwargs 1938s ) 1938s with pytest.warns( 1938s RuntimeWarning, 1938s match="Failed to open Zarr store with consolidated", 1938s ): 1938s > with xr.open_zarr(store, **self.version_kwargs) as ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2339: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________ TestZarrWriteEmpty.test_non_existent_store[3] _________________ 1938s 1938s self = 1938s 1938s def test_non_existent_store(self) -> None: 1938s with pytest.raises( 1938s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1938s ): 1938s > xr.open_zarr(f"{uuid.uuid4()}") 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2346: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1608: in open_dataset 1938s store = ZarrStore.open_group( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:732: in open_group 1938s ) = _get_open_params( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1811: in _get_open_params 1938s zarr_root_group = zarr.open_consolidated(store, **open_kwargs) 1938s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:231: in open_consolidated 1938s sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs)) 1938s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1938s raise return_result 1938s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1938s return await coro 1938s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:408: in open_consolidated 1938s return await open_group(*args, use_consolidated=use_consolidated, **kwargs) 1938s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1938s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1938s /usr/lib/python3/dist-packages/zarr/storage/_common.py:418: in make_store_path 1938s store = await make_store(store_like, mode=mode, storage_options=storage_options) 1938s /usr/lib/python3/dist-packages/zarr/storage/_common.py:349: in make_store 1938s return await make_store(Path(store_like), mode=mode, storage_options=storage_options) 1938s /usr/lib/python3/dist-packages/zarr/storage/_common.py:339: in make_store 1938s return await LocalStore.open(root=store_like, mode=mode, read_only=_read_only) 1938s /usr/lib/python3/dist-packages/zarr/storage/_local.py:160: in open 1938s await store._open() 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = LocalStore('file:///tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/6598de68-78a1-482e-9f34-7c7a65d93709') 1938s 1938s async def _open(self, *, mode: AccessModeLiteral | None = None) -> None: 1938s if not self.read_only: 1938s self.root.mkdir(parents=True, exist_ok=True) 1938s 1938s if not self.root.exists(): 1938s > raise FileNotFoundError(f"{self.root} does not exist") 1938s E FileNotFoundError: /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/6598de68-78a1-482e-9f34-7c7a65d93709 does not exist 1938s 1938s /usr/lib/python3/dist-packages/zarr/storage/_local.py:172: FileNotFoundError 1938s 1938s During handling of the above exception, another exception occurred: 1938s 1938s self = 1938s 1938s def test_non_existent_store(self) -> None: 1938s > with pytest.raises( 1938s FileNotFoundError, match="(No such file or directory|Unable to find group)" 1938s ): 1938s E AssertionError: Regex pattern did not match. 1938s E Regex: '(No such file or directory|Unable to find group)' 1938s E Input: '/tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build/6598de68-78a1-482e-9f34-7c7a65d93709 does not exist' 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2343: AssertionError 1938s ____________________ TestZarrWriteEmpty.test_auto_chunk[3] _____________________ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_auto_chunk(self) -> None: 1938s original = create_test_data().chunk() 1938s 1938s > with self.roundtrip(original, open_kwargs={"chunks": None}) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2367: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___________________ TestZarrWriteEmpty.test_manual_chunk[3] ____________________ 1938s 1938s self = 1938s 1938s @requires_dask 1938s @pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning") 1938s def test_manual_chunk(self) -> None: 1938s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1938s 1938s # Using chunks = None should return non-chunked arrays 1938s open_kwargs: dict[str, Any] = {"chunks": None} 1938s > with self.roundtrip(original, open_kwargs=open_kwargs) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2388: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______________ TestZarrWriteEmpty.test_warning_on_bad_chunks[3] _______________ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_warning_on_bad_chunks(self) -> None: 1938s original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3}) 1938s 1938s bad_chunks = (2, {"dim2": (3, 3, 2, 1)}) 1938s for chunks in bad_chunks: 1938s kwargs = {"chunks": chunks} 1938s with pytest.warns(UserWarning): 1938s > with self.roundtrip(original, open_kwargs=kwargs) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2433: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _____________ TestZarrWriteEmpty.test_write_uneven_dask_chunks[3] ______________ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_write_uneven_dask_chunks(self) -> None: 1938s # regression for GH#2225 1938s original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3}) 1938s > with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2476: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s __________________ TestZarrWriteEmpty.test_chunk_encoding[3] ___________________ 1938s 1938s self = 1938s 1938s def test_chunk_encoding(self) -> None: 1938s # These datasets have no dask chunks. All chunking specified in 1938s # encoding 1938s data = create_test_data() 1938s chunks = (5, 5) 1938s data["var2"].encoding.update({"chunks": chunks}) 1938s 1938s > with self.roundtrip(data) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2487: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s __________________ TestZarrWriteEmpty.test_shard_encoding[3] ___________________ 1938s 1938s self = 1938s 1938s def test_shard_encoding(self) -> None: 1938s # These datasets have no dask chunks. All chunking/sharding specified in 1938s # encoding 1938s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1938s data = create_test_data() 1938s chunks = (1, 1) 1938s shards = (5, 5) 1938s data["var2"].encoding.update({"chunks": chunks}) 1938s data["var2"].encoding.update({"shards": shards}) 1938s > with self.roundtrip(data) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2505: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___________ TestZarrWriteEmpty.test_write_persistence_modes[3-None] ____________ 1938s 1938s self = 1938s group = None 1938s 1938s @pytest.mark.parametrize("group", [None, "group1"]) 1938s def test_write_persistence_modes(self, group) -> None: 1938s original = create_test_data() 1938s 1938s # overwrite mode 1938s > with self.roundtrip( 1938s original, 1938s save_kwargs={"mode": "w", "group": group}, 1938s open_kwargs={"group": group}, 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s __________ TestZarrWriteEmpty.test_write_persistence_modes[3-group1] ___________ 1938s 1938s self = 1938s group = 'group1' 1938s 1938s @pytest.mark.parametrize("group", [None, "group1"]) 1938s def test_write_persistence_modes(self, group) -> None: 1938s original = create_test_data() 1938s 1938s # overwrite mode 1938s > with self.roundtrip( 1938s original, 1938s save_kwargs={"mode": "w", "group": group}, 1938s open_kwargs={"group": group}, 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2650: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________ TestZarrWriteEmpty.test_compressor_encoding[3] ________________ 1938s 1938s self = 1938s 1938s def test_compressor_encoding(self) -> None: 1938s # specify a custom compressor 1938s original = create_test_data() 1938s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1938s encoding_key = "compressors" 1938s # all parameters need to be explicitly specified in order for the comparison to pass below 1938s encoding = { 1938s "serializer": zarr.codecs.BytesCodec(endian="little"), 1938s encoding_key: ( 1938s zarr.codecs.BloscCodec( 1938s cname="zstd", 1938s clevel=3, 1938s shuffle="shuffle", 1938s typesize=8, 1938s blocksize=0, 1938s ), 1938s ), 1938s } 1938s else: 1938s from numcodecs.blosc import Blosc 1938s 1938s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1938s comp = Blosc(cname="zstd", clevel=3, shuffle=2) 1938s encoding = {encoding_key: (comp,) if has_zarr_v3 else comp} 1938s 1938s save_kwargs = dict(encoding={"var1": encoding}) 1938s 1938s > with self.roundtrip(original, save_kwargs=save_kwargs) as ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2723: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______________________ TestZarrWriteEmpty.test_group[3] _______________________ 1938s 1938s self = 1938s 1938s def test_group(self) -> None: 1938s original = create_test_data() 1938s group = "some/random/path" 1938s > with self.roundtrip( 1938s original, save_kwargs={"group": group}, open_kwargs={"group": group} 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2730: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___________________ TestZarrWriteEmpty.test_append_write[3] ____________________ 1938s 1938s self = 1938s 1938s def test_append_write(self) -> None: 1938s > super().test_append_write() 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2762: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:1377: in test_append_write 1938s with self.roundtrip_append(data) as actual: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:388: in roundtrip_append 1938s self.save(data[[key]], path, mode=mode, **save_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2296: in save 1938s return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______ TestZarrWriteEmpty.test_append_with_append_dim_not_set_raises[3] _______ 1938s 1938s self = 1938s 1938s def test_append_with_append_dim_not_set_raises(self) -> None: 1938s ds, ds_to_append, _ = create_append_test_data() 1938s with self.create_zarr_target() as store_target: 1938s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1938s with pytest.raises(ValueError, match="different dimension sizes"): 1938s > ds_to_append.to_zarr(store_target, mode="a", **self.version_kwargs) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2809: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'da' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______ TestZarrWriteEmpty.test_append_string_length_mismatch_works[3-U] _______ 1938s 1938s self = 1938s dtype = 'U' 1938s 1938s @pytest.mark.parametrize("dtype", ["U", "S"]) 1938s def test_append_string_length_mismatch_works(self, dtype) -> None: 1938s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1938s # ...but it probably would if we used object dtype 1938s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1938s expected = xr.concat([ds, ds_to_append], dim="time") 1938s with self.create_zarr_target() as store_target: 1938s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1938s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1938s _validate_datatypes_for_zarr_append( 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s vname = 'temperature' 1938s existing_var = Size: 24B 1938s [3 values with dtype= Size: 60B 1938s array(['abc', 'def', 'ghijk'], dtype=' raise ValueError( 1938s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1938s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1938s f"dataset to append has dtype {new_var.dtype}." 1938s ) 1938s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype 1938s dtype = 'S' 1938s 1938s @pytest.mark.parametrize("dtype", ["U", "S"]) 1938s def test_append_string_length_mismatch_works(self, dtype) -> None: 1938s skip_if_zarr_format_2("This doesn't work with Zarr format 2") 1938s # ...but it probably would if we used object dtype 1938s ds, ds_to_append = create_append_string_length_mismatch_test_data(dtype) 1938s expected = xr.concat([ds, ds_to_append], dim="time") 1938s with self.create_zarr_target() as store_target: 1938s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1938s > ds_to_append.to_zarr(store_target, append_dim="time", **self.version_kwargs) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2851: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1018: in store 1938s _validate_datatypes_for_zarr_append( 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s vname = 'temperature' 1938s existing_var = Size: 6B 1938s [3 values with dtype=|S2] 1938s new_var = Size: 9B 1938s array([b'aaa', b'bbb', b'ccc'], dtype='|S3') 1938s 1938s def _validate_datatypes_for_zarr_append(vname, existing_var, new_var): 1938s """If variable exists in the store, confirm dtype of the data to append is compatible with 1938s existing dtype. 1938s """ 1938s if ( 1938s np.issubdtype(new_var.dtype, np.number) 1938s or np.issubdtype(new_var.dtype, np.datetime64) 1938s or np.issubdtype(new_var.dtype, np.bool_) 1938s or new_var.dtype == object 1938s or (new_var.dtype.kind in ("S", "U") and existing_var.dtype == object) 1938s ): 1938s # We can skip dtype equality checks under two conditions: (1) if the var to append is 1938s # new to the dataset, because in this case there is no existing var to compare it to; 1938s # or (2) if var to append's dtype is known to be easy-to-append, because in this case 1938s # we can be confident appending won't cause problems. Examples of dtypes which are not 1938s # easy-to-append include length-specified strings of type `|S*` or ` raise ValueError( 1938s f"Mismatched dtypes for variable {vname} between Zarr store on disk " 1938s f"and dataset to append. Store has dtype {existing_var.dtype} but " 1938s f"dataset to append has dtype {new_var.dtype}." 1938s ) 1938s E ValueError: Mismatched dtypes for variable temperature between Zarr store on disk and dataset to append. Store has dtype |S2 but dataset to append has dtype |S3. 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:566: ValueError 1938s _____ TestZarrWriteEmpty.test_check_encoding_is_consistent_after_append[3] _____ 1938s 1938s self = 1938s 1938s def test_check_encoding_is_consistent_after_append(self) -> None: 1938s ds, ds_to_append, _ = create_append_test_data() 1938s 1938s # check encoding consistency 1938s with self.create_zarr_target() as store_target: 1938s import numcodecs 1938s 1938s encoding_value: Any 1938s if has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3: 1938s compressor = zarr.codecs.BloscCodec() 1938s else: 1938s compressor = numcodecs.Blosc() 1938s encoding_key = "compressors" if has_zarr_v3 else "compressor" 1938s encoding_value = (compressor,) if has_zarr_v3 else compressor 1938s 1938s encoding = {"da": {encoding_key: encoding_value}} 1938s ds.to_zarr(store_target, mode="w", encoding=encoding, **self.version_kwargs) 1938s > original_ds = xr.open_dataset( 1938s store_target, engine="zarr", **self.version_kwargs 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2872: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'da' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _____________ TestZarrWriteEmpty.test_append_with_new_variable[3] ______________ 1938s 1938s self = 1938s 1938s def test_append_with_new_variable(self) -> None: 1938s ds, ds_to_append, ds_with_new_var = create_append_test_data() 1938s 1938s # check append mode for new variable 1938s with self.create_zarr_target() as store_target: 1938s combined = xr.concat([ds, ds_to_append], dim="time") 1938s combined.to_zarr(store_target, mode="w", **self.version_kwargs) 1938s assert_identical( 1938s combined, 1938s > xr.open_dataset(store_target, engine="zarr", **self.version_kwargs), 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2899: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'da' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_append_with_append_dim_no_overwrite[3] ________ 1938s 1938s self = 1938s 1938s def test_append_with_append_dim_no_overwrite(self) -> None: 1938s ds, ds_to_append, _ = create_append_test_data() 1938s with self.create_zarr_target() as store_target: 1938s ds.to_zarr(store_target, mode="w", **self.version_kwargs) 1938s original = xr.concat([ds, ds_to_append], dim="time") 1938s original2 = xr.concat([original, ds_to_append], dim="time") 1938s 1938s # overwrite a coordinate; 1938s # for mode='a-', this will not get written to the store 1938s # because it does not have the append_dim as a dim 1938s lon = ds_to_append.lon.to_numpy().copy() 1938s lon[:] = -999 1938s ds_to_append["lon"] = lon 1938s > ds_to_append.to_zarr( 1938s store_target, mode="a-", append_dim="time", **self.version_kwargs 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2922: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'da' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s __________ TestZarrWriteEmpty.test_to_zarr_compute_false_roundtrip[3] __________ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_to_zarr_compute_false_roundtrip(self) -> None: 1938s from dask.delayed import Delayed 1938s 1938s original = create_test_data().chunk() 1938s 1938s with self.create_zarr_target() as store: 1938s delayed_obj = self.save(original, store, compute=False) 1938s assert isinstance(delayed_obj, Delayed) 1938s 1938s # make sure target store has not been written to yet 1938s with pytest.raises(AssertionError): 1938s > with self.open(store) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2948: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______ TestZarrWriteEmpty.test_to_zarr_append_compute_false_roundtrip[3] _______ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_to_zarr_append_compute_false_roundtrip(self) -> None: 1938s from dask.delayed import Delayed 1938s 1938s ds, ds_to_append, _ = create_append_test_data() 1938s ds, ds_to_append = ds.chunk(), ds_to_append.chunk() 1938s 1938s with pytest.warns(SerializationWarning): 1938s with self.create_zarr_target() as store: 1938s delayed_obj = self.save(ds, store, compute=False, mode="w") 1938s assert isinstance(delayed_obj, Delayed) 1938s 1938s with pytest.raises(AssertionError): 1938s > with self.open(store) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2969: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'da' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________ TestZarrWriteEmpty.test_save_emptydim[3-False] ________________ 1938s 1938s self = 1938s chunk = False 1938s 1938s @pytest.mark.parametrize("chunk", [False, True]) 1938s def test_save_emptydim(self, chunk) -> None: 1938s if chunk and not has_dask: 1938s pytest.skip("requires dask") 1938s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1938s if chunk: 1938s ds = ds.chunk({}) # chunk dataset to save dask array 1938s > with self.roundtrip(ds) as ds_reload: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________ TestZarrWriteEmpty.test_save_emptydim[3-True] _________________ 1938s 1938s self = 1938s chunk = True 1938s 1938s @pytest.mark.parametrize("chunk", [False, True]) 1938s def test_save_emptydim(self, chunk) -> None: 1938s if chunk and not has_dask: 1938s pytest.skip("requires dask") 1938s ds = Dataset({"x": (("a", "b"), np.empty((5, 0))), "y": ("a", [1, 2, 5, 8, 9])}) 1938s if chunk: 1938s ds = ds.chunk({}) # chunk dataset to save dask array 1938s > with self.roundtrip(ds) as ds_reload: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3000: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _____ TestZarrWriteEmpty.test_no_warning_from_open_emptydim_with_chunks[3] _____ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_no_warning_from_open_emptydim_with_chunks(self) -> None: 1938s ds = Dataset({"x": (("a", "b"), np.empty((5, 0)))}).chunk({"a": 1}) 1938s with assert_no_warnings(): 1938s with warnings.catch_warnings(): 1938s warnings.filterwarnings( 1938s "ignore", 1938s message=".*Zarr format 3 specification.*", 1938s category=UserWarning, 1938s ) 1938s > with self.roundtrip(ds, open_kwargs=dict(chunks={"a": 1})) as ds_reload: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3013: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______ TestZarrWriteEmpty.test_write_region[3-False-False-False-False] ________ 1938s 1938s self = 1938s consolidated = False, compute = False, use_dask = False, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-True] ________ 1938s 1938s self = 1938s consolidated = True, compute = False, use_dask = False, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-False-False-False-None] ________ 1938s 1938s self = 1938s consolidated = None, compute = False, use_dask = False, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-False] ________ 1938s 1938s self = 1938s consolidated = False, compute = True, use_dask = False, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-True] _________ 1938s 1938s self = 1938s consolidated = True, compute = True, use_dask = False, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-False-False-True-None] _________ 1938s 1938s self = 1938s consolidated = None, compute = True, use_dask = False, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-False] ________ 1938s 1938s self = 1938s consolidated = False, compute = False, use_dask = True, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-True] _________ 1938s 1938s self = 1938s consolidated = True, compute = False, use_dask = True, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-False-True-False-None] _________ 1938s 1938s self = 1938s consolidated = None, compute = False, use_dask = True, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-False-True-True-False] _________ 1938s 1938s self = 1938s consolidated = False, compute = True, use_dask = True, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-True] _________ 1938s 1938s self = 1938s consolidated = True, compute = True, use_dask = True, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-False-True-True-None] _________ 1938s 1938s self = 1938s consolidated = None, compute = True, use_dask = True, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-False] ________ 1938s 1938s self = 1938s consolidated = False, compute = False, use_dask = False, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-True] _________ 1938s 1938s self = 1938s consolidated = True, compute = False, use_dask = False, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-True-False-False-None] _________ 1938s 1938s self = 1938s consolidated = None, compute = False, use_dask = False, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-True-False-True-False] _________ 1938s 1938s self = 1938s consolidated = False, compute = True, use_dask = False, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-True] _________ 1938s 1938s self = 1938s consolidated = True, compute = True, use_dask = False, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-True-False-True-None] _________ 1938s 1938s self = 1938s consolidated = None, compute = True, use_dask = False, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-True-True-False-False] _________ 1938s 1938s self = 1938s consolidated = False, compute = False, use_dask = True, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-True] _________ 1938s 1938s self = 1938s consolidated = True, compute = False, use_dask = True, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-True-True-False-None] _________ 1938s 1938s self = 1938s consolidated = None, compute = False, use_dask = True, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-False] _________ 1938s 1938s self = 1938s consolidated = False, compute = True, use_dask = True, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-True] __________ 1938s 1938s self = 1938s consolidated = True, compute = True, use_dask = True, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-True-True-True-None] __________ 1938s 1938s self = 1938s consolidated = None, compute = True, use_dask = True, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-False] ________ 1938s 1938s self = 1938s consolidated = False, compute = False, use_dask = False, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-True] _________ 1938s 1938s self = 1938s consolidated = True, compute = False, use_dask = False, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-None-False-False-None] _________ 1938s 1938s self = 1938s consolidated = None, compute = False, use_dask = False, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-None-False-True-False] _________ 1938s 1938s self = 1938s consolidated = False, compute = True, use_dask = False, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-True] _________ 1938s 1938s self = 1938s consolidated = True, compute = True, use_dask = False, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-None-False-True-None] _________ 1938s 1938s self = 1938s consolidated = None, compute = True, use_dask = False, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_region[3-None-True-False-False] _________ 1938s 1938s self = 1938s consolidated = False, compute = False, use_dask = True, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-True] _________ 1938s 1938s self = 1938s consolidated = True, compute = False, use_dask = True, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-None-True-False-None] _________ 1938s 1938s self = 1938s consolidated = None, compute = False, use_dask = True, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s assert_identical(actual, zeros) 1938s for i in range(0, 10, 2): 1938s region = {"x": slice(i, i + 2)} 1938s > nonzeros.isel(region).to_zarr( 1938s store, 1938s region=region, 1938s consolidated=consolidated, 1938s write_empty_chunks=write_empty, 1938s **self.version_kwargs, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3046: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-False] _________ 1938s 1938s self = 1938s consolidated = False, compute = True, use_dask = True, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-True] __________ 1938s 1938s self = 1938s consolidated = True, compute = True, use_dask = True, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrWriteEmpty.test_write_region[3-None-True-True-None] __________ 1938s 1938s self = 1938s consolidated = None, compute = True, use_dask = True, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [False, True, None]) 1938s @pytest.mark.parametrize("compute", [False, True]) 1938s @pytest.mark.parametrize("use_dask", [False, True]) 1938s @pytest.mark.parametrize("write_empty", [False, True, None]) 1938s def test_write_region(self, consolidated, compute, use_dask, write_empty) -> None: 1938s if (use_dask or not compute) and not has_dask: 1938s pytest.skip("requires dask") 1938s 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s 1938s if use_dask: 1938s zeros = zeros.chunk(2) 1938s nonzeros = nonzeros.chunk(2) 1938s 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr( 1938s store, 1938s consolidated=consolidated, 1938s compute=compute, 1938s encoding={"u": dict(chunks=2)}, 1938s **self.version_kwargs, 1938s ) 1938s if compute: 1938s > with xr.open_zarr( 1938s store, consolidated=consolidated, **self.version_kwargs 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3040: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________ TestZarrWriteEmpty.test_write_region_mode[3-None] _______________ 1938s 1938s self = 1938s mode = None 1938s 1938s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1938s def test_write_region_mode(self, mode) -> None: 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr(store, **self.version_kwargs) 1938s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1938s > nonzeros.isel(region).to_zarr( 1938s store, region=region, mode=mode, **self.version_kwargs 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______________ TestZarrWriteEmpty.test_write_region_mode[3-r+] ________________ 1938s 1938s self = 1938s mode = 'r+' 1938s 1938s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1938s def test_write_region_mode(self, mode) -> None: 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr(store, **self.version_kwargs) 1938s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1938s > nonzeros.isel(region).to_zarr( 1938s store, region=region, mode=mode, **self.version_kwargs 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________ TestZarrWriteEmpty.test_write_region_mode[3-a] ________________ 1938s 1938s self = 1938s mode = 'a' 1938s 1938s @pytest.mark.parametrize("mode", [None, "r+", "a"]) 1938s def test_write_region_mode(self, mode) -> None: 1938s zeros = Dataset({"u": (("x",), np.zeros(10))}) 1938s nonzeros = Dataset({"u": (("x",), np.arange(1, 11))}) 1938s with self.create_zarr_target() as store: 1938s zeros.to_zarr(store, **self.version_kwargs) 1938s for region in [{"x": slice(5)}, {"x": slice(5, 10)}]: 1938s > nonzeros.isel(region).to_zarr( 1938s store, region=region, mode=mode, **self.version_kwargs 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3065: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________ TestZarrWriteEmpty.test_write_preexisting_override_metadata[3] ________ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_write_preexisting_override_metadata(self) -> None: 1938s """Metadata should be overridden if mode="a" but not in mode="r+".""" 1938s original = Dataset( 1938s {"u": (("x",), np.zeros(10), {"variable": "original"})}, 1938s attrs={"global": "original"}, 1938s ) 1938s both_modified = Dataset( 1938s {"u": (("x",), np.ones(10), {"variable": "modified"})}, 1938s attrs={"global": "modified"}, 1938s ) 1938s global_modified = Dataset( 1938s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1938s attrs={"global": "modified"}, 1938s ) 1938s only_new_data = Dataset( 1938s {"u": (("x",), np.ones(10), {"variable": "original"})}, 1938s attrs={"global": "original"}, 1938s ) 1938s 1938s with self.create_zarr_target() as store: 1938s original.to_zarr(store, compute=False, **self.version_kwargs) 1938s > both_modified.to_zarr(store, mode="a", **self.version_kwargs) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3093: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'u' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________ TestZarrWriteEmpty.test_encoding_chunksizes[3] ________________ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_encoding_chunksizes(self) -> None: 1938s # regression test for GH2278 1938s # see also test_encoding_chunksizes_unlimited 1938s nx, ny, nt = 4, 4, 5 1938s original = xr.Dataset( 1938s {}, 1938s coords={ 1938s "x": np.arange(nx), 1938s "y": np.arange(ny), 1938s "t": np.arange(nt), 1938s }, 1938s ) 1938s original["v"] = xr.Variable(("x", "y", "t"), np.zeros((nx, ny, nt))) 1938s original = original.chunk({"t": 1, "x": 2, "y": 2}) 1938s 1938s > with self.roundtrip(original) as ds1: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3207: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'v' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______ TestZarrWriteEmpty.test_chunk_encoding_with_partial_dask_chunks[3] ______ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_chunk_encoding_with_partial_dask_chunks(self) -> None: 1938s original = xr.Dataset( 1938s {"x": xr.DataArray(np.random.random(size=(6, 8)), dims=("a", "b"))} 1938s ).chunk({"a": 3}) 1938s 1938s > with self.roundtrip( 1938s original, save_kwargs={"encoding": {"x": {"chunks": [3, 2]}}} 1938s ) as ds1: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3218: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'x' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______________ TestZarrWriteEmpty.test_open_zarr_use_cftime[3] ________________ 1938s 1938s self = 1938s 1938s @requires_cftime 1938s def test_open_zarr_use_cftime(self) -> None: 1938s ds = create_test_data() 1938s with self.create_zarr_target() as store_target: 1938s ds.to_zarr(store_target, **self.version_kwargs) 1938s > ds_a = xr.open_zarr(store_target, **self.version_kwargs) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3237: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________ TestZarrWriteEmpty.test_write_read_select_write[3] ______________ 1938s 1938s self = 1938s 1938s def test_write_read_select_write(self) -> None: 1938s # Test for https://github.com/pydata/xarray/issues/4084 1938s ds = create_test_data() 1938s 1938s # NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug. 1938s with self.create_zarr_target() as initial_store: 1938s ds.to_zarr(initial_store, mode="w", **self.version_kwargs) 1938s > ds1 = xr.open_zarr(initial_store, **self.version_kwargs) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3252: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s __________________ TestZarrWriteEmpty.test_attributes[3-obj1] __________________ 1938s 1938s self = 1938s obj = Size: 8B 1938s array(nan) 1938s Attributes: 1938s good: {'key': 'value'} 1938s 1938s @pytest.mark.parametrize("obj", [Dataset(), DataArray(name="foo")]) 1938s def test_attributes(self, obj) -> None: 1938s obj = obj.copy() 1938s 1938s obj.attrs["good"] = {"key": "value"} 1938s ds = obj if isinstance(obj, Dataset) else obj.to_dataset() 1938s with self.create_zarr_target() as store_target: 1938s ds.to_zarr(store_target, **self.version_kwargs) 1938s > assert_identical(ds, xr.open_zarr(store_target, **self.version_kwargs)) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3267: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1938s ds = open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'foo' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] __ 1938s 1938s self = 1938s dtype = 'datetime64[ns]' 1938s 1938s @requires_dask 1938s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1938s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1938s # Generalized from @malmans2's test in PR #8253 1938s original = create_test_data().astype(dtype).chunk(1) 1938s > with self.roundtrip( 1938s original, 1938s open_kwargs={ 1938s "chunks": {}, 1938s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1938s }, 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _ TestZarrWriteEmpty.test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] _ 1938s 1938s self = 1938s dtype = 'timedelta64[ns]' 1938s 1938s @requires_dask 1938s @pytest.mark.parametrize("dtype", ["datetime64[ns]", "timedelta64[ns]"]) 1938s def test_chunked_datetime64_or_timedelta64(self, dtype) -> None: 1938s # Generalized from @malmans2's test in PR #8253 1938s original = create_test_data().astype(dtype).chunk(1) 1938s > with self.roundtrip( 1938s original, 1938s open_kwargs={ 1938s "chunks": {}, 1938s "decode_timedelta": CFTimedeltaCoder(time_unit="ns"), 1938s }, 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3280: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'dim2' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___________ TestZarrWriteEmpty.test_zarr_fill_value_setting[3-float] ___________ 1938s 1938s self = 1938s dtype = 1938s 1938s @requires_dask 1938s @pytest.mark.parametrize("dtype", [int, float]) 1938s def test_zarr_fill_value_setting(self, dtype): 1938s # When zarr_format=2, _FillValue sets fill_value 1938s # When zarr_format=3, fill_value is set independently 1938s # We test this by writing a dask array with compute=False, 1938s # on read we should receive chunks filled with `fill_value` 1938s fv = -1 1938s ds = xr.Dataset( 1938s {"foo": ("x", dask.array.from_array(np.array([0, 0, 0], dtype=dtype)))} 1938s ) 1938s expected = xr.Dataset({"foo": ("x", [fv] * 3)}) 1938s 1938s zarr_format_2 = ( 1938s has_zarr_v3 and zarr.config.get("default_zarr_format") == 2 1938s ) or not has_zarr_v3 1938s if zarr_format_2: 1938s attr = "_FillValue" 1938s expected.foo.attrs[attr] = fv 1938s else: 1938s attr = "fill_value" 1938s if dtype is float: 1938s # for floats, Xarray inserts a default `np.nan` 1938s expected.foo.attrs["_FillValue"] = np.nan 1938s 1938s # turn off all decoding so we see what Zarr returns to us. 1938s # Since chunks, are not written, we should receive on `fill_value` 1938s open_kwargs = { 1938s "mask_and_scale": False, 1938s "consolidated": False, 1938s "use_zarr_fill_value_as_mask": False, 1938s } 1938s save_kwargs = dict(compute=False, consolidated=False) 1938s > with self.roundtrip( 1938s ds, 1938s save_kwargs=ChainMap(save_kwargs, dict(encoding={"foo": {attr: fv}})), 1938s open_kwargs=open_kwargs, 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3374: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2315: in roundtrip 1938s with self.open(store_target, **open_kwargs) as ds: 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:2300: in open 1938s with xr.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'foo' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______________ TestZarrWriteEmpty.test_write_empty[3-True-True] _______________ 1938s 1938s self = 1938s consolidated = True, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [True, False, None]) 1938s @pytest.mark.parametrize("write_empty", [True, False, None]) 1938s def test_write_empty( 1938s self, 1938s consolidated: bool | None, 1938s write_empty: bool | None, 1938s ) -> None: 1938s def assert_expected_files(expected: list[str], store: str) -> None: 1938s """Convenience for comparing with actual files written""" 1938s ls = [] 1938s test_root = os.path.join(store, "test") 1938s for root, _, files in os.walk(test_root): 1938s ls.extend( 1938s [ 1938s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1938s for f in files 1938s ] 1938s ) 1938s 1938s assert set(expected) == set( 1938s [ 1938s file.lstrip("c/") 1938s for file in ls 1938s if (file not in (".zattrs", ".zarray", "zarr.json")) 1938s ] 1938s ) 1938s 1938s # The zarr format is set by the `default_zarr_format` 1938s # pytest fixture that acts on a superclass 1938s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1938s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1938s expected = ["0.1.0"] 1938s else: 1938s expected = [ 1938s "0.0.0", 1938s "0.0.1", 1938s "0.1.0", 1938s "0.1.1", 1938s ] 1938s 1938s if zarr_format_3: 1938s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1938s # transform to the path style of zarr 3 1938s # e.g. 0/0/1 1938s expected = [e.replace(".", "/") for e in expected] 1938s else: 1938s # use nan for default fill_value behaviour 1938s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1938s 1938s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1938s 1938s if has_dask: 1938s ds["test"] = ds["test"].chunk(1) 1938s encoding = None 1938s else: 1938s encoding = {"test": {"chunks": (1, 1, 1)}} 1938s 1938s with self.temp_dir() as (d, store): 1938s ds.to_zarr( 1938s store, 1938s mode="w", 1938s encoding=encoding, 1938s write_empty_chunks=write_empty, 1938s ) 1938s 1938s # check expected files after a write 1938s assert_expected_files(expected, store) 1938s 1938s > with self.roundtrip_dir( 1938s ds, 1938s store, 1938s save_kwargs={ 1938s "mode": "a", 1938s "append_dim": "Z", 1938s "write_empty_chunks": write_empty, 1938s }, 1938s ) as a_ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1938s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________ TestZarrWriteEmpty.test_write_empty[3-True-False] _______________ 1938s 1938s self = 1938s consolidated = False, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [True, False, None]) 1938s @pytest.mark.parametrize("write_empty", [True, False, None]) 1938s def test_write_empty( 1938s self, 1938s consolidated: bool | None, 1938s write_empty: bool | None, 1938s ) -> None: 1938s def assert_expected_files(expected: list[str], store: str) -> None: 1938s """Convenience for comparing with actual files written""" 1938s ls = [] 1938s test_root = os.path.join(store, "test") 1938s for root, _, files in os.walk(test_root): 1938s ls.extend( 1938s [ 1938s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1938s for f in files 1938s ] 1938s ) 1938s 1938s assert set(expected) == set( 1938s [ 1938s file.lstrip("c/") 1938s for file in ls 1938s if (file not in (".zattrs", ".zarray", "zarr.json")) 1938s ] 1938s ) 1938s 1938s # The zarr format is set by the `default_zarr_format` 1938s # pytest fixture that acts on a superclass 1938s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1938s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1938s expected = ["0.1.0"] 1938s else: 1938s expected = [ 1938s "0.0.0", 1938s "0.0.1", 1938s "0.1.0", 1938s "0.1.1", 1938s ] 1938s 1938s if zarr_format_3: 1938s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1938s # transform to the path style of zarr 3 1938s # e.g. 0/0/1 1938s expected = [e.replace(".", "/") for e in expected] 1938s else: 1938s # use nan for default fill_value behaviour 1938s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1938s 1938s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1938s 1938s if has_dask: 1938s ds["test"] = ds["test"].chunk(1) 1938s encoding = None 1938s else: 1938s encoding = {"test": {"chunks": (1, 1, 1)}} 1938s 1938s with self.temp_dir() as (d, store): 1938s ds.to_zarr( 1938s store, 1938s mode="w", 1938s encoding=encoding, 1938s write_empty_chunks=write_empty, 1938s ) 1938s 1938s # check expected files after a write 1938s assert_expected_files(expected, store) 1938s 1938s > with self.roundtrip_dir( 1938s ds, 1938s store, 1938s save_kwargs={ 1938s "mode": "a", 1938s "append_dim": "Z", 1938s "write_empty_chunks": write_empty, 1938s }, 1938s ) as a_ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1938s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______________ TestZarrWriteEmpty.test_write_empty[3-True-None] _______________ 1938s 1938s self = 1938s consolidated = None, write_empty = True 1938s 1938s @pytest.mark.parametrize("consolidated", [True, False, None]) 1938s @pytest.mark.parametrize("write_empty", [True, False, None]) 1938s def test_write_empty( 1938s self, 1938s consolidated: bool | None, 1938s write_empty: bool | None, 1938s ) -> None: 1938s def assert_expected_files(expected: list[str], store: str) -> None: 1938s """Convenience for comparing with actual files written""" 1938s ls = [] 1938s test_root = os.path.join(store, "test") 1938s for root, _, files in os.walk(test_root): 1938s ls.extend( 1938s [ 1938s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1938s for f in files 1938s ] 1938s ) 1938s 1938s assert set(expected) == set( 1938s [ 1938s file.lstrip("c/") 1938s for file in ls 1938s if (file not in (".zattrs", ".zarray", "zarr.json")) 1938s ] 1938s ) 1938s 1938s # The zarr format is set by the `default_zarr_format` 1938s # pytest fixture that acts on a superclass 1938s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1938s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1938s expected = ["0.1.0"] 1938s else: 1938s expected = [ 1938s "0.0.0", 1938s "0.0.1", 1938s "0.1.0", 1938s "0.1.1", 1938s ] 1938s 1938s if zarr_format_3: 1938s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1938s # transform to the path style of zarr 3 1938s # e.g. 0/0/1 1938s expected = [e.replace(".", "/") for e in expected] 1938s else: 1938s # use nan for default fill_value behaviour 1938s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1938s 1938s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1938s 1938s if has_dask: 1938s ds["test"] = ds["test"].chunk(1) 1938s encoding = None 1938s else: 1938s encoding = {"test": {"chunks": (1, 1, 1)}} 1938s 1938s with self.temp_dir() as (d, store): 1938s ds.to_zarr( 1938s store, 1938s mode="w", 1938s encoding=encoding, 1938s write_empty_chunks=write_empty, 1938s ) 1938s 1938s # check expected files after a write 1938s assert_expected_files(expected, store) 1938s 1938s > with self.roundtrip_dir( 1938s ds, 1938s store, 1938s save_kwargs={ 1938s "mode": "a", 1938s "append_dim": "Z", 1938s "write_empty_chunks": write_empty, 1938s }, 1938s ) as a_ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1938s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________ TestZarrWriteEmpty.test_write_empty[3-False-True] _______________ 1938s 1938s self = 1938s consolidated = True, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [True, False, None]) 1938s @pytest.mark.parametrize("write_empty", [True, False, None]) 1938s def test_write_empty( 1938s self, 1938s consolidated: bool | None, 1938s write_empty: bool | None, 1938s ) -> None: 1938s def assert_expected_files(expected: list[str], store: str) -> None: 1938s """Convenience for comparing with actual files written""" 1938s ls = [] 1938s test_root = os.path.join(store, "test") 1938s for root, _, files in os.walk(test_root): 1938s ls.extend( 1938s [ 1938s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1938s for f in files 1938s ] 1938s ) 1938s 1938s assert set(expected) == set( 1938s [ 1938s file.lstrip("c/") 1938s for file in ls 1938s if (file not in (".zattrs", ".zarray", "zarr.json")) 1938s ] 1938s ) 1938s 1938s # The zarr format is set by the `default_zarr_format` 1938s # pytest fixture that acts on a superclass 1938s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1938s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1938s expected = ["0.1.0"] 1938s else: 1938s expected = [ 1938s "0.0.0", 1938s "0.0.1", 1938s "0.1.0", 1938s "0.1.1", 1938s ] 1938s 1938s if zarr_format_3: 1938s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1938s # transform to the path style of zarr 3 1938s # e.g. 0/0/1 1938s expected = [e.replace(".", "/") for e in expected] 1938s else: 1938s # use nan for default fill_value behaviour 1938s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1938s 1938s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1938s 1938s if has_dask: 1938s ds["test"] = ds["test"].chunk(1) 1938s encoding = None 1938s else: 1938s encoding = {"test": {"chunks": (1, 1, 1)}} 1938s 1938s with self.temp_dir() as (d, store): 1938s ds.to_zarr( 1938s store, 1938s mode="w", 1938s encoding=encoding, 1938s write_empty_chunks=write_empty, 1938s ) 1938s 1938s # check expected files after a write 1938s assert_expected_files(expected, store) 1938s 1938s > with self.roundtrip_dir( 1938s ds, 1938s store, 1938s save_kwargs={ 1938s "mode": "a", 1938s "append_dim": "Z", 1938s "write_empty_chunks": write_empty, 1938s }, 1938s ) as a_ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1938s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________ TestZarrWriteEmpty.test_write_empty[3-False-False] ______________ 1938s 1938s self = 1938s consolidated = False, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [True, False, None]) 1938s @pytest.mark.parametrize("write_empty", [True, False, None]) 1938s def test_write_empty( 1938s self, 1938s consolidated: bool | None, 1938s write_empty: bool | None, 1938s ) -> None: 1938s def assert_expected_files(expected: list[str], store: str) -> None: 1938s """Convenience for comparing with actual files written""" 1938s ls = [] 1938s test_root = os.path.join(store, "test") 1938s for root, _, files in os.walk(test_root): 1938s ls.extend( 1938s [ 1938s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1938s for f in files 1938s ] 1938s ) 1938s 1938s assert set(expected) == set( 1938s [ 1938s file.lstrip("c/") 1938s for file in ls 1938s if (file not in (".zattrs", ".zarray", "zarr.json")) 1938s ] 1938s ) 1938s 1938s # The zarr format is set by the `default_zarr_format` 1938s # pytest fixture that acts on a superclass 1938s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1938s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1938s expected = ["0.1.0"] 1938s else: 1938s expected = [ 1938s "0.0.0", 1938s "0.0.1", 1938s "0.1.0", 1938s "0.1.1", 1938s ] 1938s 1938s if zarr_format_3: 1938s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1938s # transform to the path style of zarr 3 1938s # e.g. 0/0/1 1938s expected = [e.replace(".", "/") for e in expected] 1938s else: 1938s # use nan for default fill_value behaviour 1938s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1938s 1938s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1938s 1938s if has_dask: 1938s ds["test"] = ds["test"].chunk(1) 1938s encoding = None 1938s else: 1938s encoding = {"test": {"chunks": (1, 1, 1)}} 1938s 1938s with self.temp_dir() as (d, store): 1938s ds.to_zarr( 1938s store, 1938s mode="w", 1938s encoding=encoding, 1938s write_empty_chunks=write_empty, 1938s ) 1938s 1938s # check expected files after a write 1938s assert_expected_files(expected, store) 1938s 1938s > with self.roundtrip_dir( 1938s ds, 1938s store, 1938s save_kwargs={ 1938s "mode": "a", 1938s "append_dim": "Z", 1938s "write_empty_chunks": write_empty, 1938s }, 1938s ) as a_ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1938s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________ TestZarrWriteEmpty.test_write_empty[3-False-None] _______________ 1938s 1938s self = 1938s consolidated = None, write_empty = False 1938s 1938s @pytest.mark.parametrize("consolidated", [True, False, None]) 1938s @pytest.mark.parametrize("write_empty", [True, False, None]) 1938s def test_write_empty( 1938s self, 1938s consolidated: bool | None, 1938s write_empty: bool | None, 1938s ) -> None: 1938s def assert_expected_files(expected: list[str], store: str) -> None: 1938s """Convenience for comparing with actual files written""" 1938s ls = [] 1938s test_root = os.path.join(store, "test") 1938s for root, _, files in os.walk(test_root): 1938s ls.extend( 1938s [ 1938s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1938s for f in files 1938s ] 1938s ) 1938s 1938s assert set(expected) == set( 1938s [ 1938s file.lstrip("c/") 1938s for file in ls 1938s if (file not in (".zattrs", ".zarray", "zarr.json")) 1938s ] 1938s ) 1938s 1938s # The zarr format is set by the `default_zarr_format` 1938s # pytest fixture that acts on a superclass 1938s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1938s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1938s expected = ["0.1.0"] 1938s else: 1938s expected = [ 1938s "0.0.0", 1938s "0.0.1", 1938s "0.1.0", 1938s "0.1.1", 1938s ] 1938s 1938s if zarr_format_3: 1938s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1938s # transform to the path style of zarr 3 1938s # e.g. 0/0/1 1938s expected = [e.replace(".", "/") for e in expected] 1938s else: 1938s # use nan for default fill_value behaviour 1938s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1938s 1938s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1938s 1938s if has_dask: 1938s ds["test"] = ds["test"].chunk(1) 1938s encoding = None 1938s else: 1938s encoding = {"test": {"chunks": (1, 1, 1)}} 1938s 1938s with self.temp_dir() as (d, store): 1938s ds.to_zarr( 1938s store, 1938s mode="w", 1938s encoding=encoding, 1938s write_empty_chunks=write_empty, 1938s ) 1938s 1938s # check expected files after a write 1938s assert_expected_files(expected, store) 1938s 1938s > with self.roundtrip_dir( 1938s ds, 1938s store, 1938s save_kwargs={ 1938s "mode": "a", 1938s "append_dim": "Z", 1938s "write_empty_chunks": write_empty, 1938s }, 1938s ) as a_ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1938s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______________ TestZarrWriteEmpty.test_write_empty[3-None-True] _______________ 1938s 1938s self = 1938s consolidated = True, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [True, False, None]) 1938s @pytest.mark.parametrize("write_empty", [True, False, None]) 1938s def test_write_empty( 1938s self, 1938s consolidated: bool | None, 1938s write_empty: bool | None, 1938s ) -> None: 1938s def assert_expected_files(expected: list[str], store: str) -> None: 1938s """Convenience for comparing with actual files written""" 1938s ls = [] 1938s test_root = os.path.join(store, "test") 1938s for root, _, files in os.walk(test_root): 1938s ls.extend( 1938s [ 1938s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1938s for f in files 1938s ] 1938s ) 1938s 1938s assert set(expected) == set( 1938s [ 1938s file.lstrip("c/") 1938s for file in ls 1938s if (file not in (".zattrs", ".zarray", "zarr.json")) 1938s ] 1938s ) 1938s 1938s # The zarr format is set by the `default_zarr_format` 1938s # pytest fixture that acts on a superclass 1938s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1938s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1938s expected = ["0.1.0"] 1938s else: 1938s expected = [ 1938s "0.0.0", 1938s "0.0.1", 1938s "0.1.0", 1938s "0.1.1", 1938s ] 1938s 1938s if zarr_format_3: 1938s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1938s # transform to the path style of zarr 3 1938s # e.g. 0/0/1 1938s expected = [e.replace(".", "/") for e in expected] 1938s else: 1938s # use nan for default fill_value behaviour 1938s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1938s 1938s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1938s 1938s if has_dask: 1938s ds["test"] = ds["test"].chunk(1) 1938s encoding = None 1938s else: 1938s encoding = {"test": {"chunks": (1, 1, 1)}} 1938s 1938s with self.temp_dir() as (d, store): 1938s ds.to_zarr( 1938s store, 1938s mode="w", 1938s encoding=encoding, 1938s write_empty_chunks=write_empty, 1938s ) 1938s 1938s # check expected files after a write 1938s assert_expected_files(expected, store) 1938s 1938s > with self.roundtrip_dir( 1938s ds, 1938s store, 1938s save_kwargs={ 1938s "mode": "a", 1938s "append_dim": "Z", 1938s "write_empty_chunks": write_empty, 1938s }, 1938s ) as a_ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1938s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________ TestZarrWriteEmpty.test_write_empty[3-None-False] _______________ 1938s 1938s self = 1938s consolidated = False, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [True, False, None]) 1938s @pytest.mark.parametrize("write_empty", [True, False, None]) 1938s def test_write_empty( 1938s self, 1938s consolidated: bool | None, 1938s write_empty: bool | None, 1938s ) -> None: 1938s def assert_expected_files(expected: list[str], store: str) -> None: 1938s """Convenience for comparing with actual files written""" 1938s ls = [] 1938s test_root = os.path.join(store, "test") 1938s for root, _, files in os.walk(test_root): 1938s ls.extend( 1938s [ 1938s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1938s for f in files 1938s ] 1938s ) 1938s 1938s assert set(expected) == set( 1938s [ 1938s file.lstrip("c/") 1938s for file in ls 1938s if (file not in (".zattrs", ".zarray", "zarr.json")) 1938s ] 1938s ) 1938s 1938s # The zarr format is set by the `default_zarr_format` 1938s # pytest fixture that acts on a superclass 1938s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1938s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1938s expected = ["0.1.0"] 1938s else: 1938s expected = [ 1938s "0.0.0", 1938s "0.0.1", 1938s "0.1.0", 1938s "0.1.1", 1938s ] 1938s 1938s if zarr_format_3: 1938s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1938s # transform to the path style of zarr 3 1938s # e.g. 0/0/1 1938s expected = [e.replace(".", "/") for e in expected] 1938s else: 1938s # use nan for default fill_value behaviour 1938s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1938s 1938s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1938s 1938s if has_dask: 1938s ds["test"] = ds["test"].chunk(1) 1938s encoding = None 1938s else: 1938s encoding = {"test": {"chunks": (1, 1, 1)}} 1938s 1938s with self.temp_dir() as (d, store): 1938s ds.to_zarr( 1938s store, 1938s mode="w", 1938s encoding=encoding, 1938s write_empty_chunks=write_empty, 1938s ) 1938s 1938s # check expected files after a write 1938s assert_expected_files(expected, store) 1938s 1938s > with self.roundtrip_dir( 1938s ds, 1938s store, 1938s save_kwargs={ 1938s "mode": "a", 1938s "append_dim": "Z", 1938s "write_empty_chunks": write_empty, 1938s }, 1938s ) as a_ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1938s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______________ TestZarrWriteEmpty.test_write_empty[3-None-None] _______________ 1938s 1938s self = 1938s consolidated = None, write_empty = None 1938s 1938s @pytest.mark.parametrize("consolidated", [True, False, None]) 1938s @pytest.mark.parametrize("write_empty", [True, False, None]) 1938s def test_write_empty( 1938s self, 1938s consolidated: bool | None, 1938s write_empty: bool | None, 1938s ) -> None: 1938s def assert_expected_files(expected: list[str], store: str) -> None: 1938s """Convenience for comparing with actual files written""" 1938s ls = [] 1938s test_root = os.path.join(store, "test") 1938s for root, _, files in os.walk(test_root): 1938s ls.extend( 1938s [ 1938s os.path.join(root, f).removeprefix(test_root).lstrip("/") 1938s for f in files 1938s ] 1938s ) 1938s 1938s assert set(expected) == set( 1938s [ 1938s file.lstrip("c/") 1938s for file in ls 1938s if (file not in (".zattrs", ".zarray", "zarr.json")) 1938s ] 1938s ) 1938s 1938s # The zarr format is set by the `default_zarr_format` 1938s # pytest fixture that acts on a superclass 1938s zarr_format_3 = has_zarr_v3 and zarr.config.config["default_zarr_format"] == 3 1938s if (write_empty is False) or (write_empty is None and has_zarr_v3): 1938s expected = ["0.1.0"] 1938s else: 1938s expected = [ 1938s "0.0.0", 1938s "0.0.1", 1938s "0.1.0", 1938s "0.1.1", 1938s ] 1938s 1938s if zarr_format_3: 1938s data = np.array([0.0, 0, 1.0, 0]).reshape((1, 2, 2)) 1938s # transform to the path style of zarr 3 1938s # e.g. 0/0/1 1938s expected = [e.replace(".", "/") for e in expected] 1938s else: 1938s # use nan for default fill_value behaviour 1938s data = np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)) 1938s 1938s ds = xr.Dataset(data_vars={"test": (("Z", "Y", "X"), data)}) 1938s 1938s if has_dask: 1938s ds["test"] = ds["test"].chunk(1) 1938s encoding = None 1938s else: 1938s encoding = {"test": {"chunks": (1, 1, 1)}} 1938s 1938s with self.temp_dir() as (d, store): 1938s ds.to_zarr( 1938s store, 1938s mode="w", 1938s encoding=encoding, 1938s write_empty_chunks=write_empty, 1938s ) 1938s 1938s # check expected files after a write 1938s assert_expected_files(expected, store) 1938s 1938s > with self.roundtrip_dir( 1938s ds, 1938s store, 1938s save_kwargs={ 1938s "mode": "a", 1938s "append_dim": "Z", 1938s "write_empty_chunks": write_empty, 1938s }, 1938s ) as a_ds: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3761: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3.13/contextlib.py:141: in __enter__ 1938s return next(self.gen) 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:3687: in roundtrip_dir 1938s data.to_zarr(store, **save_kwargs, **self.version_kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-full-auto] _____________ 1938s 1938s self = 1938s region = 'auto' 1938s 1938s @pytest.mark.parametrize( 1938s "region", 1938s [ 1938s pytest.param("auto", id="full-auto"), 1938s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 1938s ], 1938s ) 1938s def test_zarr_region_auto(self, region): 1938s with self.create() as (target, ds): 1938s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 1938s > self.save(target, ds_region, region=region) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1938s ds.to_zarr(target, **kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ____________ TestZarrRegionAuto.test_zarr_region_auto[3-mixed-auto] ____________ 1938s 1938s self = 1938s region = {'x': slice(np.int64(2), np.int64(4), None), 'y': slice(6, 8, None)} 1938s 1938s @pytest.mark.parametrize( 1938s "region", 1938s [ 1938s pytest.param("auto", id="full-auto"), 1938s pytest.param({"x": "auto", "y": slice(6, 8)}, id="mixed-auto"), 1938s ], 1938s ) 1938s def test_zarr_region_auto(self, region): 1938s with self.create() as (target, ds): 1938s ds_region = 1 + ds.isel(x=slice(2, 4), y=slice(6, 8)) 1938s > self.save(target, ds_region, region=region) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6306: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1938s ds.to_zarr(target, **kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________ TestZarrRegionAuto.test_zarr_region_index_write[3] ______________ 1938s 1938s self = 1938s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_zarr_region_index_write_30') 1938s 1938s def test_zarr_region_index_write(self, tmp_path): 1938s region: Mapping[str, slice] | Literal["auto"] 1938s region_slice = dict(x=slice(2, 4), y=slice(6, 8)) 1938s 1938s with self.create() as (target, ds): 1938s ds_region = 1 + ds.isel(region_slice) 1938s for region in [region_slice, "auto"]: # type: ignore[assignment] 1938s with patch.object( 1938s ZarrStore, 1938s "set_variables", 1938s side_effect=ZarrStore.set_variables, 1938s autospec=True, 1938s ) as mock: 1938s > self.save(target, ds_region, region=region, mode="r+") 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6336: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1938s ds.to_zarr(target, **kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ____________________ TestZarrRegionAuto.test_zarr_region[3] ____________________ 1938s 1938s self = 1938s 1938s def test_zarr_region(self): 1938s with self.create() as (target, ds): 1938s ds_transposed = ds.transpose("y", "x") 1938s ds_region = 1 + ds_transposed.isel(x=[0], y=[0]) 1938s > self.save(target, ds_region, region={"x": slice(0, 1), "y": slice(0, 1)}) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6369: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1938s ds.to_zarr(target, **kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _____________ TestZarrRegionAuto.test_zarr_append_chunk_partial[3] _____________ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_zarr_append_chunk_partial(self): 1938s t_coords = np.array([np.datetime64("2020-01-01").astype("datetime64[ns]")]) 1938s data = np.ones((10, 10)) 1938s 1938s da = xr.DataArray( 1938s data.reshape((-1, 10, 10)), 1938s dims=["time", "x", "y"], 1938s coords={"time": t_coords}, 1938s name="foo", 1938s ) 1938s new_time = np.array([np.datetime64("2021-01-01").astype("datetime64[ns]")]) 1938s da2 = xr.DataArray( 1938s data.reshape((-1, 10, 10)), 1938s dims=["time", "x", "y"], 1938s coords={"time": new_time}, 1938s name="foo", 1938s ) 1938s 1938s with self.create_zarr_target() as target: 1938s self.save(target, da, mode="w", encoding={"foo": {"chunks": (5, 5, 1)}}) 1938s 1938s with pytest.raises(ValueError, match="encoding was provided"): 1938s self.save( 1938s target, 1938s da2, 1938s append_dim="time", 1938s mode="a", 1938s encoding={"foo": {"chunks": (1, 1, 1)}}, 1938s ) 1938s 1938s # chunking with dask sidesteps the encoding check, so we need a different check 1938s with pytest.raises(ValueError, match="Specified zarr chunks"): 1938s > self.save( 1938s target, 1938s da2.chunk({"x": 1, "y": 1, "time": 1}), 1938s append_dim="time", 1938s mode="a", 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6426: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1938s ds.to_zarr(target, **kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'foo' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _________ TestZarrRegionAuto.test_zarr_region_chunk_partial_offset[3] __________ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_zarr_region_chunk_partial_offset(self): 1938s # https://github.com/pydata/xarray/pull/8459#issuecomment-1819417545 1938s with self.create_zarr_target() as store: 1938s data = np.ones((30,)) 1938s da = xr.DataArray( 1938s data, dims=["x"], coords={"x": range(30)}, name="foo" 1938s ).chunk(x=10) 1938s self.save(store, da, compute=False) 1938s 1938s > self.save(store, da.isel(x=slice(10)).chunk(x=(10,)), region="auto") 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6443: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1938s ds.to_zarr(target, **kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'foo' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ____________ TestZarrRegionAuto.test_zarr_safe_chunk_append_dim[3] _____________ 1938s 1938s self = 1938s 1938s @requires_dask 1938s def test_zarr_safe_chunk_append_dim(self): 1938s with self.create_zarr_target() as store: 1938s data = np.ones((20,)) 1938s da = xr.DataArray( 1938s data, dims=["x"], coords={"x": range(20)}, name="foo" 1938s ).chunk(x=5) 1938s 1938s self.save(store, da.isel(x=slice(0, 7)), safe_chunks=True, mode="w") 1938s with pytest.raises(ValueError): 1938s # If the first chunk is smaller than the border size then raise an error 1938s > self.save( 1938s store, 1938s da.isel(x=slice(7, 11)).chunk(x=(2, 2)), 1938s append_dim="x", 1938s safe_chunks=True, 1938s ) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6468: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1938s ds.to_zarr(target, **kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataarray.py:4466: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'foo' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-r+] _____________ 1938s 1938s self = 1938s mode = 'r+' 1938s 1938s @requires_dask 1938s @pytest.mark.parametrize("mode", ["r+", "a"]) 1938s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 1938s with self.create_zarr_target() as store: 1938s arr = xr.DataArray( 1938s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 1938s ).chunk(a=3) 1938s self.save(store, arr, mode="w") 1938s 1938s with pytest.raises(ValueError): 1938s # There are two Dask chunks on the same Zarr chunk, 1938s # which means that it is unsafe in any mode 1938s self.save( 1938s store, 1938s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 1938s region="auto", 1938s mode=mode, 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # the first chunk is covering the border size, but it is not 1938s # completely covering the second chunk, which means that it is 1938s # unsafe in any mode 1938s self.save( 1938s store, 1938s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 1938s region="auto", 1938s mode=mode, 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # The first chunk is safe but the other two chunks are overlapping with 1938s # the same Zarr chunk 1938s self.save( 1938s store, 1938s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 1938s region="auto", 1938s mode=mode, 1938s ) 1938s 1938s # Fully update two contiguous chunks is safe in any mode 1938s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 1938s 1938s # The last chunk is considered full based on their current size (2) 1938s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 1938s self.save( 1938s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 1938s ) 1938s 1938s # Write the last chunk of a region partially is safe in "a" mode 1938s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 1938s with pytest.raises(ValueError): 1938s # with "r+" mode it is invalid to write partial chunk 1938s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 1938s 1938s # This is safe with mode "a", the border size is covered by the first chunk of Dask 1938s self.save( 1938s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 1938s ) 1938s with pytest.raises(ValueError): 1938s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 1938s self.save( 1938s store, 1938s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s # This is safe on mode "a" because there is a single dask chunk 1938s self.save( 1938s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 1938s ) 1938s with pytest.raises(ValueError): 1938s # This is unsafe on mode "r+", because the Dask chunk is partially writing 1938s # in the first chunk of Zarr 1938s self.save( 1938s store, 1938s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s # The first chunk is completely covering the first Zarr chunk 1938s # and the last chunk is a partial one 1938s self.save( 1938s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # The last chunk is partial, so it is considered unsafe on mode "r+" 1938s self.save( 1938s store, 1938s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s # The first chunk is covering the border size (2 elements) 1938s # and also the second chunk (3 elements), so it is valid 1938s self.save( 1938s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # The first chunk is not fully covering the first zarr chunk 1938s self.save( 1938s store, 1938s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # Validate that the border condition is not affecting the "r+" mode 1938s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 1938s 1938s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 1938s with pytest.raises(ValueError): 1938s # Validate that even if we write with a single Dask chunk on the last Zarr 1938s # chunk it is still unsafe if it is not fully covering it 1938s # (the last Zarr chunk has size 2) 1938s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 1938s 1938s # Validate the same as the above test but in the beginning of the last chunk 1938s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 1938s with pytest.raises(ValueError): 1938s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 1938s 1938s self.save( 1938s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 1938s ) 1938s with pytest.raises(ValueError): 1938s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 1938s # if it is partial covering other Zarr chunks 1938s self.save( 1938s store, 1938s arr.isel(a=slice(7, None)).chunk(a=-1), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # If the chunk is of size equal to the one in the Zarr encoding, but 1938s # it is partially writing in the first chunk then raise an error 1938s self.save( 1938s store, 1938s arr.isel(a=slice(8, None)).chunk(a=3), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s self.save( 1938s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 1938s ) 1938s 1938s # Test if the code is detecting the last chunk correctly 1938s data = np.random.default_rng(0).random((2920, 25, 53)) 1938s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 1938s chunks = {"time": 1000, "lat": 25, "lon": 53} 1938s self.save(store, ds.chunk(chunks), compute=False, mode="w") 1938s region = {"time": slice(1000, 2000, 1)} 1938s chunk = ds.isel(region) 1938s chunk = chunk.chunk() 1938s > self.save(store, chunk.chunk(), region=region) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1938s ds.to_zarr(target, **kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = 1938s name = 'temperature' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _____________ TestZarrRegionAuto.test_zarr_safe_chunk_region[3-a] ______________ 1938s 1938s self = 1938s mode = 'a' 1938s 1938s @requires_dask 1938s @pytest.mark.parametrize("mode", ["r+", "a"]) 1938s def test_zarr_safe_chunk_region(self, mode: Literal["r+", "a"]): 1938s with self.create_zarr_target() as store: 1938s arr = xr.DataArray( 1938s list(range(11)), dims=["a"], coords={"a": list(range(11))}, name="foo" 1938s ).chunk(a=3) 1938s self.save(store, arr, mode="w") 1938s 1938s with pytest.raises(ValueError): 1938s # There are two Dask chunks on the same Zarr chunk, 1938s # which means that it is unsafe in any mode 1938s self.save( 1938s store, 1938s arr.isel(a=slice(0, 3)).chunk(a=(2, 1)), 1938s region="auto", 1938s mode=mode, 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # the first chunk is covering the border size, but it is not 1938s # completely covering the second chunk, which means that it is 1938s # unsafe in any mode 1938s self.save( 1938s store, 1938s arr.isel(a=slice(1, 5)).chunk(a=(3, 1)), 1938s region="auto", 1938s mode=mode, 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # The first chunk is safe but the other two chunks are overlapping with 1938s # the same Zarr chunk 1938s self.save( 1938s store, 1938s arr.isel(a=slice(0, 5)).chunk(a=(3, 1, 1)), 1938s region="auto", 1938s mode=mode, 1938s ) 1938s 1938s # Fully update two contiguous chunks is safe in any mode 1938s self.save(store, arr.isel(a=slice(3, 9)), region="auto", mode=mode) 1938s 1938s # The last chunk is considered full based on their current size (2) 1938s self.save(store, arr.isel(a=slice(9, 11)), region="auto", mode=mode) 1938s self.save( 1938s store, arr.isel(a=slice(6, None)).chunk(a=-1), region="auto", mode=mode 1938s ) 1938s 1938s # Write the last chunk of a region partially is safe in "a" mode 1938s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="a") 1938s with pytest.raises(ValueError): 1938s # with "r+" mode it is invalid to write partial chunk 1938s self.save(store, arr.isel(a=slice(3, 8)), region="auto", mode="r+") 1938s 1938s # This is safe with mode "a", the border size is covered by the first chunk of Dask 1938s self.save( 1938s store, arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), region="auto", mode="a" 1938s ) 1938s with pytest.raises(ValueError): 1938s # This is considered unsafe in mode "r+" because it is writing in a partial chunk 1938s self.save( 1938s store, 1938s arr.isel(a=slice(1, 4)).chunk(a=(2, 1)), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s # This is safe on mode "a" because there is a single dask chunk 1938s self.save( 1938s store, arr.isel(a=slice(1, 5)).chunk(a=(4,)), region="auto", mode="a" 1938s ) 1938s with pytest.raises(ValueError): 1938s # This is unsafe on mode "r+", because the Dask chunk is partially writing 1938s # in the first chunk of Zarr 1938s self.save( 1938s store, 1938s arr.isel(a=slice(1, 5)).chunk(a=(4,)), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s # The first chunk is completely covering the first Zarr chunk 1938s # and the last chunk is a partial one 1938s self.save( 1938s store, arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), region="auto", mode="a" 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # The last chunk is partial, so it is considered unsafe on mode "r+" 1938s self.save( 1938s store, 1938s arr.isel(a=slice(0, 5)).chunk(a=(3, 2)), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s # The first chunk is covering the border size (2 elements) 1938s # and also the second chunk (3 elements), so it is valid 1938s self.save( 1938s store, arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), region="auto", mode="a" 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # The first chunk is not fully covering the first zarr chunk 1938s self.save( 1938s store, 1938s arr.isel(a=slice(1, 8)).chunk(a=(5, 2)), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # Validate that the border condition is not affecting the "r+" mode 1938s self.save(store, arr.isel(a=slice(1, 9)), region="auto", mode="r+") 1938s 1938s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="a") 1938s with pytest.raises(ValueError): 1938s # Validate that even if we write with a single Dask chunk on the last Zarr 1938s # chunk it is still unsafe if it is not fully covering it 1938s # (the last Zarr chunk has size 2) 1938s self.save(store, arr.isel(a=slice(10, 11)), region="auto", mode="r+") 1938s 1938s # Validate the same as the above test but in the beginning of the last chunk 1938s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="a") 1938s with pytest.raises(ValueError): 1938s self.save(store, arr.isel(a=slice(9, 10)), region="auto", mode="r+") 1938s 1938s self.save( 1938s store, arr.isel(a=slice(7, None)).chunk(a=-1), region="auto", mode="a" 1938s ) 1938s with pytest.raises(ValueError): 1938s # Test that even a Dask chunk that covers the last Zarr chunk can be unsafe 1938s # if it is partial covering other Zarr chunks 1938s self.save( 1938s store, 1938s arr.isel(a=slice(7, None)).chunk(a=-1), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s # If the chunk is of size equal to the one in the Zarr encoding, but 1938s # it is partially writing in the first chunk then raise an error 1938s self.save( 1938s store, 1938s arr.isel(a=slice(8, None)).chunk(a=3), 1938s region="auto", 1938s mode="r+", 1938s ) 1938s 1938s with pytest.raises(ValueError): 1938s self.save( 1938s store, arr.isel(a=slice(5, -1)).chunk(a=5), region="auto", mode="r+" 1938s ) 1938s 1938s # Test if the code is detecting the last chunk correctly 1938s data = np.random.default_rng(0).random((2920, 25, 53)) 1938s ds = xr.Dataset({"temperature": (("time", "lat", "lon"), data)}) 1938s chunks = {"time": 1000, "lat": 25, "lon": 53} 1938s self.save(store, ds.chunk(chunks), compute=False, mode="w") 1938s region = {"time": slice(1000, 2000, 1)} 1938s chunk = ds.isel(region) 1938s chunk = chunk.chunk() 1938s > self.save(store, chunk.chunk(), region=region) 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6691: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6294: in save 1938s ds.to_zarr(target, **kwargs) 1938s /usr/lib/python3/dist-packages/xarray/core/dataset.py:2270: in to_zarr 1938s return to_zarr( # type: ignore[call-overload,misc] 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:2239: in to_zarr 1938s dump_to_store(dataset, zstore, writer, encoding=encoding) 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:1975: in dump_to_store 1938s store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1009: in store 1938s k: self.open_store_variable(name=k) for k in existing_variable_names 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = 1938s name = 'temperature' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ____________________ test_open_dataset_chunking_zarr[auto] _____________________ 1938s 1938s chunks = 'auto' 1938s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar0') 1938s 1938s @requires_zarr 1938s @requires_dask 1938s @pytest.mark.parametrize( 1938s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1938s ) 1938s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1938s encoded_chunks = 100 1938s dask_arr = da.from_array( 1938s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1938s ) 1938s ds = xr.Dataset( 1938s { 1938s "test": xr.DataArray( 1938s dask_arr, 1938s dims=("x", "y"), 1938s ) 1938s } 1938s ) 1938s ds["test"].encoding["chunks"] = encoded_chunks 1938s ds.to_zarr(tmp_path / "test.zarr") 1938s 1938s with dask.config.set({"array.chunk-size": "1MiB"}): 1938s expected = ds.chunk(chunks) 1938s > with open_dataset( 1938s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _____________________ test_open_dataset_chunking_zarr[-1] ______________________ 1938s 1938s chunks = -1 1938s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar1') 1938s 1938s @requires_zarr 1938s @requires_dask 1938s @pytest.mark.parametrize( 1938s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1938s ) 1938s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1938s encoded_chunks = 100 1938s dask_arr = da.from_array( 1938s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1938s ) 1938s ds = xr.Dataset( 1938s { 1938s "test": xr.DataArray( 1938s dask_arr, 1938s dims=("x", "y"), 1938s ) 1938s } 1938s ) 1938s ds["test"].encoding["chunks"] = encoded_chunks 1938s ds.to_zarr(tmp_path / "test.zarr") 1938s 1938s with dask.config.set({"array.chunk-size": "1MiB"}): 1938s expected = ds.chunk(chunks) 1938s > with open_dataset( 1938s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___________________ test_open_dataset_chunking_zarr[chunks2] ___________________ 1938s 1938s chunks = {} 1938s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar2') 1938s 1938s @requires_zarr 1938s @requires_dask 1938s @pytest.mark.parametrize( 1938s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1938s ) 1938s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1938s encoded_chunks = 100 1938s dask_arr = da.from_array( 1938s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1938s ) 1938s ds = xr.Dataset( 1938s { 1938s "test": xr.DataArray( 1938s dask_arr, 1938s dims=("x", "y"), 1938s ) 1938s } 1938s ) 1938s ds["test"].encoding["chunks"] = encoded_chunks 1938s ds.to_zarr(tmp_path / "test.zarr") 1938s 1938s with dask.config.set({"array.chunk-size": "1MiB"}): 1938s expected = ds.chunk(chunks) 1938s > with open_dataset( 1938s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___________________ test_open_dataset_chunking_zarr[chunks3] ___________________ 1938s 1938s chunks = {'x': 'auto'} 1938s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar3') 1938s 1938s @requires_zarr 1938s @requires_dask 1938s @pytest.mark.parametrize( 1938s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1938s ) 1938s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1938s encoded_chunks = 100 1938s dask_arr = da.from_array( 1938s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1938s ) 1938s ds = xr.Dataset( 1938s { 1938s "test": xr.DataArray( 1938s dask_arr, 1938s dims=("x", "y"), 1938s ) 1938s } 1938s ) 1938s ds["test"].encoding["chunks"] = encoded_chunks 1938s ds.to_zarr(tmp_path / "test.zarr") 1938s 1938s with dask.config.set({"array.chunk-size": "1MiB"}): 1938s expected = ds.chunk(chunks) 1938s > with open_dataset( 1938s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___________________ test_open_dataset_chunking_zarr[chunks4] ___________________ 1938s 1938s chunks = {'x': -1} 1938s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar4') 1938s 1938s @requires_zarr 1938s @requires_dask 1938s @pytest.mark.parametrize( 1938s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1938s ) 1938s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1938s encoded_chunks = 100 1938s dask_arr = da.from_array( 1938s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1938s ) 1938s ds = xr.Dataset( 1938s { 1938s "test": xr.DataArray( 1938s dask_arr, 1938s dims=("x", "y"), 1938s ) 1938s } 1938s ) 1938s ds["test"].encoding["chunks"] = encoded_chunks 1938s ds.to_zarr(tmp_path / "test.zarr") 1938s 1938s with dask.config.set({"array.chunk-size": "1MiB"}): 1938s expected = ds.chunk(chunks) 1938s > with open_dataset( 1938s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ___________________ test_open_dataset_chunking_zarr[chunks5] ___________________ 1938s 1938s chunks = {'x': 'auto', 'y': -1} 1938s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_open_dataset_chunking_zar5') 1938s 1938s @requires_zarr 1938s @requires_dask 1938s @pytest.mark.parametrize( 1938s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1938s ) 1938s def test_open_dataset_chunking_zarr(chunks, tmp_path: Path) -> None: 1938s encoded_chunks = 100 1938s dask_arr = da.from_array( 1938s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1938s ) 1938s ds = xr.Dataset( 1938s { 1938s "test": xr.DataArray( 1938s dask_arr, 1938s dims=("x", "y"), 1938s ) 1938s } 1938s ) 1938s ds["test"].encoding["chunks"] = encoded_chunks 1938s ds.to_zarr(tmp_path / "test.zarr") 1938s 1938s with dask.config.set({"array.chunk-size": "1MiB"}): 1938s expected = ds.chunk(chunks) 1938s > with open_dataset( 1938s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6043: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s _______________________ test_chunking_consintency[auto] ________________________ 1938s 1938s chunks = 'auto' 1938s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_auto0') 1938s 1938s @requires_zarr 1938s @requires_dask 1938s @pytest.mark.parametrize( 1938s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1938s ) 1938s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1938s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1938s encoded_chunks: dict[str, Any] = {} 1938s dask_arr = da.from_array( 1938s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1938s ) 1938s ds = xr.Dataset( 1938s { 1938s "test": xr.DataArray( 1938s dask_arr, 1938s dims=("x", "y"), 1938s ) 1938s } 1938s ) 1938s ds["test"].encoding["chunks"] = encoded_chunks 1938s ds.to_zarr(tmp_path / "test.zarr") 1938s ds.to_netcdf(tmp_path / "test.nc") 1938s 1938s with dask.config.set({"array.chunk-size": "1MiB"}): 1938s expected = ds.chunk(chunks) 1938s > with xr.open_dataset( 1938s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ________________________ test_chunking_consintency[-1] _________________________ 1938s 1938s chunks = -1 1938s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency__1_0') 1938s 1938s @requires_zarr 1938s @requires_dask 1938s @pytest.mark.parametrize( 1938s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1938s ) 1938s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1938s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1938s encoded_chunks: dict[str, Any] = {} 1938s dask_arr = da.from_array( 1938s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1938s ) 1938s ds = xr.Dataset( 1938s { 1938s "test": xr.DataArray( 1938s dask_arr, 1938s dims=("x", "y"), 1938s ) 1938s } 1938s ) 1938s ds["test"].encoding["chunks"] = encoded_chunks 1938s ds.to_zarr(tmp_path / "test.zarr") 1938s ds.to_netcdf(tmp_path / "test.nc") 1938s 1938s with dask.config.set({"array.chunk-size": "1MiB"}): 1938s expected = ds.chunk(chunks) 1938s > with xr.open_dataset( 1938s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1938s "compressor": zarr_array.compressor, 1938s "filters": zarr_array.filters, 1938s } 1938s ) 1938s 1938s if self._use_zarr_fill_value_as_mask: 1938s # Setting this attribute triggers CF decoding for missing values 1938s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1938s if zarr_array.fill_value is not None: 1938s attributes["_FillValue"] = zarr_array.fill_value 1938s elif "_FillValue" in attributes: 1938s original_zarr_dtype = zarr_array.metadata.data_type 1938s attributes["_FillValue"] = FillValueCoder.decode( 1938s > attributes["_FillValue"], original_zarr_dtype.value 1938s ) 1938s E AttributeError: 'Float64' object has no attribute 'value' 1938s 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1938s ______________________ test_chunking_consintency[chunks2] ______________________ 1938s 1938s chunks = {} 1938s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun0') 1938s 1938s @requires_zarr 1938s @requires_dask 1938s @pytest.mark.parametrize( 1938s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1938s ) 1938s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1938s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1938s encoded_chunks: dict[str, Any] = {} 1938s dask_arr = da.from_array( 1938s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1938s ) 1938s ds = xr.Dataset( 1938s { 1938s "test": xr.DataArray( 1938s dask_arr, 1938s dims=("x", "y"), 1938s ) 1938s } 1938s ) 1938s ds["test"].encoding["chunks"] = encoded_chunks 1938s ds.to_zarr(tmp_path / "test.zarr") 1938s ds.to_netcdf(tmp_path / "test.nc") 1938s 1938s with dask.config.set({"array.chunk-size": "1MiB"}): 1938s expected = ds.chunk(chunks) 1938s > with xr.open_dataset( 1938s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1938s ) as actual: 1938s 1938s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1938s backend_ds = backend.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1938s ds = store_entrypoint.open_dataset( 1938s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1938s vars, attrs = filename_or_obj.load() 1938s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1938s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1938s return Frozen(dict(*args, **kwargs)) 1938s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1938s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1938s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1938s 1938s self = , name = 'test' 1938s 1938s def open_store_variable(self, name): 1938s zarr_array = self.members[name] 1938s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1938s try_nczarr = self._mode == "r" 1938s dimensions, attributes = _get_zarr_dims_and_attrs( 1938s zarr_array, DIMENSION_KEY, try_nczarr 1938s ) 1938s attributes = dict(attributes) 1938s 1938s encoding = { 1938s "chunks": zarr_array.chunks, 1938s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1938s } 1938s 1938s if _zarr_v3(): 1938s encoding.update( 1938s { 1938s "compressors": zarr_array.compressors, 1938s "filters": zarr_array.filters, 1938s "shards": zarr_array.shards, 1938s } 1938s ) 1938s if self.zarr_group.metadata.zarr_format == 3: 1938s encoding.update({"serializer": zarr_array.serializer}) 1938s else: 1938s encoding.update( 1938s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s ______________________ test_chunking_consintency[chunks3] ______________________ 1939s 1939s chunks = {'x': 'auto'} 1939s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun1') 1939s 1939s @requires_zarr 1939s @requires_dask 1939s @pytest.mark.parametrize( 1939s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1939s ) 1939s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1939s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1939s encoded_chunks: dict[str, Any] = {} 1939s dask_arr = da.from_array( 1939s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1939s ) 1939s ds = xr.Dataset( 1939s { 1939s "test": xr.DataArray( 1939s dask_arr, 1939s dims=("x", "y"), 1939s ) 1939s } 1939s ) 1939s ds["test"].encoding["chunks"] = encoded_chunks 1939s ds.to_zarr(tmp_path / "test.zarr") 1939s ds.to_netcdf(tmp_path / "test.nc") 1939s 1939s with dask.config.set({"array.chunk-size": "1MiB"}): 1939s expected = ds.chunk(chunks) 1939s > with xr.open_dataset( 1939s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1939s ) as actual: 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1939s backend_ds = backend.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1939s ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'test' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s ______________________ test_chunking_consintency[chunks4] ______________________ 1939s 1939s chunks = {'x': -1} 1939s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun2') 1939s 1939s @requires_zarr 1939s @requires_dask 1939s @pytest.mark.parametrize( 1939s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1939s ) 1939s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1939s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1939s encoded_chunks: dict[str, Any] = {} 1939s dask_arr = da.from_array( 1939s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1939s ) 1939s ds = xr.Dataset( 1939s { 1939s "test": xr.DataArray( 1939s dask_arr, 1939s dims=("x", "y"), 1939s ) 1939s } 1939s ) 1939s ds["test"].encoding["chunks"] = encoded_chunks 1939s ds.to_zarr(tmp_path / "test.zarr") 1939s ds.to_netcdf(tmp_path / "test.nc") 1939s 1939s with dask.config.set({"array.chunk-size": "1MiB"}): 1939s expected = ds.chunk(chunks) 1939s > with xr.open_dataset( 1939s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1939s ) as actual: 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1939s backend_ds = backend.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1939s ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'test' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s ______________________ test_chunking_consintency[chunks5] ______________________ 1939s 1939s chunks = {'x': 'auto', 'y': -1} 1939s tmp_path = PosixPath('/tmp/pytest-of-ubuntu/pytest-1/test_chunking_consintency_chun3') 1939s 1939s @requires_zarr 1939s @requires_dask 1939s @pytest.mark.parametrize( 1939s "chunks", ["auto", -1, {}, {"x": "auto"}, {"x": -1}, {"x": "auto", "y": -1}] 1939s ) 1939s @pytest.mark.filterwarnings("ignore:The specified chunks separate") 1939s def test_chunking_consintency(chunks, tmp_path: Path) -> None: 1939s encoded_chunks: dict[str, Any] = {} 1939s dask_arr = da.from_array( 1939s np.ones((500, 500), dtype="float64"), chunks=encoded_chunks 1939s ) 1939s ds = xr.Dataset( 1939s { 1939s "test": xr.DataArray( 1939s dask_arr, 1939s dims=("x", "y"), 1939s ) 1939s } 1939s ) 1939s ds["test"].encoding["chunks"] = encoded_chunks 1939s ds.to_zarr(tmp_path / "test.zarr") 1939s ds.to_netcdf(tmp_path / "test.nc") 1939s 1939s with dask.config.set({"array.chunk-size": "1MiB"}): 1939s expected = ds.chunk(chunks) 1939s > with xr.open_dataset( 1939s tmp_path / "test.zarr", engine="zarr", chunks=chunks 1939s ) as actual: 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6074: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1939s backend_ds = backend.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1939s ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'test' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s ______________________ TestNCZarr.test_overwriting_nczarr ______________________ 1939s 1939s self = 1939s 1939s def test_overwriting_nczarr(self) -> None: 1939s with create_tmp_file(suffix=".zarr") as tmp: 1939s ds = self._create_nczarr(tmp) 1939s expected = ds[["var1"]] 1939s expected.to_zarr(tmp, mode="w") 1939s > actual = xr.open_zarr(tmp, consolidated=False) 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends.py:6223: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1535: in open_zarr 1939s ds = open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:687: in open_dataset 1939s backend_ds = backend.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1625: in open_dataset 1939s ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'dim2' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s ________________ TestZarrDatatreeIO.test_to_zarr[zarr_format=3] ________________ 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zarr_format_3_0') 1939s simple_datatree = 1939s Group: / 1939s │ Dimensions: (y: 3, x: 2) 1939s │ Dimensions without coordinates: y, x 1939s │ Data variables: 1939s ... a (x) int64 16B 2 3 1939s │ │ b (x) float64 16B 0.1 0.2 1939s │ └── Group: /set2/set1 1939s └── Group: /set3 1939s zarr_format = 3 1939s 1939s def test_to_zarr(self, tmpdir, simple_datatree, zarr_format): 1939s filepath = str(tmpdir / "test.zarr") 1939s original_dt = simple_datatree 1939s original_dt.to_zarr(filepath, zarr_format=zarr_format) 1939s 1939s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:459: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1939s backend_tree = backend.open_datatree( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1939s groups_dict = self.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s _____________ TestZarrDatatreeIO.test_zarr_encoding[zarr_format=3] _____________ 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_zarr_encoding_zarr_format1') 1939s simple_datatree = 1939s Group: / 1939s │ Dimensions: (y: 3, x: 2) 1939s │ Dimensions without coordinates: y, x 1939s │ Data variables: 1939s ... a (x) int64 16B 2 3 1939s │ │ b (x) float64 16B 0.1 0.2 1939s │ └── Group: /set2/set1 1939s └── Group: /set3 1939s zarr_format = 3 1939s 1939s def test_zarr_encoding(self, tmpdir, simple_datatree, zarr_format): 1939s filepath = str(tmpdir / "test.zarr") 1939s original_dt = simple_datatree 1939s 1939s if zarr_format == 2: 1939s from numcodecs.blosc import Blosc 1939s 1939s codec = Blosc(cname="zstd", clevel=3, shuffle=2) 1939s comp = {"compressors": (codec,)} if has_zarr_v3 else {"compressor": codec} 1939s elif zarr_format == 3: 1939s # specifying codecs in zarr_format=3 requires importing from zarr 3 namespace 1939s import numcodecs.zarr3 1939s 1939s comp = {"compressors": (numcodecs.zarr3.Blosc(cname="zstd", clevel=3),)} 1939s 1939s enc = {"/set2": {var: comp for var in original_dt["/set2"].dataset.data_vars}} 1939s original_dt.to_zarr(filepath, encoding=enc, zarr_format=zarr_format) 1939s 1939s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:480: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1939s backend_tree = backend.open_datatree( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1939s groups_dict = self.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=2] ___________ 1939s 1939s cls = 1939s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1939s path = '', mode = 'r' 1939s 1939s @classmethod 1939s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1939s """ 1939s Open StorePath based on the provided mode. 1939s 1939s * If the mode is None, return an opened version of the store with no changes. 1939s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1939s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1939s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1939s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1939s 1939s Parameters 1939s ---------- 1939s mode : AccessModeLiteral 1939s The mode to use when initializing the store path. 1939s 1939s The accepted values are: 1939s 1939s - ``'r'``: read only (must exist) 1939s - ``'r+'``: read/write (must exist) 1939s - ``'a'``: read/write (create if doesn't exist) 1939s - ``'w'``: read/write (overwrite if exists) 1939s - ``'w-'``: read/write (create if doesn't exist). 1939s 1939s Raises 1939s ------ 1939s FileExistsError 1939s If the mode is 'w-' and the store path already exists. 1939s ValueError 1939s If the mode is not "r" and the store is read-only, or 1939s """ 1939s 1939s # fastpath if mode is None 1939s if mode is None: 1939s return await cls._create_open_instance(store, path) 1939s 1939s if mode not in ANY_ACCESS_MODE: 1939s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1939s 1939s if store.read_only: 1939s # Don't allow write operations on a read-only store 1939s if mode != "r": 1939s raise ValueError( 1939s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1939s ) 1939s self = await cls._create_open_instance(store, path) 1939s elif mode == "r": 1939s # Create read-only copy for read mode on writable store 1939s try: 1939s > read_only_store = store.with_read_only(True) 1939s 1939s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1939s read_only = True 1939s 1939s def with_read_only(self, read_only: bool = False) -> Store: 1939s """ 1939s Return a new store with a new read_only setting. 1939s 1939s The new store points to the same location with the specified new read_only state. 1939s The returned Store is not automatically opened, and this store is 1939s not automatically closed. 1939s 1939s Parameters 1939s ---------- 1939s read_only 1939s If True, the store will be created in read-only mode. Defaults to False. 1939s 1939s Returns 1939s ------- 1939s A new store of the same type with the new read only attribute. 1939s """ 1939s > raise NotImplementedError( 1939s f"with_read_only is not implemented for the {type(self)} store type." 1939s ) 1939s E NotImplementedError: with_read_only is not implemented for the store type. 1939s 1939s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 1939s 1939s The above exception was the direct cause of the following exception: 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0') 1939s simple_datatree = 1939s Group: / 1939s │ Dimensions: (y: 3, x: 2) 1939s │ Dimensions without coordinates: y, x 1939s │ Data variables: 1939s ... a (x) int64 16B 2 3 1939s │ │ b (x) float64 16B 0.1 0.2 1939s │ └── Group: /set2/set1 1939s └── Group: /set3 1939s zarr_format = 2 1939s 1939s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 1939s from zarr.storage import ZipStore 1939s 1939s filepath = str(tmpdir / "test.zarr.zip") 1939s original_dt = simple_datatree 1939s store = ZipStore(filepath, mode="w") 1939s original_dt.to_zarr(store, zarr_format=zarr_format) 1939s 1939s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1939s backend_tree = backend.open_datatree( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1939s groups_dict = self.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 1939s stores = ZarrStore.open_store( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 1939s ) = _get_open_params( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 1939s zarr_root_group = zarr.open_group(store, **open_kwargs) 1939s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 1939s sync( 1939s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1939s raise return_result 1939s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1939s return await coro 1939s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1939s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1939s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 1939s return await StorePath.open(store, path=path_normalized, mode=mode) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s cls = 1939s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo0/test.zarr.zip') 1939s path = '', mode = 'r' 1939s 1939s @classmethod 1939s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1939s """ 1939s Open StorePath based on the provided mode. 1939s 1939s * If the mode is None, return an opened version of the store with no changes. 1939s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1939s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1939s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1939s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1939s 1939s Parameters 1939s ---------- 1939s mode : AccessModeLiteral 1939s The mode to use when initializing the store path. 1939s 1939s The accepted values are: 1939s 1939s - ``'r'``: read only (must exist) 1939s - ``'r+'``: read/write (must exist) 1939s - ``'a'``: read/write (create if doesn't exist) 1939s - ``'w'``: read/write (overwrite if exists) 1939s - ``'w-'``: read/write (create if doesn't exist). 1939s 1939s Raises 1939s ------ 1939s FileExistsError 1939s If the mode is 'w-' and the store path already exists. 1939s ValueError 1939s If the mode is not "r" and the store is read-only, or 1939s """ 1939s 1939s # fastpath if mode is None 1939s if mode is None: 1939s return await cls._create_open_instance(store, path) 1939s 1939s if mode not in ANY_ACCESS_MODE: 1939s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1939s 1939s if store.read_only: 1939s # Don't allow write operations on a read-only store 1939s if mode != "r": 1939s raise ValueError( 1939s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1939s ) 1939s self = await cls._create_open_instance(store, path) 1939s elif mode == "r": 1939s # Create read-only copy for read mode on writable store 1939s try: 1939s read_only_store = store.with_read_only(True) 1939s except NotImplementedError as e: 1939s > raise ValueError( 1939s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 1939s "Please use a read-only store or a storage class that implements .with_read_only()." 1939s ) from e 1939s E ValueError: Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. Please use a read-only store or a storage class that implements .with_read_only(). 1939s 1939s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 1939s ___________ TestZarrDatatreeIO.test_to_zarr_zip_store[zarr_format=3] ___________ 1939s 1939s cls = 1939s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1939s path = '', mode = 'r' 1939s 1939s @classmethod 1939s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1939s """ 1939s Open StorePath based on the provided mode. 1939s 1939s * If the mode is None, return an opened version of the store with no changes. 1939s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1939s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1939s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1939s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1939s 1939s Parameters 1939s ---------- 1939s mode : AccessModeLiteral 1939s The mode to use when initializing the store path. 1939s 1939s The accepted values are: 1939s 1939s - ``'r'``: read only (must exist) 1939s - ``'r+'``: read/write (must exist) 1939s - ``'a'``: read/write (create if doesn't exist) 1939s - ``'w'``: read/write (overwrite if exists) 1939s - ``'w-'``: read/write (create if doesn't exist). 1939s 1939s Raises 1939s ------ 1939s FileExistsError 1939s If the mode is 'w-' and the store path already exists. 1939s ValueError 1939s If the mode is not "r" and the store is read-only, or 1939s """ 1939s 1939s # fastpath if mode is None 1939s if mode is None: 1939s return await cls._create_open_instance(store, path) 1939s 1939s if mode not in ANY_ACCESS_MODE: 1939s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1939s 1939s if store.read_only: 1939s # Don't allow write operations on a read-only store 1939s if mode != "r": 1939s raise ValueError( 1939s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1939s ) 1939s self = await cls._create_open_instance(store, path) 1939s elif mode == "r": 1939s # Create read-only copy for read mode on writable store 1939s try: 1939s > read_only_store = store.with_read_only(True) 1939s 1939s /usr/lib/python3/dist-packages/zarr/storage/_common.py:123: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1939s read_only = True 1939s 1939s def with_read_only(self, read_only: bool = False) -> Store: 1939s """ 1939s Return a new store with a new read_only setting. 1939s 1939s The new store points to the same location with the specified new read_only state. 1939s The returned Store is not automatically opened, and this store is 1939s not automatically closed. 1939s 1939s Parameters 1939s ---------- 1939s read_only 1939s If True, the store will be created in read-only mode. Defaults to False. 1939s 1939s Returns 1939s ------- 1939s A new store of the same type with the new read only attribute. 1939s """ 1939s > raise NotImplementedError( 1939s f"with_read_only is not implemented for the {type(self)} store type." 1939s ) 1939s E NotImplementedError: with_read_only is not implemented for the store type. 1939s 1939s /usr/lib/python3/dist-packages/zarr/abc/store.py:98: NotImplementedError 1939s 1939s The above exception was the direct cause of the following exception: 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1') 1939s simple_datatree = 1939s Group: / 1939s │ Dimensions: (y: 3, x: 2) 1939s │ Dimensions without coordinates: y, x 1939s │ Data variables: 1939s ... a (x) int64 16B 2 3 1939s │ │ b (x) float64 16B 0.1 0.2 1939s │ └── Group: /set2/set1 1939s └── Group: /set3 1939s zarr_format = 3 1939s 1939s def test_to_zarr_zip_store(self, tmpdir, simple_datatree, zarr_format): 1939s from zarr.storage import ZipStore 1939s 1939s filepath = str(tmpdir / "test.zarr.zip") 1939s original_dt = simple_datatree 1939s store = ZipStore(filepath, mode="w") 1939s original_dt.to_zarr(store, zarr_format=zarr_format) 1939s 1939s > with open_datatree(store, engine="zarr") as roundtrip_dt: # type: ignore[arg-type, unused-ignore] 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:500: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1939s backend_tree = backend.open_datatree( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1939s groups_dict = self.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1707: in open_groups_as_dict 1939s stores = ZarrStore.open_store( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:665: in open_store 1939s ) = _get_open_params( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1815: in _get_open_params 1939s zarr_root_group = zarr.open_group(store, **open_kwargs) 1939s /usr/lib/python3/dist-packages/zarr/api/synchronous.py:540: in open_group 1939s sync( 1939s /usr/lib/python3/dist-packages/zarr/core/sync.py:163: in sync 1939s raise return_result 1939s /usr/lib/python3/dist-packages/zarr/core/sync.py:119: in _runner 1939s return await coro 1939s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:851: in open_group 1939s store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) 1939s /usr/lib/python3/dist-packages/zarr/storage/_common.py:419: in make_store_path 1939s return await StorePath.open(store, path=path_normalized, mode=mode) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s cls = 1939s store = ZipStore('zip:///tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_zip_store_zarr_fo1/test.zarr.zip') 1939s path = '', mode = 'r' 1939s 1939s @classmethod 1939s async def open(cls, store: Store, path: str, mode: AccessModeLiteral | None = None) -> Self: 1939s """ 1939s Open StorePath based on the provided mode. 1939s 1939s * If the mode is None, return an opened version of the store with no changes. 1939s * If the mode is 'r+', 'w-', 'w', or 'a' and the store is read-only, raise a ValueError. 1939s * If the mode is 'r' and the store is not read-only, return a copy of the store with read_only set to True. 1939s * If the mode is 'w-' and the store is not read-only and the StorePath contains keys, raise a FileExistsError. 1939s * If the mode is 'w' and the store is not read-only, delete all keys nested within the StorePath. 1939s 1939s Parameters 1939s ---------- 1939s mode : AccessModeLiteral 1939s The mode to use when initializing the store path. 1939s 1939s The accepted values are: 1939s 1939s - ``'r'``: read only (must exist) 1939s - ``'r+'``: read/write (must exist) 1939s - ``'a'``: read/write (create if doesn't exist) 1939s - ``'w'``: read/write (overwrite if exists) 1939s - ``'w-'``: read/write (create if doesn't exist). 1939s 1939s Raises 1939s ------ 1939s FileExistsError 1939s If the mode is 'w-' and the store path already exists. 1939s ValueError 1939s If the mode is not "r" and the store is read-only, or 1939s """ 1939s 1939s # fastpath if mode is None 1939s if mode is None: 1939s return await cls._create_open_instance(store, path) 1939s 1939s if mode not in ANY_ACCESS_MODE: 1939s raise ValueError(f"Invalid mode: {mode}, expected one of {ANY_ACCESS_MODE}") 1939s 1939s if store.read_only: 1939s # Don't allow write operations on a read-only store 1939s if mode != "r": 1939s raise ValueError( 1939s f"Store is read-only but mode is {mode!r}. Create a writable store or use 'r' mode." 1939s ) 1939s self = await cls._create_open_instance(store, path) 1939s elif mode == "r": 1939s # Create read-only copy for read mode on writable store 1939s try: 1939s read_only_store = store.with_read_only(True) 1939s except NotImplementedError as e: 1939s > raise ValueError( 1939s "Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. " 1939s "Please use a read-only store or a storage class that implements .with_read_only()." 1939s ) from e 1939s E ValueError: Store is not read-only but mode is 'r'. Unable to create a read-only copy of the store. Please use a read-only store or a storage class that implements .with_read_only(). 1939s 1939s /usr/lib/python3/dist-packages/zarr/storage/_common.py:125: ValueError 1939s _______ TestZarrDatatreeIO.test_to_zarr_not_consolidated[zarr_format=3] ________ 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_to_zarr_not_consolidated_1') 1939s simple_datatree = 1939s Group: / 1939s │ Dimensions: (y: 3, x: 2) 1939s │ Dimensions without coordinates: y, x 1939s │ Data variables: 1939s ... a (x) int64 16B 2 3 1939s │ │ b (x) float64 16B 0.1 0.2 1939s │ └── Group: /set2/set1 1939s └── Group: /set3 1939s zarr_format = 3 1939s 1939s def test_to_zarr_not_consolidated(self, tmpdir, simple_datatree, zarr_format): 1939s filepath = tmpdir / "test.zarr" 1939s zmetadata = filepath / ".zmetadata" 1939s s1zmetadata = filepath / "set1" / ".zmetadata" 1939s filepath = str(filepath) # casting to str avoids a pathlib bug in xarray 1939s original_dt = simple_datatree 1939s original_dt.to_zarr(filepath, consolidated=False, zarr_format=zarr_format) 1939s assert not zmetadata.exists() 1939s assert not s1zmetadata.exists() 1939s 1939s with pytest.warns(RuntimeWarning, match="consolidated"): 1939s > with open_datatree(filepath, engine="zarr") as roundtrip_dt: 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:514: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1939s backend_tree = backend.open_datatree( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1939s groups_dict = self.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s ________ TestZarrDatatreeIO.test_open_groups_round_trip[zarr_format=3] _________ 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_groups_round_trip_za1') 1939s simple_datatree = 1939s Group: / 1939s │ Dimensions: (y: 3, x: 2) 1939s │ Dimensions without coordinates: y, x 1939s │ Data variables: 1939s ... a (x) int64 16B 2 3 1939s │ │ b (x) float64 16B 0.1 0.2 1939s │ └── Group: /set2/set1 1939s └── Group: /set3 1939s zarr_format = 3 1939s 1939s def test_open_groups_round_trip(self, tmpdir, simple_datatree, zarr_format) -> None: 1939s """Test `open_groups` opens a zarr store with the `simple_datatree` structure.""" 1939s filepath = str(tmpdir / "test.zarr") 1939s original_dt = simple_datatree 1939s original_dt.to_zarr(filepath, zarr_format=zarr_format) 1939s 1939s > roundtrip_dict = open_groups(filepath, engine="zarr") 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:631: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1939s backend_groups = backend.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s _____________ TestZarrDatatreeIO.test_open_datatree[zarr_format=3] _____________ 1939s 1939s self = 1939s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0xe3ab728b3d80> 1939s zarr_format = 3 1939s 1939s @pytest.mark.filterwarnings( 1939s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1939s ) 1939s def test_open_datatree(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 1939s """Test if `open_datatree` fails to open a zarr store with an unaligned group hierarchy.""" 1939s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 1939s 1939s with pytest.raises( 1939s ValueError, 1939s match=( 1939s re.escape("group '/Group2' is not aligned with its parents:") + ".*" 1939s ), 1939s ): 1939s > open_datatree(storepath, engine="zarr") 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:653: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1939s backend_tree = backend.open_datatree( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1939s groups_dict = self.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s _________ TestZarrDatatreeIO.test_open_datatree_chunks[zarr_format=3] __________ 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_chunks_zarr1') 1939s zarr_format = 3 1939s 1939s @requires_dask 1939s def test_open_datatree_chunks(self, tmpdir, zarr_format) -> None: 1939s filepath = str(tmpdir / "test.zarr") 1939s 1939s chunks = {"x": 2, "y": 1} 1939s 1939s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 1939s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 1939s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 1939s original_tree = DataTree.from_dict( 1939s { 1939s "/": root_data.chunk(chunks), 1939s "/group1": set1_data.chunk(chunks), 1939s "/group2": set2_data.chunk(chunks), 1939s } 1939s ) 1939s original_tree.to_zarr(filepath, zarr_format=zarr_format) 1939s 1939s > with open_datatree(filepath, engine="zarr", chunks=chunks) as tree: 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:673: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1939s backend_tree = backend.open_datatree( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1939s groups_dict = self.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s ______________ TestZarrDatatreeIO.test_open_groups[zarr_format=3] ______________ 1939s 1939s self = 1939s unaligned_datatree_zarr_factory = ._unaligned_datatree_zarr at 0xe3ab728b3d80> 1939s zarr_format = 3 1939s 1939s @pytest.mark.filterwarnings( 1939s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1939s ) 1939s def test_open_groups(self, unaligned_datatree_zarr_factory, zarr_format) -> None: 1939s """Test `open_groups` with a zarr store of an unaligned group hierarchy.""" 1939s 1939s storepath = unaligned_datatree_zarr_factory(zarr_format=zarr_format) 1939s > unaligned_dict_of_datasets = open_groups(storepath, engine="zarr") 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:689: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1939s backend_groups = backend.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[True-zarr_format=3] ___ 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_specific_gr2') 1939s simple_datatree = 1939s Group: / 1939s │ Dimensions: (y: 3, x: 2) 1939s │ Dimensions without coordinates: y, x 1939s │ Data variables: 1939s ... a (x) int64 16B 2 3 1939s │ │ b (x) float64 16B 0.1 0.2 1939s │ └── Group: /set2/set1 1939s └── Group: /set3 1939s write_consolidated_metadata = True, zarr_format = 3 1939s 1939s @pytest.mark.filterwarnings( 1939s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1939s ) 1939s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1939s def test_open_datatree_specific_group( 1939s self, 1939s tmpdir, 1939s simple_datatree, 1939s write_consolidated_metadata, 1939s zarr_format, 1939s ) -> None: 1939s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1939s filepath = str(tmpdir / "test.zarr") 1939s group = "/set2" 1939s original_dt = simple_datatree 1939s original_dt.to_zarr( 1939s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1939s ) 1939s expected_subtree = original_dt[group].copy() 1939s expected_subtree.orphan() 1939s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1939s backend_tree = backend.open_datatree( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1939s groups_dict = self.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s __ TestZarrDatatreeIO.test_open_datatree_specific_group[False-zarr_format=3] ___ 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_specific_gr4') 1939s simple_datatree = 1939s Group: / 1939s │ Dimensions: (y: 3, x: 2) 1939s │ Dimensions without coordinates: y, x 1939s │ Data variables: 1939s ... a (x) int64 16B 2 3 1939s │ │ b (x) float64 16B 0.1 0.2 1939s │ └── Group: /set2/set1 1939s └── Group: /set3 1939s write_consolidated_metadata = False, zarr_format = 3 1939s 1939s @pytest.mark.filterwarnings( 1939s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1939s ) 1939s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1939s def test_open_datatree_specific_group( 1939s self, 1939s tmpdir, 1939s simple_datatree, 1939s write_consolidated_metadata, 1939s zarr_format, 1939s ) -> None: 1939s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1939s filepath = str(tmpdir / "test.zarr") 1939s group = "/set2" 1939s original_dt = simple_datatree 1939s original_dt.to_zarr( 1939s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1939s ) 1939s expected_subtree = original_dt[group].copy() 1939s expected_subtree.orphan() 1939s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1939s backend_tree = backend.open_datatree( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1939s groups_dict = self.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s ___ TestZarrDatatreeIO.test_open_datatree_specific_group[None-zarr_format=3] ___ 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_datatree_specific_gr6') 1939s simple_datatree = 1939s Group: / 1939s │ Dimensions: (y: 3, x: 2) 1939s │ Dimensions without coordinates: y, x 1939s │ Data variables: 1939s ... a (x) int64 16B 2 3 1939s │ │ b (x) float64 16B 0.1 0.2 1939s │ └── Group: /set2/set1 1939s └── Group: /set3 1939s write_consolidated_metadata = None, zarr_format = 3 1939s 1939s @pytest.mark.filterwarnings( 1939s "ignore:Failed to open Zarr store with consolidated metadata:RuntimeWarning" 1939s ) 1939s @pytest.mark.parametrize("write_consolidated_metadata", [True, False, None]) 1939s def test_open_datatree_specific_group( 1939s self, 1939s tmpdir, 1939s simple_datatree, 1939s write_consolidated_metadata, 1939s zarr_format, 1939s ) -> None: 1939s """Test opening a specific group within a Zarr store using `open_datatree`.""" 1939s filepath = str(tmpdir / "test.zarr") 1939s group = "/set2" 1939s original_dt = simple_datatree 1939s original_dt.to_zarr( 1939s filepath, consolidated=write_consolidated_metadata, zarr_format=zarr_format 1939s ) 1939s expected_subtree = original_dt[group].copy() 1939s expected_subtree.orphan() 1939s > with open_datatree(filepath, group=group, engine=self.engine) as subgroup_tree: 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:730: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1132: in open_datatree 1939s backend_tree = backend.open_datatree( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1658: in open_datatree 1939s groups_dict = self.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s __________ TestZarrDatatreeIO.test_open_groups_chunks[zarr_format=3] ___________ 1939s 1939s self = 1939s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-1/test_open_groups_chunks_zarr_f1') 1939s zarr_format = 3 1939s 1939s @requires_dask 1939s def test_open_groups_chunks(self, tmpdir, zarr_format) -> None: 1939s """Test `open_groups` with chunks on a zarr store.""" 1939s 1939s chunks = {"x": 2, "y": 1} 1939s filepath = str(tmpdir / "test.zarr") 1939s root_data = xr.Dataset({"a": ("y", [6, 7, 8]), "set0": ("x", [9, 10])}) 1939s set1_data = xr.Dataset({"a": ("y", [-1, 0, 1]), "b": ("x", [-10, 6])}) 1939s set2_data = xr.Dataset({"a": ("y", [1, 2, 3]), "b": ("x", [0.1, 0.2])}) 1939s original_tree = DataTree.from_dict( 1939s { 1939s "/": root_data.chunk(chunks), 1939s "/group1": set1_data.chunk(chunks), 1939s "/group2": set2_data.chunk(chunks), 1939s } 1939s ) 1939s original_tree.to_zarr(filepath, mode="w", zarr_format=zarr_format) 1939s 1939s > dict_of_datasets = open_groups(filepath, engine="zarr", chunks=chunks) 1939s 1939s /usr/lib/python3/dist-packages/xarray/tests/test_backends_datatree.py:752: 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s /usr/lib/python3/dist-packages/xarray/backends/api.py:1364: in open_groups 1939s backend_groups = backend.open_groups_as_dict( 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:1725: in open_groups_as_dict 1939s group_ds = store_entrypoint.open_dataset( 1939s /usr/lib/python3/dist-packages/xarray/backends/store.py:44: in open_dataset 1939s vars, attrs = filename_or_obj.load() 1939s /usr/lib/python3/dist-packages/xarray/backends/common.py:312: in load 1939s (_decode_variable_name(k), v) for k, v in self.get_variables().items() 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in get_variables 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s /usr/lib/python3/dist-packages/xarray/core/utils.py:457: in FrozenDict 1939s return Frozen(dict(*args, **kwargs)) 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:888: in 1939s return FrozenDict((k, self.open_store_variable(k)) for k in self.array_keys()) 1939s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1939s 1939s self = , name = 'b' 1939s 1939s def open_store_variable(self, name): 1939s zarr_array = self.members[name] 1939s data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array)) 1939s try_nczarr = self._mode == "r" 1939s dimensions, attributes = _get_zarr_dims_and_attrs( 1939s zarr_array, DIMENSION_KEY, try_nczarr 1939s ) 1939s attributes = dict(attributes) 1939s 1939s encoding = { 1939s "chunks": zarr_array.chunks, 1939s "preferred_chunks": dict(zip(dimensions, zarr_array.chunks, strict=True)), 1939s } 1939s 1939s if _zarr_v3(): 1939s encoding.update( 1939s { 1939s "compressors": zarr_array.compressors, 1939s "filters": zarr_array.filters, 1939s "shards": zarr_array.shards, 1939s } 1939s ) 1939s if self.zarr_group.metadata.zarr_format == 3: 1939s encoding.update({"serializer": zarr_array.serializer}) 1939s else: 1939s encoding.update( 1939s { 1939s "compressor": zarr_array.compressor, 1939s "filters": zarr_array.filters, 1939s } 1939s ) 1939s 1939s if self._use_zarr_fill_value_as_mask: 1939s # Setting this attribute triggers CF decoding for missing values 1939s # by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue 1939s if zarr_array.fill_value is not None: 1939s attributes["_FillValue"] = zarr_array.fill_value 1939s elif "_FillValue" in attributes: 1939s original_zarr_dtype = zarr_array.metadata.data_type 1939s attributes["_FillValue"] = FillValueCoder.decode( 1939s > attributes["_FillValue"], original_zarr_dtype.value 1939s ) 1939s E AttributeError: 'Float64' object has no attribute 'value' 1939s 1939s /usr/lib/python3/dist-packages/xarray/backends/zarr.py:882: AttributeError 1939s =============================== warnings summary =============================== 1939s tests/test_backends.py: 4 warnings 1939s tests/test_conventions.py: 1 warning 1939s tests/test_rolling.py: 36 warnings 1939s /usr/lib/python3/dist-packages/xarray/core/duck_array_ops.py:237: RuntimeWarning: invalid value encountered in cast 1939s return data.astype(dtype, **kwargs) 1939s 1939s tests/test_backends.py: 540 warnings 1939s tests/test_backends_datatree.py: 15 warnings 1939s /usr/lib/python3/dist-packages/zarr/api/asynchronous.py:244: ZarrUserWarning: Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future. 1939s warnings.warn( 1939s 1939s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1939s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1939s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1939s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/bytes.py:383: UnstableSpecificationWarning: The data type (NullTerminatedBytes(length=6)) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1939s v3_unstable_dtype_warning(self) 1939s 1939s tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1939s tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1939s tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1939s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=6, endianness='little')) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1939s v3_unstable_dtype_warning(self) 1939s 1939s tests/test_backends.py: 117 warnings 1939s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=1, endianness='little')) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1939s v3_unstable_dtype_warning(self) 1939s 1939s tests/test_backends.py: 12 warnings 1939s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/bytes.py:383: UnstableSpecificationWarning: The data type (NullTerminatedBytes(length=4)) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1939s v3_unstable_dtype_warning(self) 1939s 1939s tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_data[3] 1939s tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_string_data[3] 1939s tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_string_data[3] 1939s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=4, endianness='little')) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1939s v3_unstable_dtype_warning(self) 1939s 1939s tests/test_backends.py: 33 warnings 1939s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/bytes.py:383: UnstableSpecificationWarning: The data type (NullTerminatedBytes(length=2)) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1939s v3_unstable_dtype_warning(self) 1939s 1939s tests/test_backends.py: 33 warnings 1939s /usr/lib/python3/dist-packages/zarr/core/dtype/npy/string.py:248: UnstableSpecificationWarning: The data type (FixedLengthUTF32(length=2, endianness='little')) does not have a Zarr V3 specification. That means that the representation of arrays saved with this data type may change without warning in a future version of Zarr Python. Arrays stored with this data type may be unreadable by other Zarr libraries. Use this data type at your own risk! Check https://github.com/zarr-developers/zarr-extensions/tree/main/data-types for the status of data type specifications for Zarr V3. 1939s v3_unstable_dtype_warning(self) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1939s /usr/lib/python3/dist-packages/numcodecs/zarr3.py:164: UserWarning: Numcodecs codecs are not in the Zarr version 3 specification and may not be supported by other zarr implementations. 1939s super().__init__(**codec_config) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1939s /usr/lib/python3/dist-packages/zarr/codecs/numcodecs/_codecs.py:139: ZarrUserWarning: Numcodecs codecs are not in the Zarr version 3 specification and may not be supported by other zarr implementations. 1939s super().__init__(**codec_config) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: '.zgroup' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: '.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set0/.zarray' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set0/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'a/.zarray' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'a/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/.zgroup' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/a/.zarray' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/a/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/b/.zarray' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/b/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/.zgroup' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/a/.zarray' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/a/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/b/.zarray' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/b/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set3/.zgroup' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set3/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set1/.zgroup' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set1/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set2/.zgroup' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set2/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/set1/.zgroup' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/set1/.zattrs' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set0/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'a/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/a/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/b/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/a/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/b/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set3/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set1/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set1/set2/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s /usr/lib/python3.13/zipfile/__init__.py:1642: UserWarning: Duplicate name: 'set2/set1/zarr.json' 1939s return self._open_to_write(zinfo, force_zip64=force_zip64) 1939s 1939s tests/test_dask.py: 12 warnings 1939s tests/test_units.py: 10 warnings 1939s /usr/lib/python3/dist-packages/numpy/_core/numeric.py:476: RuntimeWarning: invalid value encountered in cast 1939s multiarray.copyto(res, fill_value, casting='unsafe') 1939s 1939s tests/test_duck_array_ops.py: 16 warnings 1939s /usr/lib/python3/dist-packages/dask/array/core.py:5083: RuntimeWarning: overflow encountered in scalar add 1939s result = function(*args, **kwargs) 1939s 1939s tests/test_duck_array_ops.py::test_cftime_datetime_mean[True] 1939s /usr/lib/python3/dist-packages/dask/array/core.py:5083: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int. 1939s result = function(*args, **kwargs) 1939s 1939s tests/test_duck_array_wrapping.py::TestDataArrayMethods::test_astype[pint] 1939s /usr/lib/python3/dist-packages/pint/facets/numpy/quantity.py:88: RuntimeWarning: invalid value encountered in cast 1939s value = func(*args, **kwargs) 1939s 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s /usr/lib/python3/dist-packages/numpy/_core/fromnumeric.py:86: RuntimeWarning: invalid value encountered in reduce 1939s return ufunc.reduce(obj, axis, dtype, out, **passkwargs) 1939s 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s /usr/lib/python3/dist-packages/xarray/tests/test_strategies.py:277: RuntimeWarning: Mean of empty slice 1939s expected = np.nanmean(var.data, axis=reduction_axes) 1939s 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s tests/test_strategies.py::TestReduction::test_mean 1939s /usr/lib/python3/dist-packages/numpy/_core/fromnumeric.py:86: RuntimeWarning: overflow encountered in reduce 1939s return ufunc.reduce(obj, axis, dtype, out, **passkwargs) 1939s 1939s tests/test_tutorial.py::TestLoadDataset::test_download_from_github 1939s /usr/lib/python3/dist-packages/_pytest/python.py:159: RuntimeWarning: deallocating CachingFileManager(, '/tmp/pytest-of-ubuntu/pytest-1/test_download_from_github0/xarray_tutorial_data/4c5c606840191d085ac934c9665f7387-tiny.nc', mode='r', kwargs={'clobber': True, 'diskless': False, 'persist': False, 'format': 'NETCDF4'}, manager_id='f28976fa-d2ba-45f7-a149-40634aac1ef7'), but file is not already closed. This may indicate a bug. 1939s result = testfunction(**testargs) 1939s 1939s tests/test_tutorial.py::TestLoadDataset::test_download_from_github_load_without_cache 1939s /usr/lib/python3/dist-packages/_pytest/python.py:159: RuntimeWarning: deallocating CachingFileManager(, '/tmp/pytest-of-ubuntu/pytest-1/test_download_from_github_load0/xarray_tutorial_data/4c5c606840191d085ac934c9665f7387-tiny.nc', mode='r', kwargs={'clobber': True, 'diskless': False, 'persist': False, 'format': 'NETCDF4'}, manager_id='8e236a2d-10ef-4e04-af8c-f64c90ba4a5c'), but file is not already closed. This may indicate a bug. 1939s result = testfunction(**testargs) 1939s 1939s tests/test_tutorial.py::TestLoadDataset::test_download_from_github_load_without_cache 1939s /usr/lib/python3/dist-packages/_pytest/python.py:159: RuntimeWarning: deallocating CachingFileManager(, '/tmp/pytest-of-ubuntu/pytest-1/test_download_from_github_load0/xarray_tutorial_data/4c5c606840191d085ac934c9665f7387-tiny.nc', mode='r', kwargs={'clobber': True, 'diskless': False, 'persist': False, 'format': 'NETCDF4'}, manager_id='cf42049b-8969-41ec-8d4c-70c031f57d54'), but file is not already closed. This may indicate a bug. 1939s result = testfunction(**testargs) 1939s 1939s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-compatible_unit-function_clip] 1939s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[float64-identical_unit-function_clip] 1939s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int64-compatible_unit-function_clip] 1939s tests/test_units.py::TestDataArray::test_numpy_methods_with_args[int64-identical_unit-function_clip] 1939s /usr/lib/python3/dist-packages/numpy/_core/fromnumeric.py:48: DeprecationWarning: __array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0) 1939s return conv.wrap(result, to_scalar=False) 1939s 1939s tests/test_units.py::TestDataArray::test_missing_value_filling[int64-method_ffill] 1939s tests/test_units.py::TestDataArray::test_missing_value_filling[int64-method_bfill] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2766: RuntimeWarning: invalid value encountered in cast 1939s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1939s 1939s tests/test_units.py: 15 warnings 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2803: RuntimeWarning: invalid value encountered in cast 1939s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataArray::test_dropna[int64] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2831: RuntimeWarning: invalid value encountered in cast 1939s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataArray::test_isin[int64-no_unit] 1939s tests/test_units.py::TestDataArray::test_isin[int64-dimensionless] 1939s tests/test_units.py::TestDataArray::test_isin[int64-incompatible_unit] 1939s tests/test_units.py::TestDataArray::test_isin[int64-compatible_unit] 1939s tests/test_units.py::TestDataArray::test_isin[int64-identical_unit] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2856: RuntimeWarning: invalid value encountered in cast 1939s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataArray::test_isin[int64-no_unit] 1939s tests/test_units.py::TestDataArray::test_isin[int64-dimensionless] 1939s tests/test_units.py::TestDataArray::test_isin[int64-incompatible_unit] 1939s tests/test_units.py::TestDataArray::test_isin[int64-compatible_unit] 1939s tests/test_units.py::TestDataArray::test_isin[int64-identical_unit] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:2861: RuntimeWarning: invalid value encountered in cast 1939s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_ffill] 1939s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_bfill] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4252: RuntimeWarning: invalid value encountered in cast 1939s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_ffill] 1939s tests/test_units.py::TestDataset::test_missing_value_filling[int64-method_bfill] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4256: RuntimeWarning: invalid value encountered in cast 1939s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1939s 1939s tests/test_units.py: 15 warnings 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4295: RuntimeWarning: invalid value encountered in cast 1939s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1939s 1939s tests/test_units.py: 15 warnings 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4299: RuntimeWarning: invalid value encountered in cast 1939s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataset::test_dropna[int64] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4325: RuntimeWarning: invalid value encountered in cast 1939s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataset::test_dropna[int64] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4329: RuntimeWarning: invalid value encountered in cast 1939s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 1939s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 1939s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 1939s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 1939s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4353: RuntimeWarning: invalid value encountered in cast 1939s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 1939s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 1939s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 1939s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 1939s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4357: RuntimeWarning: invalid value encountered in cast 1939s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataset::test_isin[int64-no_unit] 1939s tests/test_units.py::TestDataset::test_isin[int64-dimensionless] 1939s tests/test_units.py::TestDataset::test_isin[int64-incompatible_unit] 1939s tests/test_units.py::TestDataset::test_isin[int64-compatible_unit] 1939s tests/test_units.py::TestDataset::test_isin[int64-same_unit] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4362: RuntimeWarning: invalid value encountered in cast 1939s raw_values = np.array([1.4, np.nan, 2.3]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataset::test_interpolate_na[int64] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4438: RuntimeWarning: invalid value encountered in cast 1939s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataset::test_interpolate_na[int64] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4442: RuntimeWarning: invalid value encountered in cast 1939s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) 1939s 1939s tests/test_units.py::TestDataset::test_combine_first[int64-data-no_unit] 1939s tests/test_units.py::TestDataset::test_combine_first[int64-data-dimensionless] 1939s tests/test_units.py::TestDataset::test_combine_first[int64-data-incompatible_unit] 1939s tests/test_units.py::TestDataset::test_combine_first[int64-data-compatible_unit] 1939s tests/test_units.py::TestDataset::test_combine_first[int64-data-same_unit] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4487: RuntimeWarning: invalid value encountered in cast 1939s np.array([1.4, np.nan, 2.3, np.nan, np.nan, 9.1]).astype(dtype) * data_unit 1939s 1939s tests/test_units.py::TestDataset::test_combine_first[int64-data-no_unit] 1939s tests/test_units.py::TestDataset::test_combine_first[int64-data-dimensionless] 1939s tests/test_units.py::TestDataset::test_combine_first[int64-data-incompatible_unit] 1939s tests/test_units.py::TestDataset::test_combine_first[int64-data-compatible_unit] 1939s tests/test_units.py::TestDataset::test_combine_first[int64-data-same_unit] 1939s /usr/lib/python3/dist-packages/xarray/tests/test_units.py:4490: RuntimeWarning: invalid value encountered in cast 1939s np.array([4.3, 9.8, 7.5, np.nan, 8.2, np.nan]).astype(dtype) * data_unit 1939s 1939s tests/test_variable.py::TestIndexVariable::test_to_index_multiindex_level 1939s /usr/lib/python3/dist-packages/xarray/tests/test_variable.py:2447: FutureWarning: the `pandas.MultiIndex` object(s) passed as 'x' coordinate(s) or data variable(s) will no longer be implicitly promoted and wrapped into multiple indexed coordinates in the future (i.e., one coordinate for each multi-index level + one dimension coordinate). If you want to keep this behavior, you need to first wrap it explicitly using `mindex_coords = xarray.Coordinates.from_pandas_multiindex(mindex_obj, 'dim')` and pass it as coordinates, e.g., `xarray.Dataset(coords=mindex_coords)`, `dataset.assign_coords(mindex_coords)` or `dataarray.assign_coords(mindex_coords)`. 1939s ds = Dataset(coords={"x": midx}) 1939s 1939s tests/test_weighted.py::test_weighted_quantile_3D[None-True-q1-a] 1939s tests/test_weighted.py::test_weighted_quantile_3D[True-True-0.5-a] 1939s /usr/lib/python3/dist-packages/numpy/lib/_nanfunctions_impl.py:1617: RuntimeWarning: All-NaN slice encountered 1939s return fnb._ureduce(a, 1939s 1939s -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 1939s =========================== short test summary info ============================ 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[2] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[2] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[2] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[2-True-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_store[3] - Attri... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_test_data[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_load[3] - AttributeErr... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_dataset_compute[3] - A... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_object_dtype[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_float64_data[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_orthogonal_indexing[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing_negative_step[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_outer_indexing_reversed[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_isel_dataarray[3] - At... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_array_type_after_indexing[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_dropna[3] - AttributeE... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_ondisk_after_print[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_bytes_with_fill_value[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value0-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value1-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3--1-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-255-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_coordinate_variables_after_dataset_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_kwarg[3] - At... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_default_fill_value[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_same_dtype[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_append_overwrite_values[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_read_non_consolidated_warning[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_non_existent_store[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_auto_chunk[3] - Attrib... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_manual_chunk[3] - Attr... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_warning_on_bad_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_uneven_dask_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding[3] - At... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_shard_encoding[3] - At... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-group1] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_compressor_encoding[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_group[3] - AttributeEr... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_append_write[3] - Attr... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_not_set_raises[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-U] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-S] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_check_encoding_is_consistent_after_append[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_new_variable[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_no_overwrite[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_compute_false_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_to_zarr_append_compute_false_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_no_warning_from_open_emptydim_with_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-False] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-True] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-None] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-r+] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-a] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_preexisting_override_metadata[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_encoding_chunksizes[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_partial_dask_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_open_zarr_use_cftime[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_write_read_select_write[3] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_attributes[3-obj1] - A... 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1939s FAILED tests/test_backends.py::TestZarrDictStore::test_zarr_fill_value_setting[3-float] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zero_dimensional_variable[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_store[3] - ... 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_test_data[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_load[3] - Attribu... 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dataset_compute[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_object_dtype[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_float64_data[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_orthogonal_indexing[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_vectorized_indexing_negative_step[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_outer_indexing_reversed[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_isel_dataarray[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_array_type_after_indexing[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_dropna[3] - Attri... 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_ondisk_after_print[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_bytes_with_fill_value[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value0-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-fill_value1-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3--1-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_unsigned[3-255-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_coordinate_variables_after_dataset_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_kwarg[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_default_fill_value[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_same_dtype[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_overwrite_values[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_roundtrip_consolidated[3-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_read_non_consolidated_warning[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_auto_chunk[3] - A... 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_manual_chunk[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_warning_on_bad_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_uneven_dask_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_shard_encoding[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_persistence_modes[3-group1] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_compressor_encoding[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_group[3] - Attrib... 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_write[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_not_set_raises[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-U] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_string_length_mismatch_works[3-S] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_check_encoding_is_consistent_after_append[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_new_variable[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_append_with_append_dim_no_overwrite[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_compute_false_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_to_zarr_append_compute_false_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_save_emptydim[3-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_no_warning_from_open_emptydim_with_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-False-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-False-True-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-False-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-False-True-True-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-False-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-False-True-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-False-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-True-True-True-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-False-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-False-True-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-False-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-False] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-True] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region[3-None-True-True-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-None] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-r+] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_region_mode[3-a] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_preexisting_override_metadata[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_encoding_chunksizes[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunk_encoding_with_partial_dask_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_open_zarr_use_cftime[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_write_read_select_write[3] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_attributes[3-obj1] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1939s FAILED tests/test_backends.py::TestZarrDirectoryStore::test_zarr_fill_value_setting[3-float] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zero_dimensional_variable[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_store[3] - Attr... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_test_data[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_load[3] - AttributeEr... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dataset_compute[3] - ... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_object_dtype[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_float64_data[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_orthogonal_indexing[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_vectorized_indexing_negative_step[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_outer_indexing_reversed[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_isel_dataarray[3] - A... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_array_type_after_indexing[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_dropna[3] - Attribute... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_ondisk_after_print[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_bytes_with_fill_value[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value0-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-fill_value1-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3--1-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_unsigned[3-255-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_coordinate_variables_after_dataset_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_kwarg[3] - A... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_default_fill_value[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_same_dtype[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_overwrite_values[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_roundtrip_consolidated[3-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_read_non_consolidated_warning[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_auto_chunk[3] - Attri... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_manual_chunk[3] - Att... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_warning_on_bad_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_uneven_dask_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding[3] - A... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_shard_encoding[3] - A... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_persistence_modes[3-group1] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_compressor_encoding[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_group[3] - AttributeE... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_write[3] - Att... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_not_set_raises[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-U] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_string_length_mismatch_works[3-S] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_check_encoding_is_consistent_after_append[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_new_variable[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_append_with_append_dim_no_overwrite[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_compute_false_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_to_zarr_append_compute_false_roundtrip[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_save_emptydim[3-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_no_warning_from_open_emptydim_with_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-False-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-False-True-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-False-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-False-True-True-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-False-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-False-True-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-False-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-True-True-True-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-False-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-False-True-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-False-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region[3-None-True-True-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-r+] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_region_mode[3-a] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_preexisting_override_metadata[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_encoding_chunksizes[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunk_encoding_with_partial_dask_chunks[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_open_zarr_use_cftime[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_read_select_write[3] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_attributes[3-obj1] - ... 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_zarr_fill_value_setting[3-float] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-True-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-False-None] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-True] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-False] 1939s FAILED tests/test_backends.py::TestZarrWriteEmpty::test_write_empty[3-None-None] 1939s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-full-auto] 1939s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_auto[3-mixed-auto] 1939s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_index_write[3] 1939s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region[3] - Attr... 1939s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_append_chunk_partial[3] 1939s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_region_chunk_partial_offset[3] 1939s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_append_dim[3] 1939s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-r+] 1939s FAILED tests/test_backends.py::TestZarrRegionAuto::test_zarr_safe_chunk_region[3-a] 1939s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[auto] - Attrib... 1939s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[-1] - Attribut... 1939s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks2] - Att... 1939s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks3] - Att... 1939s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks4] - Att... 1939s FAILED tests/test_backends.py::test_open_dataset_chunking_zarr[chunks5] - Att... 1939s FAILED tests/test_backends.py::test_chunking_consintency[auto] - AttributeErr... 1939s FAILED tests/test_backends.py::test_chunking_consintency[-1] - AttributeError... 1939s FAILED tests/test_backends.py::test_chunking_consintency[chunks2] - Attribute... 1939s FAILED tests/test_backends.py::test_chunking_consintency[chunks3] - Attribute... 1939s FAILED tests/test_backends.py::test_chunking_consintency[chunks4] - Attribute... 1939s FAILED tests/test_backends.py::test_chunking_consintency[chunks5] - Attribute... 1939s FAILED tests/test_backends.py::TestNCZarr::test_overwriting_nczarr - Attribut... 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr[zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_zarr_encoding[zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_not_consolidated[zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_round_trip[zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree[zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_chunks[zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups[zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[True-zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[False-zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_datatree_specific_group[None-zarr_format=3] 1939s FAILED tests/test_backends_datatree.py::TestZarrDatatreeIO::test_open_groups_chunks[zarr_format=3] 1939s = 362 failed, 19234 passed, 1887 skipped, 51 deselected, 243 xfailed, 115 xpassed, 1002 warnings in 792.46s (0:13:12) = 1942s E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /tmp/autopkgtest.8kuDDU/autopkgtest_tmp/build; python3.13 -m pytest --deselect=tests/test_weighted.py::test_weighted_operations_keep_attr --deselect=tests/test_variable.py::TestVariable::test_reduce_keepdims --deselect=tests/test_backends.py::test_zarr_region_chunk_partial_offset --deselect=tests/test_backends.py::test_chunk_encoding_with_dask --pyargs xarray 1942s pybuild-autopkgtest: error: pybuild --autopkgtest --test-pytest -i python{version} -p "3.14 3.13" returned exit code 13 1942s make: *** [/tmp/Ccib_DkRuc/run:4: pybuild-autopkgtest] Error 25 1942s pybuild-autopkgtest: error: /tmp/Ccib_DkRuc/run pybuild-autopkgtest returned exit code 2 1943s autopkgtest [12:42:46]: test pybuild-autopkgtest: -----------------------] 1944s autopkgtest [12:42:47]: test pybuild-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 1944s pybuild-autopkgtest FAIL non-zero exit status 25 1944s autopkgtest [12:42:47]: @@@@@@@@@@@@@@@@@@@@ summary 1944s pybuild-autopkgtest FAIL non-zero exit status 25